On Mon, 2011-05-09 at 21:56 +0100, Jonathan Wakely wrote: > > Can anyone explain how the interaction between include-fixed and > > cross-compiling is intended to work? > > What is the output of 'gcc -v' ? > > Did you actually build gcc as a cross-compiler using --target or > --with-sysroot at configure time? > > It sounds like you've just built a native compiler on RHEL4 and are > only using --sysroot, which (if I understand correctly) doesn't make > it a cross-compiler, and gcc still assumes the target system is the > same as the host system where you're running the compiler, so the > include-fixed headers would still be valid for the target system. Hi Jonathan; thanks for the reply. gcc -v gives me: Target: x86_64-generic-linux-gnu Configured with: /usr/src/gcc/gcc-4.5.2/configure --prefix=/tmp/invalid/generic --disable-nls --disable-werror --with-build-sysroot=/tmp/invalid/rhel4/sysroot --with-gmp=/tmp/invalid/generic --with-mpfr=/tmp/invalid/generic --with-mpc=/tmp/invalid/generic --with-gnu-as --with-gnu-ld --build=i686-generic-linux-gnu --host=i686-generic-linux-gnu --enable-targets=all --target=x86_64-generic-linux-gnu --with-sysroot=/invalid --enable-languages=c,c++ Thread model: posix gcc version 4.5.2 (GCC) Now when I invoke GCC, I need to always provide a --sysroot because this compiler is configured, insofar as I can make it, to never look at /usr/include, /lib, /usr/lib, etc. at all (this is what I want). Since my target and host are different, I think this should be a cross-compiler (as I understand it). However, I am invoking the compiler with the -m32 flag so the output is actually 32bit... which is the same as the host. Not sure if GCC will figure out that kind of thing at runtime (vs. configure time). Regardless of cross-compilation, thinking about it more it seems that if I specify a sysroot that GCC should not be using include-fixed. The whole include-fixed thing really binds the compiler to a specific target libc/headers/etc. in a most unpleasant way. I think instead of having include-fixed configured at build time and stowed in the compiler's internals, GCC should provide a separate application that will fix the includes, and it should be installed by GCC's "make install" so it can be invoked against whatever sysroot you're using and generate output that lives with the sysroot, not the compiler. A default set of include-fixed could continue to be generated, but when --sysroot is given the compiler's include-fixed should NOT be searched; instead some equivalent directory in the sysroot should be searched.