Compilation using non-primary libc (e.g. eglibc, uClibc)

I am working in an embedded environment. I have a cross-compiler for the ARM architecture with eglibc

as the primary library (i.e. the default libc

that comes with the toolchain). Now I want some of the apps to link to uClibc

. So I compiled uClibc

with this toolchain. Now, trying to compile and link the application with uClibc

, an error occurs. It has to do with the default library in the toolchain. I think there could be two different libcs ​​on the same computer (e.g. libc, uClibc).

I searched the net and came up with the following

  • Multiple glibc libraries on the same host

    As I said, 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- -Wl,-dynamic-linker=/home/user/UCLIBC/uClibc- 

    In this case, it binds to the default


  • How do I link to another libc file?

    As stated above, I even tried the following:

    $arm-unknown-linux-gnueabi-gcc -Xlinker -rpath=/home/user/UCLIBC/uClibc- -Xlinker -I/home/user/UCLIBC/uClibc- test.c -o  dynamic_test_with_linker_options 

    In this case it is also associated with the default


Where am I going wrong? I am really stuck with this. Can someone shed some light?


source to share

1 answer

I need to rebuild the compiler to do this. The compiler must be configured differently to use uClibc.



All Articles