Cross compiling GCC stage 2: putting host objects in target dir
Andrew Haley
aph@redhat.com
Tue Feb 17 16:50:00 GMT 2009
david.hagood@gmail.com wrote:
> I know I'm doing something stupid, but I don't know what:
>
> I am trying to cross-compile binutils/gcc/glibc, HOST=i686-linux-gnu,
> TARGET=arm-linux-gnueabi, so that I can build for an embedded system
> running Debian on an OMAP3 using my x86 workstation.
>
> I can complete the build of binutils, the first pass of GCC, and glibc
> with no errors (as far as I can see).
>
> However, when I then start the second pass GCC build (so that it can use
> the generated glibc and compile target apps), I get an error at the end of
> the build:
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/bin/ld:
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: Relocations in
> generic ELF (EM: 3)
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/bin/ld:
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: Relocations in
> generic ELF (EM: 3)
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/bin/ld:
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: Relocations in
> generic ELF (EM: 3)
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/bin/ld:
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: Relocations in
> generic ELF (EM: 3)
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/bin/ld:
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: Relocations in
> generic ELF (EM: 3)
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/bin/ld:
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: Relocations in
> generic ELF (EM: 3)
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: could not read
> symbols: File in wrong format
> collect2: ld returned 1 exit status
> make[2]: *** [libgcc_s.so] Error 1
> make[2]: Leaving directory
> `/space/src/arm-linux-gnueabi/build/gcc/build/glibc/arm-linux-gnueabi/libgcc'
> make[1]: *** [all-target-libgcc] Error 2
> make[1]: Leaving directory
> `/space/src/arm-linux-gnueabi/build/gcc/build/glibc'
> make: *** [all] Error 2
> ----
>
> The offending file is an x86 library:
> file /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o
> /USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/crti.o: ELF 32-bit LSB
> relocatable, Intel 80386, version 1 (SYSV), not stripped
>
>
> It seems that GCC is placing a host library (x86 ELF) into the target
> library directory, then attempts to link against them for the target.
No. gcc didn't put it there: crti.o is part of glibc.
You need to find out why an x86 binary has been installed by the glibc
build.
Andrew.
More information about the Gcc-help
mailing list