OpenWrt Forum Archive

Topic: ld-uClibc.so.0

The content of this topic has been archived on 10 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/mips-openwrt-linux-uclibc/bin/ld: warning: ld-uClibc.so.0, needed by /mnt/netshare/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/mips-openwrt-linux-uclibc/lib/libc.so, not found (try using -rpath or -rpath-link)

where is ld-uClibc.so.0 supposed to live? so i can make at least a link to it.

thanks.

ant@debian:/mnt/netshare/backfire$ find|grep ld-uClibc.so.0
./build_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/uClibc-0.9.30.1/lib/ld-uClibc.so.0
./staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/lib/ld-uClibc.so.0
./staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib/ld-uClibc.so.0

(Last edited by routednbooted on 19 Jul 2010, 15:55)

Ok, i've now configured to use my own personal toolchain... that works... properly. but with buildroot, who knows...

There should be a precompiled toolchain for at least x86 computers. especially with how easy it is to break gcc builds. the only reason to ever compile from source is if you have something really exotic.

and its just broke again, well done boys.

Hey routednbooted!, can you please tell me how did you do that? i'm getting the same error while trying to compile a programa wich access the memory directly, but i haven't been able to solve this sad:(:(. I'm working with a especial version of the Ben NanoNote, it's called Sie, and is intended for hardware and electronics hacking.

There is special options to compile my toolchain and avoid this problem? Thank you in advance

This error usually happens if you move the toolchain after compilation. The gcc and other utils have absolute paths coded in which will fail if the toolchain is moved.

Hi jow!, you're right, but i haven't move my toolchain after the (loooooong) compilation. Maybe the problem is due to that i'm trying to compile source files that resides in a different folder. The first problem i got was:

../mipsel-openwrt-linux-uclibc/bin/ld: cannot find -lgcc_s

And i solved it with an LDFLAG:

-lgcc_s -L/home/juanjo/openwrt-xburst/build_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/gcc-4.3.3-final/mipsel-openwrt-linux-uclibc/libgcc

.
Now what i get is:

/home/juanjo/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/usr/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.3.3/../../../../mipsel-openwrt-linux-uclibc/bin/ld: warning: ld-uClibc.so.0, needed by /home/juanjo/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/usr/bin/../lib/gcc/mipsel-openwrt-linux-uclibc/4.3.3/../../../../mipsel-openwrt-linux-uclibc/lib/libc.so, not found (try using -rpath or -rpath-link)

So i don't know where the linker is looking for ld-uClibc.so.0 because i have many copies of that file in the whole toolchain. When i try to put -rpath-link "/home/juanjo/NanoNote/openwrt-xburst/staging_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/lib/" whether in LDFLAGS or CCFLAGS (in this case it make not effect), i get this:

mipsel-openwrt-linux-gcc: unrecognized option '-rpath-link'

this is the makefile i have:

CC  = mipsel-openwrt-linux-gcc
all: ram_test

DEBUG = -O3 -g0

COMMON_SOURCES =  ram_test.c jz47xx_gpio.c jz47xx_mmap.c

H_SOURCES = jz47xx_gpio.h jz47xx_mmap.h

INCLUDE = -I.

WARNINGS= -Wcast-align -Wpacked -Wpadded -Wall

CCFLAGS = ${INCLUDE} ${DEBUG} ${WARNINGS} 

LDFLAGS = -lgcc_s -L/home/juanjo/NanoNote/openwrt-xburst/build_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/gcc-4.3.3-final/mipsel-openwrt-linux-uclibc/libgcc

COMMON_OBJECTS = $(COMMON_SOURCES:.cpp=.o)


ADCw        : $(COMMON_OBJECTS) ram_test.o
    $(CC) $(LDFLAGS) $(COMMON_OBJECTS) ram_test.o -o ram_test


.c.o:
    $(CC) -c $(CCFLAGS) $< -o $@

clean: 
    rm -f *.o ram_test ${EXEC} *~ ram_test

indent:
    indent -bad -bap -nbc -bl -nce -i2 --no-tabs --line-length120 $(COMMON_SOURCES) $(H_SOURCES)

Thanks!

/home/juanjo/openwrt-xburst/ != /home/juanjo/NanoNote/openwrt-xburst/

Looks to me like you did move it.

Nop!, it was just an edition i did when doing the post, sorry about that. But don't worry, i solved this by myself, after a long reading, y write this parameter for LDFLAGS:

-B /home/juanjo/NanoNote/openwrt-xburst/build_dir/toolchain-mipsel_gcc-4.3.3+cs_uClibc-0.9.32/uClibc-0.9.32/lib

and after do a make, it works quite right.

Thanks for all the responses, i hope this info will be helpful for other people. big_smile:D:D

jow wrote:

This error usually happens if you move the toolchain after compilation. The gcc and other utils have absolute paths coded in which will fail if the toolchain is moved.

Exactly that's the case when I download the precompiled toolchain. I wish there would be an easy way to fix this instead of compiling my own sdk or changing my project Makefile.

Anyways, I'd like to share my solution to this.

./package/myproject/src/Makefile:

#Makefile introduction...
ifdef STAGING_DIR
LDFLAGS+=-rpath-link $(shell find $(STAGING_DIR) -name ld-uClibc.so.0)
endif
...

this doesn't interfere with building outside the SDK. Better solutions are very welcome.

EDIT:
I decided to move my changes to ./package/myproject/Makefile. This seems to be the better place since it doesn't introduce any changes to my original project Makefile

#
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

TARGET_LDFLAGS+=-rpath-link $(shell find $(STAGING_DIR) -name ld-uClibc.so.0)

PKG_NAME:=myproject
...

(Last edited by piqard on 2 Oct 2011, 03:17)

I had the same problem with a ar71xx OpenWrt SDK and I patched rules.mk by adding  -Wl,-rpath=$(TOOLCHAIN_DIR)/lib to TARGET_LDFLAGS:
replace

    TARGET_LDFLAGS+= -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib

with

    TARGET_LDFLAGS+= -L$(TOOLCHAIN_DIR)/usr/lib -L$(TOOLCHAIN_DIR)/lib -Wl,-rpath=$(TOOLCHAIN_DIR)/lib

The discussion might have continued from here.