I am working in an embedded environment. I have a cross compiler for ARM architecture with eglibc
as it's primary library (ie. the default libc
coming along with the tool chain). Now I want some of the applications to link with uClibc
. So I compiled uClibc
with that tool-chain. Now while trying to compile and link the application with uClibc
, there is an error. It is getting linked with the default library of the tool-chain. I think its is possible to have two different libcs on the same machine (eg. libc, uClibc).
I searched on the net and came with the following
Multiple glibc libraries on a single host
As it suggested, I did the following
$arm-unknown-linux-gnueabi-gcc -c test.c -o TEST $arm-linux-gnueabi-gcc TEST -o dynamic_test_with_new_opts -Wl,rpath=/home/user/UCLIBC/uClibc-0.9.32.1/INSTALL-DIR/usr/arm-linux-uclibc/lib -Wl,-dynamic-linker=/home/user/UCLIBC/uClibc-0.9.32.1/INSTALL-DIR/usr/arm-linux-uclibc/lib/ld-uClibc.so.0
In this case, it is getting linked with the default
libc.so.6
ofeglibc
How to link to a different libc file?
As the above link suggested, I even tried the following:
$arm-unknown-linux-gnueabi-gcc -Xlinker -rpath=/home/user/UCLIBC/uClibc-0.9.32.1/INSTALL-DIR/usr/arm-linux-uclibc/lib -Xlinker -I/home/user/UCLIBC/uClibc-0.9.32.1/INSTALL-DIR/usr/arm-linux-uclibc/lib/ld-uClibc-0.9.32.1.so test.c -o dynamic_test_with_linker_options
In this case too, it is getting linked with the default
libc.so.6
ofeglibc
Where am I going wrong? I am really stuck in this. Can someone please shed some light?