[uClibc] crt1.o error during toolchain build

Oleg Girko ol at infoserver.ru
Thu Sep 9 01:36:29 UTC 2004


On Thursday 09 September 2004 02:23, Chris Verges wrote:

> I'm trying to create a uClibc toolchain from the gcc-3.4.x line, but I'm
> running into some problems.  During the compile, I get the following error:
>
>     make STAGING_DIR=${CROSS_INSTALL_DIR} \
>          BUILD_WITH_LARGEFILE=false \
>          INSTALL_LIBSTDCPP=true
>       ...
>     /tmp/i386-linux-uclibc/bin/i386-linux-uclibc-gcc  -Wall
>     -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
>     -mpreferred-stack-boundary=2 -falign-jumps=0 -falign-loops=0 -Os
>     -funit-at-a-time       -fno-builtin -nostdinc -D_LIBC -I../include
>     -I. -I/tmp/i386-linux-uclibc/lib/gcc/i386-linux-uclibc/3.4.1/include
>     -DNDEBUG -fPIC  -D__LDSO_LDD_SUPPORT -Wl,-s \
>             -DUCLIBC_RUNTIME_PREFIX=\"/\" \
>             -DUCLIBC_LDSO=ld-uClibc.so.0 \
>             ldd.c -o ldd  -L../lib
>    
> /tmp/i386-linux-uclibc/lib/gcc/i386-linux-uclibc/3.4.1/../../../../i386-lin
>ux-uclibc/bin/ld: crt1.o: No such file: No such file or directory
>     collect2: ld returned 1 exit status
>
> I have tried turning off the CTOR/DTOR options, but it doesn't seem to
> affect the error message.  Any advice on how to fix this problem is
> appreciated!

It may be coincidence, but yesterday I decided to rebuild toolchain. I cleaned 
up ${STAGING_DIR} removing all files and directories in it, but did not 
remove ${STAGING_DIR} itself. This was fatal mistake leading to the error 
similar to one you've encountered. The problem lies in the following role in 
toolchain's Makefile:

$(STAGING_DIR):
        rm -rf $(STAGING_DIR)
        mkdir -p $(BUILD_DIR)
        mkdir -p $(TOOL_BUILD_DIR)
        mkdir -p $(STAGING_DIR)/lib
        mkdir -p $(STAGING_DIR)/include
        mkdir -p $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)
        ln -sf ../lib $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/lib

As you see, `${STAGING_DIR}/i386-linux-uclibc/lib' must be a symlink pointing 
to `${STAGING_DIR}/lib'.

But if ${STAGING_DIR} exists, this rule is never invoked. Later, build process 
eventually creates `${STAGING_DIR}/i386-linux-uclibc/lib' directory, but it 
has nothing common to `${STAGING_DIR}/lib'.

Finally, `crt1.o' gets installed into `${STAGING_DIR}/lib', but linker expects 
it in `${STAGING_DIR}/i386-linux-uclibc/lib'.

Solution: remove ${STAGING_DIR} completely and rebuild toolchain.

Warning: I'be never built 3.4 toolchain. The probem I've encountered was with 
3.3 toolchain.

-- Oleg Girko, http://www.infoserver.ru/~ol/



More information about the uClibc mailing list