Unable to build GCC due to c++11 errors
<p>I need an older version of GCC for installing CUDA toolkit, as CUDA toolkit does not support GCC newer than 5.3.1, and the Fedora machine I am trying to install it on comes with GCC 6. I don't have much control over the machine, so I have had to resort to building GCC myself. The steps I have followed are:</p>

<pre><code>$ 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
</code></pre>

<p>This results in successful <code>configure</code>, but <code>make</code> fails with error:</p>

<pre><code>cfns.gperf:101:1: error: ‘const char* libc_name_p(const char*, unsigned int)’ redeclared inline with ‘gnu_inline’ attribute
</code></pre>

<p>There are a whole bunch of other C++11 warnings as well. After some google searches, I figured that this had to do with building GCC 5 or older with GCC 6. I thought it might help if I could force the compiler to follow C++98 instead. So, I tried:</p>

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

<p>Didn't work. I still keep getting the same C++11 warnings, with build failing with the exact same error. Then, I tried:</p>

<pre><code>$ ../gcc-5.3.0/configure CXXFLAGS="-std=gnu++98" ...
$ make
</code></pre>

<p>Again, same error. I peeked at the Makefile this time, and it sure had <code>CXXFLAGS</code> set to <code>-std=gnu++98</code> here and there. Also, I have tried to build GCC 4.9.3 as well to see if this is a problem tied to a specific release, but I got the same error again. </p>

<p>I am not sure how to proceed further. Any help is much appreciated. Thanks.</p>