I am working with Ubuntu 14.04 LTS.
This already ships a packaged gcc
4.8.4 but I wanted to have a later version of gcc
.
Using the existing version 4.8.4, I built version 4.9.4 from the source code through the recommended chain compile-build-test-install.
I have used no exotic settings for ./configure
except for a prefix directory and a program-suffix. The rest is default.
All seems to have gone well. The test summary for g++
shows no FAIL and two XPASS calls only
XPASS: g++.dg/tls/thread_local-order2.C -std=c++11 execution test
XPASS: g++.dg/tls/thread_local-order2.C -std=c++1y execution test
I then wanted to build version 5.4.0 using the newly installed 4.9.4, to put the latter to the test with a minimum learning curve.
I edited the same installation script used for 4.9.4 only by specifying the make
flags CC
and CXX
.
These flags now point to the binaries in the 4.9.4 installation directory.
The configure stage for 5.4.0 proceeds well.
I see from the files config.log
and Makefile
that the new binaries' paths are read in correctly.
The build stage fails though and stderr
reports some 100 errors.
The earliest and most frequently recurring ones are of type
`error: template with C linkage`
`error: template specialization with C linkage`
They show up in patterns of blocks like this one:
In file included from ${installation directory for 4.9.4}/include/c++/4.9.4/bits/stringfwd.h:40:0,
from ${installation directory for 4.9.4}/include/c++/4.9.4/iosfwd:39,
from /usr/include/x86_64-linux-gnu/gmp.h:25,
from /usr/local/include/isl/val_gmp.h:4,
from ${source directory for 5-4-0}/gcc/graphite-isl-ast-to-gimple.c:35:
${installation directory for 4.9.4}/include/c++/4.9.4/bits/memoryfwd.h:63:3: error: template with C linkage
template<typename>
^
${installation directory for 4.9.4}/include/c++/4.9.4/bits/memoryfwd.h:66:3: error: template specialization with C linkage
template<>
^
${installation directory for 4.9.4}/include/c++/4.9.4/bits/memoryfwd.h:70:3: error: template with C linkage
template<typename, typename>
^
I would think that the 5.4.0 source is fine, since all information has been gathered and processed in the same way as it was for 4.9.4. There could be an error/omission in the configure stage of either 4.9.4, or 5.4.0 or both.
Which flaws do these errors indicate? How do you fix them?
Thanks for thinking along.
A search query on StackExchange on error: template with C linkage
gives about 171,000 results.
The posts that I skimmed do not seem to address this point:
https://stackoverflow.com/questions/4115930/using-cygwin-to-build-template-with-c-linkage
Note that I am not interested in triaging the codes, but in setting up a (robustly) working compiler.
gcc-5.4
? If the latter, then iirc it's available from the toolchain-r ppa