I use C++11 extensively, so right after installing the new Xubuntu 12.04 LTS release, I went to build gcc from source. After getting the required dependencies using sudo apt-get build-dep gcc-4.7-base
, I checked out the 4.7.0 tag of gcc in Subversion and started building it.
On my 64-bit laptop, the build (configured with --disable-multilib --enable-libstdcxx-time=rt --enable-languages=c,c++
) failed to find files related to libc6-dev despite that package being installed. I was only able to fix the issues by soft linking /usr/lib64 to /usr/lib/x86_64-linux-gnu at the suggestion of a StackOverflow post. After that, gcc built successfully and seems to work fine after install.
My 32-bit desktop system was another story. I had the same initial problem where libc6-dev files couldn't be found by the gcc build chain. In the end I had to export the following environment variables in order for it to build correctly (the idea was taken from here):
export LIBRARY_PATH=/usr/lib/i386-linux-gnu/
export C_INCLUDE_PATH=/usr/include/i386-linux-gnu
export CPLUS_INCLUDE_PATH=/usr/include/i386-linux-gnu
Hoping that had solved my issues, I went to try the newly installed gcc build out, at which point it instantly failed on the first project I tried it on (building the latest version of vim from source). It failed to find the same files the gcc build failed to find, and issued the following message before failing in a flurry of errors:
Hmm, sed is very pessimistic about your system header files. But it did not dump core -- strange! Let's continue carefully... If this fails, you may want to remove offending lines from osdef.h or try with an empty osdef.h file, if your compiler can do without function declarations.
When I took this sob story to the gcc IRC channel, several people there expressed frustration at Ubuntu and told me these errors were caused by Ubuntu 12 changing long-standing paths to files.
Could anyone shed some light on this?