Failed to build GCC due to C ++ 11 errors

I need an older version of GCC to install CUDA tools, because CUDA tools do not support GCC newer than 5.3.1, and the Fedora machine I'm trying to install it comes with GCC 6. I have little control over the machine, so I had to resort to creating GCC yourself. I have completed the following steps:

$ cd gcc-5.3.0 $ contrib/download_prerequisites $ cd ../build $ ../gcc-5.3.0/configure --prefix=$HOME/local/gcc-5.3.0 --program-suffix=5.3 --enable-shared --enable-multiarch --enable-threads=posix --enable-languages=c,c++,fortran --enable-checking=release --with-tune=generic $ make 

This leads to a successful configure , but make fails with an error:

 cfns.gperf:101:1: error: 'const char* libc_name_p(const char*, unsigned int)' redeclared inline with 'gnu_inline' attribute 

There are also many other C ++ 11 warnings. After some Google searches, I decided that this involved creating GCC 5 or later with GCC 6. I thought this could help if I can get the compiler to follow instead of C ++ 98 So, I tried:

 $ export CXXFLAGS="-std=gnu++98" $ ../gcc-5.3.0/configure ... $ make 

Does not work. I still keep getting the same warnings in C ++ 11, with a build error with the same error. Then I tried:

 $ ../gcc-5.3.0/configure CXXFLAGS="-std=gnu++98" ... $ make 

Again, the same mistake. This time I looked into the Makefile, and it is sure that CXXFLAGS set to -std=gnu++98 here and there. In addition, I also tried building GCC 4.9.3 to find out if this is due to a specific version problem, but I got the same error again.

I'm not sure how to move on. Any help is much appreciated. Thanks.

+6
source share

Source: https://habr.com/ru/post/1013250/


All Articles