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

Another problem building gcc-4.4_4.4.4-6 related to the recent binutils 2.20.51.20100710-1 patch to set sysroot for cross builds



I have run into another problem that seems related to the recent changes to binutils to set sysroot to /$(PF)/$(TARGET) for cross builds. I don't fully understand why, but my build of gcc-4.4_4.4.4.6 with an alternate prefix that was working fine, but now fails with ld unable to find the correct libraries, unless I build binutils and specify an environment variable to explicitly set WITH_SYSROOT=/, like this:

PF=opt/ilomtools/crosscompiler/100716/arm TARGET=armel WITH_SYSROOT=/ dpkg-buildpackage -us -uc -rfakeroot

The ld error seems to imply that ld is looking for the library it wants using an absolute path, but is starting from a directory that seems to be sysroot more or less as specified by the binutils change. So in other words, ld expects to be looking for the library using a relative path, and is failing because that path is actually absolute. Here is an example:

/opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/ld: cannot find /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/lib/libc.so.6 inside /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/../../arm-linux-gnueabi

Can anyone decipher what is going wrong here and if I should this as a bug? It seems like the sysroot change was intended to make sure binutils picks up cross libraries over host libraries. However, it seems like the path ld is using is already absolute and pointing at the cross library. I have not yet tried building binutils and the compiler normally (without my added prefix PF=blah).

Thanks,

-Jim Heck




Here is some more information:

The rules makefile of binutils changed in 2.20.51.20100710-1, such that the stanza

#-----------------------------------------------------------------
# sysroot options
ifdef WITH_SYSROOT
  with_sysroot = $(WITH_SYSROOT)
endif
ifdef WITH_BUILD_SYSROOT
  with_build_sysroot = $(WITH_BUILD_SYSROOT)
endif

ifneq ($(with_sysroot),)
  CONFARGS += --with-sysroot=$(with_sysroot)
endif
ifneq ($(with_build_sysroot),)
  CONFARGS += --with-build-sysroot=$(with_build_sysroot)
endif


became

#-----------------------------------------------------------------
# sysroot options
ifdef WITH_SYSROOT
  with_sysroot = $(WITH_SYSROOT)
else
  with_sysroot = /$(PF)/$(TARGET)
endif
ifdef WITH_BUILD_SYSROOT
  with_build_sysroot = $(WITH_BUILD_SYSROOT)
endif

CROSS_CONFARGS := $(ADDITIONAL_TARGETS) $(CONFARGS)
ifneq ($(with_sysroot),)
  CROSS_CONFARGS += --with-sysroot=$(with_sysroot)
endif
ifneq ($(with_build_sysroot),)
  CROSS_CONFARGS += --with-build-sysroot=$(with_build_sysroot)
endif

so now for cross builds, sysroot is always specified to be nominally /<prefix -- nominally usr>/<TRIPLET>, where before it defaulted to simply '/' by not being specified.




Here is some more verbose output from the failed gcc compilation:

# @multilib_dir@ is not really necessary, but sometimes it has
# more uses than just a directory name.
/bin/sh ../../../src/libgcc/../mkinstalldirs .
/home/jheck/opt-build-new/gcc-4.4-4.4.4/build/./gcc/xgcc -B/home/jheck/opt-build-new/gcc-4.4-4.4.4/build/./gcc/ -B/opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/ -B/opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/lib/ -isystem /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/include -isystem /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/sys-include -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -isystem ./include -fPIC -Wno-missing-prototypes -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -shared -nodefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc.map -o ./libgcc_s.so.1.tmp -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 _arm_negdf2_s.o _arm_addsubdf3_s.o _arm_muldivdf3_s.o _arm_cmpdf2_s.o _arm_unorddf2_s.o _arm_fixdfsi_s.o _arm_fixunsdfsi_s.o _arm_truncdfsf2_s.o _arm_negsf2_s.o _arm_addsubsf3_s.o _arm_muldivsf3_s.o _arm_cmpsf2_s.o _arm_unordsf2_s.o _arm_fixsfsi_s.o _arm_fixunssfsi_s.o _arm_floatdidf_s.o _arm_floatdisf_s.o _arm_floatundidf_s.o _arm_floatundisf_s.o _clzsi2_s.o _clzdi2_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 _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 _fixunssfsi_s.o _fixunsdfsi_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 _floatdisf_s.o _floatdidf_s.o _floatdixf_s.o _floatditf_s.o _floatundisf_s.o _floatundidf_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 addsf3_s.o divsf3_s.o eqsf2_s.o gesf2_s.o lesf2_s.o mulsf3_s.o negsf2_s.o subsf3_s.o unordsf2_s.o fixsfsi_s.o floatsisf_s.o floatunsisf_s.o adddf3_s.o divdf3_s.o eqdf2_s.o gedf2_s.o ledf2_s.o muldf3_s.o negdf2_s.o subdf3_s.o unorddf2_s.o fixdfsi_s.o floatsidf_s.o floatunsidf_s.o extendsfdf2_s.o truncdfsf2_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 && (echo "/* GNU ld script"; echo " Use the shared library, but some functions are only in"; echo " the static library. */"; echo "GROUP ( libgcc_s.so.1 libgcc.a )" ) > ./libgcc_s.so /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/ld: cannot find /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/lib/libc.so.6 inside /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/../../arm-linux-gnueabi /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/ld: cannot find /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/lib/libc_nonshared.a inside /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/../../arm-linux-gnueabi /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/ld: cannot find /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/lib/ld-linux.so.3 inside /opt/ilomtools/crosscompiler/100716/arm/arm-linux-gnueabi/bin/../../arm-linux-gnueabi
collect2: ld returned 1 exit status
make[4]: *** [libgcc_s.so] Error 1
make[4]: Leaving directory `/home/jheck/opt-build-new/gcc-4.4-4.4.4/build/arm-linux-gnueabi/libgcc'
make[3]: *** [all-target-libgcc] Error 2
make[3]: Leaving directory `/home/jheck/opt-build-new/gcc-4.4-4.4.4/build'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/jheck/opt-build-new/gcc-4.4-4.4.4/build'
s=`cat status`; rm -f status; test $s -eq 0
make[1]: *** [stamps/05-build-stamp] Error 1
make[1]: Leaving directory `/home/jheck/opt-build-new/gcc-4.4-4.4.4'
make: *** [stamps/05-build-stamp] Error 2
dpkg-buildpackage: failure: debian/rules build gave error exit status 2
jheck@lenny:~/opt-build-new/gcc-4.4-4.4.4$


Reply to: