I am trying to get a modern GCC to compile on Centos 6.4. The problem is that Centos does not have a modern glibc and GCC 4.8.x and 4.7.x keep giving me the following compile error:
... -DL_gcov -c ../../.././libgcc/libgcov.c
In file included from /usr/include/features.h:385:0,
from /usr/include/stdio.h:28,
from ../../.././libgcc/../gcc/tsystem.h:88,
from ../../.././libgcc/libgcov.c:29:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
The problem here is the gnu/stubs-32.h
is part of the modern glibc
and Centos 6.4 doesn't seem to have it. I've tried building my own glibc
but as soon as it gets installed and in my local LD_LIBRARY_PATH
I can't run any other programs, because all of the existing executables on the system try to link against it and they fail.
I want to use the new compiler because it has dramatically better handling of C++ STL code, and because the optimizer in GCC 4.8 makes my code run in 1/2 the time as the GCC 4.4.7 compiler that comes with Centos.
Any suggestions on how to do this?
Ahh, welcome to the fun of super outdated libraries. I've run into similar problems, and our solution was to compile a second version of GLIBC and explicitly use that when starting software.
I've only had to do this on CentOS 5, so you may be able to get away with higher software versions then I mention.
You'll need to build GLIBC like this:
(I was using GLIBC 2.15, similar commands should work with newer versions)
Once it's built, manually run your app with something like this:
Things are going to be further complicated by the fact you need a modern version of GCC. I don't have a decent solution for you, you're going to need to play around with running things with the alternate version of glibc in order to get your newer gcc to build properly.
Build the gcc compiler on your Centos and target only 64 bits.
Excerpt from documentation:
You could install a newer glibc into
~/lib
and install gcc in~/bin
and linking against the newer glibc. I'd advise to use that only for your application that runs on the supercomputer and to link everything (including libc) statically to avoid making a bigger mess than you'll have to make for this.It's not a particularly neat/elegant solution, but it may just get the job done. I did something similar years ago when mucking about with ld.so and not wanting to mess up the entire system :-)