Skip to content
Advertisement

Using uclibc linker for glibc compiled binary?

I have a binary which I need to get working on an embedded system which uses uclibc, the binary was compiled against glibc, should this work?

I get an error saying that the binary doesn’t exist when I try to run it, so I checked what libraries were missing.

libc6: /lib/x86_64-linux-gnu/libdl.so.2
libc6: /lib/x86_64-linux-gnu/librt.so.1
libc6: /lib/x86_64-linux-gnu/libm.so.6
libc6: /lib/x86_64-linux-gnu/libc.so.6
libc6: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2
libc6: /lib/x86_64-linux-gnu/libnsl.so.1

I was able to symlink all of these but one to the version I have on my system (older versions but I would expect it to work as the binary should not need these new versions):

libc6: /lib/x86_64-linux-gnu/libdl.so.2      --------------------- ln -s /lib/libdl-0.9.33.2.so libdl.so.2
libc6: /lib/x86_64-linux-gnu/librt.so.1      --------------------- ln -s /lib/librt-0.9.33.2.so librt.so.1
libc6: /lib/x86_64-linux-gnu/libm.so.6       --------------------- ln -s /lib/libm.so.0 libm.so.6
libc6: /lib/x86_64-linux-gnu/libc.so.6       --------------------- ln -s /lib/libc.so.0 libc.so.6 
libc6: /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2 ---------------- 
libc6: /lib/x86_64-linux-gnu/libnsl.so.1     --------------------- ln -s /lib/libnsl-0.9.33.2.so libnsl.so.1

ld-linux-x86-64.so.2 does not exist (nor any library for me to point to such as ld-2.19.so, which is what it points to on my host pc) , is this a glibc specific linker? I have /lib/ld64-uClibc.so.0/ / /lib/ld64-uClibc-0.9.33.2.so but symlinking to that has no effect (Still get No such file or directory), is that even the right thing to do or do I need to get ld-linux-x86-64.so.2 built into the system somehow?

Advertisement

Answer

should this work?

No.

ld-linux-x86-64.so.2 does not exist … is this a glibc specific linker?

Yes: ld-linux is part of GLIBC. The path to it is hard-coded into the binary (see readelf -l a.out output).

do I need to get ld-linux-x86-64.so.2 built into the system somehow?

You have two choices:

  1. Rebuild your binary against uClibc, or
  2. Install complete GLIBC (it’s not just ld-linux that you need; you’ll also need libc.so.6, libdl.so.2, etc.)
Advertisement