libgcc references files that cannot be there because they are in the libc, which can only be built with the cross compiler that is currently being built. In particular, I noticed sys/ucontext.h, but other headers are references as well. Environment: System: Linux beholder 2.5.69 #26 Tue May 20 12:01:42 CEST 2003 i686 unknown unknown GNU/Linux Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: powerpc-unknown-linux-gnu configured with: ./configure --prefix=/opt/cross --target=powerpc-unknown-linux-gnu --disable-shared --enable-static How-To-Repeat: ./configure --target=ppc-linux --disable-shared --enable-static; make
Fix: do not reference those headers from libgcc.
try with --without-headers for configure option, you might also want just to compile the c compiler, --enable-languages=c .
I'm guessing you need some sort of --ffreestanding argument to build, but someone more expert will have to confirm this.
Asking again to make sure this gets through try with --without-headers for configure option, you might also want just to compile only the c compiler, --enable-languages=c .
Yeah of course I only compiled the C compiler, the C++ runtime depends on glibc which can't be compiled unless I install the C compiler only first. So obviously I have to compile only the C compiler first. Regarding the --without-headers option -- what is the point of that? Building a cross compiler should _never_ depend on the libc for the target platform being installed. This is not optional, in particular if things like sys/ucontext.h is included, which depend on the system and not on the libc. I am also surprised because this option is not only not mentioned in INSTALL/*, it is also not in any configure script in the gcc 3.3 distribution. Did you make that option up?
Did you read http://gcc.gnu.org/install/configure.html? --with-headers "This option with the dir argument is required when building a cross compiler, if prefix /target /sys-include doesn't pre-exist " "--with option has a corresponding --without option" --without-headers, just disables the use of headers.
I don't know if this answers your question, but libgcc, the piece of the compiler which needs the headers, is built for the _target_. As such it needs to know certain information about the target, thus it must include target headers. If all you want is a cross compiler, cc1 is will do the trick. For a complete cross toolchain though, you need a libgcc compiled to run on PPC, and thus the headers are necessary. Dara
This is true still, no need to check it but I think this is a dup of another bug but I cannot find the bug right now.
This seems to be true of many other linux targets (not just powerpc-linux)...
The reason why you need these headers is so that libgcc gets build with expection support which is needed otherwise there are conflicts on how glibc is built and such.
You really do need --without-headers to prevent libgcc from referencing libc, so this bug is invalid. That is, it would be if --without-headers worked. See bug 8180. --without headers should work as of gcc-3.4 cvs yesterday. For gcc-3.3, --without-headers is broken, but people work around that by giving --with-newlib when configuring to build libgcc, even if they intend to use glibc instead of newlib. See http://kegel.com/crosstool and look at how I configure gcc the first time.
Marking this as invalid as you did not use --without-headers (but that will not work in 3.3 but this was bug 8180 which is fixed on the mainline) and there is a workaround for that not working see the previous comment.