Here is my short tutorial about compiling the newest GCC (with C++-x0 features such as lambdas, shared_ptr, etc) on the modern Ubuntu/Debian systems. If you try to compile GCC in environment with multilib configuration (64 and 32 bit libraries deployed to different directories), compiler will stop on errors where 32 bit libraries cannot be found. I browsed a lot of pages and I found information about unsolved bug with compilation GCC by hand. Maintainers of the GCC compilers applied some patches to achieve correct compilation for previous versions of compiler in this environment. However, I don’t want to use this way, because I preferred a simple solution for now (next major release will include gcc-4.7).
Here is my quick fix. This only compiles gcc and g++ without bootstrap stages and multilib configuration (quite fast, by the way). Use the following switches:
./configure --prefix=/opt/gcc-4.7 --enable-languages=c,c++ --enable-threads=posix --enable-tls --enable-libgomp --enable-lto --disable-nls --disable-checking --disable-multilib --disable-bootstrap
make -j(yours processors count)
Finally, it’s my first post in English language. If you find any mistakes feel free to send me feedback.