I finally solved this problem by downgrading GCC version to 7.5. I had to make a compromise because the project needs to progress. This can't really be considered a solution because the real reason for why higher version GCC doesn't work still remains unresolved.