Stupid 64 bit GCC installation behavior

Making note of this for my future self:

When installing gcc (4.2) on x86_64 Linux, 32 and 64 bit versions of libstdc++ will be built, but the necessary 64 bit version will be installed in prefix/lib64, not prefix/lib. This makes a horrible mess if you actually want to compile 64 bit C++ programs without having to constantly mess with your linker settings.

This annoyance resulted from trying to install a modern compiler for my own use on a work computer system which is (still) stuck with gcc 3.4.6, which dates from only March of 2006. It isn't so much that that version was bad as that newer compilers are much better. I've been using the trunk version of clang on my laptop, and the executable it produces for my processor intensive program is twice as fast as the one resulting from g++ 4.2. g++ 3.4 just doesn't compare favorably. The natural thing to do was to build clang on the work computer as well.

Unfortunately, clang doesn't (yet) bring with it its own standard c++ library, and it really only likes the version of libstdc++ which shipped with gcc 4.2. And since the system gcc is version 3.6. . . I had to install gcc 4.2 just to get a working standard library. Even after I hacked my local copy of clang to look in the non-system location where I installed my libstdc++ 4.2 headers, an extra half of a day was wasted by trying to figure out why ld refused to actually link my programs with the library.

No Comments

Comment on this post