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?

  • @Jorge Castro: These instructions only seem to relate to bugs with existing packages. Is there some way to report bugs unrelated to packages?
    – Matt Kline
    May 1, 2012 at 0:50
  • Probably on the gcc you're trying to build gcc on I suspect? May 1, 2012 at 1:10
  • This might be something to post to the ubuntu-devel list too so the gcc maintainer can see it: lists.ubuntu.com/mailman/listinfo/ubuntu-devel May 1, 2012 at 1:12
  • The problem is caused by Ubuntu's move to support multi-arch. I believe Debian is going to same way. The Ubuntu/Debian maintainers are in the process of trying to get the necessary patches committed to upstream gcc, but have not yet been successful. Oneiric already caused some problems, and Precise has caused further problems. I'm trying to get this to go myself, so maybe I'll post something here when I'm done.
    – ams
    May 1, 2012 at 8:45

1 Answer 1


As I said in my comment, the problem is not a bug in either GCC or Ubuntu, but rather an incompatible feature: multiarch. The point of multiarch is to allow binaries for multiple architectures to be installed in the same file system at the same time without collisions. This will replace the old 32-bit vs. 64-bit libraries system that used to exist, but is really more important where we want to have both Intel and ARM installed at once, for example. Presumably this isn't terribly interesting for desktop computers, but Ubuntu exists in many embedded devices (or will do) that might do this sort of thing.

Making changes like this naturally results in files being moved around, so we can expect some disruptions during the switch-over period. GCC currently does not support the new locations yet, but it will do, eventually.

Starting from a standard desktop install, these set-up steps allowed the build to work for me:

amd64 (I tested this one):

sudo -i
# apt-get install libppl0.11-dev libmpfr-dev libgmp-dev libc6-dev-i386
# cd /usr/include
# ln -s x86_64-linux-gnu/* .
# cd /usr/lib
# ln -s x86_64-linux-gnu/crt* .

I see you're using 32-bit Ubuntu. I've not tested this, but I've made the obvious changes.


sudo -i
# apt-get install libppl0.11-dev libmpfr-dev libgmp-dev libc6-dev
# cd /usr/include
# ln -s i386-linux-gnu/* .
# cd /usr/lib
# ln -s i386-linux-gnu/crt* .

WARNING: inserting the soft links are usually harmless, for most people, but could well cause you problems further down the line. (Mostly only if you want to build both 64-bit and 32-bit projects on the same machine.)

  • A few directories and files in /usr/include were duplicates of the ones in /usr/include/i386-linux-gnu, so I moved them to <previous name>-old. So far, this seems to work. Thanks!
    – Matt Kline
    May 2, 2012 at 0:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .