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-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 binds to the default libc.so.6

    eglibc

  • 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-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 it is also associated with the default libc.so.6

    eglibc

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

+3


source to share


1 answer


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



+2


source







All Articles