Cross compiling GCC stage 2: putting host objects in target dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

----
/bin/sh /USER/src/arm-linux-gnueabi/gcc-4.3.2/libgcc/../mkinstalldirs .
/USER/src/arm-linux-gnueabi/build/gcc/build/glibc/./gcc/xgcc
-B/USER/src/arm-linux-gnueabi/build/gcc/build/glibc/./gcc/
-B/USER/tools/i686-linux-gnu//arm-linux-gnueabi/bin/
-B/USER/tools/i686-linux-gnu//arm-linux-gnueabi/lib/ -isystem
/USER/tools/i686-linux-gnu//arm-linux-gnueabi/include -isystem
/USER/tools/i686-linux-gnu//arm-linux-gnueabi/sys-include -O2  -O2 -g -g
-O2   -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE   -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem
./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2
-D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -shared -nodefaultlibs
-Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o
./libgcc_s.so.1.tmp -O2 -g -g -O2 -B./ _udivsi3_s.o _divsi3_s.o
_umodsi3_s.o _modsi3_s.o _bb_init_func_s.o _call_via_rX_s.o
_interwork_call_via_rX_s.o _lshrdi3_s.o _ashrdi3_s.o _ashldi3_s.o
_negdf2_s.o _addsubdf3_s.o _muldivdf3_s.o _cmpdf2_s.o _unorddf2_s.o
_fixdfsi_s.o _fixunsdfsi_s.o _truncdfsf2_s.o _negsf2_s.o _addsubsf3_s.o
_muldivsf3_s.o _cmpsf2_s.o _unordsf2_s.o _fixsfsi_s.o _fixunssfsi_s.o
_floatdidf_s.o _floatdisf_s.o _floatundidf_s.o _floatundisf_s.o
_aeabi_lcmp_s.o _aeabi_ulcmp_s.o _aeabi_ldivmod_s.o _aeabi_uldivmod_s.o
_dvmd_lnx_s.o _muldi3_s.o _negdi2_s.o _cmpdi2_s.o _ucmpdi2_s.o
_clear_cache_s.o _enable_execute_stack_s.o _trampoline_s.o __main_s.o
_absvsi2_s.o _absvdi2_s.o _addvsi3_s.o _addvdi3_s.o _subvsi3_s.o
_subvdi3_s.o _mulvsi3_s.o _mulvdi3_s.o _negvsi2_s.o _negvdi2_s.o
_ctors_s.o _ffssi2_s.o _ffsdi2_s.o _clz_s.o _clzsi2_s.o _clzdi2_s.o
_ctzsi2_s.o _ctzdi2_s.o _popcount_tab_s.o _popcountsi2_s.o
_popcountdi2_s.o _paritysi2_s.o _paritydi2_s.o _powisf2_s.o _powidf2_s.o
_powixf2_s.o _powitf2_s.o _mulsc3_s.o _muldc3_s.o _mulxc3_s.o _multc3_s.o
_divsc3_s.o _divdc3_s.o _divxc3_s.o _divtc3_s.o _bswapsi2_s.o
_bswapdi2_s.o _fixunsxfsi_s.o _fixsfdi_s.o _fixdfdi_s.o _fixxfdi_s.o
_fixtfdi_s.o _fixunssfdi_s.o _fixunsdfdi_s.o _fixunsxfdi_s.o
_fixunstfdi_s.o _floatdixf_s.o _floatditf_s.o _floatundixf_s.o
_floatunditf_s.o _divdi3_s.o _moddi3_s.o _udivdi3_s.o _umoddi3_s.o
_udiv_w_sdiv_s.o _udivmoddi4_s.o bpabi_s.o unaligned-funcs_s.o
unwind-arm_s.o libunwind_s.o pr-support_s.o unwind-c_s.o emutls_s.o -lc &&
rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f
./libgcc_s.so.1 ./libgcc_s.so.1.backup; else true; fi && mv
./libgcc_s.so.1.tmp ./libgcc_s.so.1 && ln -s libgcc_s.so.1 ./libgcc_s.so
/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.

I *know* it has to be something stupid - some command line parameter I am
getting wrong -  but for the life of me I've not found anything online
which gives me a clue what I am doing wrong.

I am using the following commands to do the build:

--------------

export PREFIX=/USER/tools/i686-linux-gnu/
export TARGET=arm-linux-gnueabi
export BASE_DIR=/space/src/arm-linux-gnueabi
cd $BASE_DIR

GCC=gcc-4.3.2
BINUTILS=binutils-2.19
GLIBC=glibc-2.7
HOST=i686-linux-gnu

rm -rf build
mkdir -p build/binutils
cd build/binutils
${BASE_DIR}/${BINUTILS}/configure --target=${TARGET} --host=${HOST}
--prefix=${PREFIX} --disable-nls
make all install || exit 1
export PATH=${PREFIX}/bin:${PATH}

cd $BASE_DIR
mkdir -p build/gcc
cd build/gcc
${BASE_DIR}/${GCC}/configure \
         --target=${TARGET} --host=${HOST} --prefix=${PREFIX} \
         --with-gnu-as --with-gnu-ld \
         --disable-multilib --disable-nls \
         --enable-threads=no \
         --enable-symvers=gnu --enable-__cxa_atexit \
         --disable-shared --enable-languages=c || exit 1
make all-gcc install-gcc || exit 1

mkdir -p build/glibc
cd build/glibc
${BASE_DIR}/${GLIBC}/configure \
         --target=${TARGET} --host=i686-linux-gnu
--prefix=${ROOTDIR_PREFIX}  || exit 2
make all install || exit 3

cd build/gcc
${BASE_DIR}/${GCC}/configure \
         --target=${TARGET} --host=${HOST} --build=${HOST}
--prefix=${PREFIX} \
         --with-gnu-as --with-gnu-ld \
         --disable-nls --enable-threads=posix  \
         --enable-symvers=gnu --enable-__cxa_atexit --disable-multilib \
--enable-languages=c,c++ || exit 3

make all install || exit 4

export ROOTDIR_PREFIX=${PREFIX}/${TARGET}
export BUILD_PREFIX=/USER/src/arm-linux-gnueabi/build
--------------

OK, so, what stupid thing am I missing?





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux