Can't build gcc anymore since upgrade to 11.10
Posted
by
Raphael R.
on Ask Ubuntu
See other posts from Ask Ubuntu
or by Raphael R.
Published on 2011-10-19T16:37:33Z
Indexed on
2011/11/11
18:27 UTC
Read the original article
Hit count: 497
On Monday I've upgraded to from Ubuntu 11.04 (my initial installation) to 11.10 and now I can't build gcc from source anymore. Since I forgot to uninstall the gcc package before the upgrade, Ubuntu replaced my 4.7.0 compiler with it's stable 4.6.1. So I tried to build the SVN sources again, but it fails. I've most recently tried it with SVN revision 180193.
After some time, the build fails with the following message:
/home/raphael/devel/gcc/build/./gcc/xgcc -B/home/raphael/devel/gcc/build/./gcc/ -B/usr/i686-pc-linux-gnu/bin/ -B/usr/i686-pc-linux-gnu/lib/ -isystem /usr/i686-pc-linux-gnu/include -isystem /usr/i686-pc-linux-gnu/sys-include -g -O2 -O2 -I. -I. -I../../src/gcc -I../../src/gcc/. -I../../src/gcc/../include -I../../src/gcc/../libdecnumber -I../../src/gcc/../libdecnumber/bid -I../libdecnumber -I../../src/gcc/../libgcc -g -O2 -DIN_GCC -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -fbuilding-libgcc -fno-stack-protector -I. -I. -I../.././gcc -I../../../src/libgcc -I../../../src/libgcc/. -I../../../src/libgcc/../gcc -I../../../src/libgcc/../include -I../../../src/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS -DUSE_TLS -o _ashldi3.o -MT _ashldi3.o -MD -MP -MF _ashldi3.dep -DL_ashldi3 -c ../../../src/libgcc/../gcc/libgcc2.c \
-fvisibility=hidden -DHIDE_EXPORTS
In file included from /usr/include/stdio.h:28:0,
from ../../../src/libgcc/../gcc/tsystem.h:88,
from ../../../src/libgcc/../gcc/libgcc2.c:29:
/usr/include/features.h:323:26: fatal error: bits/predefs.h: File or directory not found.
I've cofigured it with:
~/devel/gcc/build$ ../src/configure --prefix=/usr --enable-languages=c++
And make it with:
~/devel/gcc/build$ make -j4
Just to be sure, I did a rm -rf *
in the build directory in case there's some broken stuff inside. Didn't help, though.
That's the backstory. I tried to fix it and searched for the bits/predefs.h
. It's inside /usr/include/i386-linux-gnu
. I temporarily fixed the problem by doing
~/devel/gcc/build$ C_INCLUDE_PATH=/usr/include/i386-linux-gnu make -j4
Which is only temporary because now gcc complains that it can't find crti.o
.
Which i can find in /usr/lib/i386-linux-gnu
. Now i could also set - actually it doesn't work - but I feel like I'm fighting the system here. Also, even if it succeeds, my newly built compiler would also not know about the C_LIBRARY_PATH
i386-linux-gnu
stuff. So I would have to set C_LIBRARY_PATH
and C_INCLUDE_PATH
before every build of every project I have. I could add it to my .bashrc but that subverts the system even more.
So, how do I tell the build process:
- That there are additional include/lib directories, and
- That it should build a gcc which respects them too?
Edit: I forgot to include the command which causes the above error message. Also I can think of another solution: Copy the stuff from /usr/include/i386-linux-gnu
to /usr/include
(same thing for /usr/lib/i386-linux-gnu
to /usr/lib
). But that doesn't feel right, either. Finally, the system's gcc 4.6.1 can compile other applications just fine, except mine, which use C++11 features not present in the 4.6 series.
© Ask Ubuntu or respective owner