chroot'd toolchain & gnu libc issue? (was Re: Proper use of libtool under buildroot?)

Marcus Crafter crafterm at gmail.com
Mon Dec 12 10:13:07 UTC 2005


On 12/12/2005, at 10:35 AM, Marcus Crafter wrote:
>>
>> something is really wrong then, those files shouldn't depend on  
>> host libc
>>
>> try to use readelf -d instead of ldd
>
> Ok, tried that, unfortunately readelf is also linked against the  
> host libc from the looks of it:
>
> bellagio[/home/crafterm/workspace/new/buildroot/build_i386]:12>sudo  
> chroot root
> bellagio[/]:1>/usr/bin/readelf -d /usr/bin/gcc
> bash: /usr/bin/readelf: No such file or directory
> bellagio[/]:2>ldd /usr/bin/readelf
>         libc.so.6 => not found (0x00000000)
>         /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
> bellagio[/]:3>
>
>>>>>
>>>>> Have I perhaps built the toolchain incorrectly? Shouldn't they be
>>>>> linked against the uclibc libc shared library?
>>
>> they should
>
> Ok. I'm looking into the Makefiles, toolchain/gcc/gcc-uclibc-3.x.mk  
> defines a target
>
> GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-$(GCC_VERSION)-target
>
> which seems like it should be building the 'target' GCC, etc. Still  
> digging to see what's going on, at least I know now that it should  
> work :)
>
> Any thing else I might be able to check?

Ok, the only thing I can see at this stage is that buildroot/packages  
are usually 'configure'd/built with $(TARGET_CONFIGURE_OPTS)  
provided. eg from make.mk:

$(GNUMAKE_DIR)/.configured: $(GNUMAKE_DIR)/.unpacked
         (cd $(GNUMAKE_DIR); rm -rf config.cache; \
                 $(TARGET_CONFIGURE_OPTS) \
                 CFLAGS="$(TARGET_CFLAGS)" \
                 ./configure \
                 --target=$(GNU_TARGET_NAME) \
                 --host=$(GNU_TARGET_NAME) \
                 --build=$(GNU_HOST_NAME) \
                 --prefix=/usr \
		... and so on

whereas the target gcc compiler doesn't have this:

GCC_BUILD_DIR3:=$(BUILD_DIR)/gcc-$(GCC_VERSION)-target

$(GCC_BUILD_DIR3)/.configured: $(GCC_BUILD_DIR2)/.installed
         mkdir -p $(GCC_BUILD_DIR3)
         (cd $(GCC_BUILD_DIR3); PATH=$(TARGET_PATH) \
                 $(GCC_DIR)/configure \
                 --prefix=/usr \
                 --build=$(GNU_HOST_NAME) \
                 --host=$(REAL_GNU_TARGET_NAME) \
                 --target=$(REAL_GNU_TARGET_NAME) \
                 --enable-languages=$(TARGET_LANGUAGES) \
		..... and so on

Seems like $(TARGET_CONFIGURE_OPTS) which defines:

TARGET_CONFIGURE_OPTS=PATH=$(TARGET_PATH) \
                 AR=$(TARGET_CROSS)ar \
                 AS=$(TARGET_CROSS)as \
                 LD=$(TARGET_CROSS)ld \
                 NM=$(TARGET_CROSS)nm \
                 CC=$(TARGET_CROSS)gcc \
                 GCC=$(TARGET_CROSS)gcc \
                 CXX=$(TARGET_CROSS)g++ \
                 RANLIB=$(TARGET_CROSS)ranlib \
                 OBJCOPY=$(TARGET_CROSS)objcopy

isn't provided when buiding the target's gcc compiler. I can't see  
anything similar that would point it to some other CC other than  
what's in the default path at this stage. hmm.

Still digging... just thought i'd mention it in case you/anyone had  
any other thoughts as to what might be wrong.

Cheers,

Marcus



More information about the uClibc mailing list