3

Short version:

Installed Ubuntu Touch, and noticed that there's no /lib/ld-linux.so.3 dynamic linker (symlink or otherwise). First time I've seen this missing from a Linux installation. Is there any particular reason it isn't there?


Long version:

I just installed Ubuntu Touch (13.10, stable) on a first-gen Nexus 7, and I want to try some ARM-targeted compilation on it.

I installed the gcc-arm-linux-gnueabi package on my Ubuntu desktop (12.04, incidentally) and compiled a simple "hello world" in C, then copied it over to the Nexus, ssh'd in, and ran the executable (nexustest). The response was:

-bash: ./nexustest: No such file or directory

Ultimately I found that this was because Ubuntu was failing to even load the ld-linux.so dynamic linker. As per usual on a non-statically-linked Linux executable, ldd nexustest shows that it's looking for /lib/ld-linux.so.3, and the Ubuntu Touch installation doesn't have that.

I can "fix" this with either of the following, in which case the "hello world" runs as expected:

  • Copying or symlinking /lib/ld-linux-armhf.so.3 to /lib/ld-linux.so.3 -- suggesting that ld-linux-armhf.so.3 is the right dynamic linker

  • Compiling (linking) the executable with -static -- suggesting that arm-linux-gnueabi-gcc is using the right linker/arch

From the GCC and Linux linking perspective, everything seems to be working as expected, except that there's no /lib/ld-linux.so.3 on my Nexus 7 (which I expect should just be a symlink to ld-linux-armhf.so.3). Why is that? Is the omission a mistake, or some intentional distro-design decision that I'm just not getting?

1 Answer 1

3

The Ubuntu Touch builds use the armhf ABI, an architecture which gives significant performance improvements on newer ARM chips. The cross-compiler which targets this ABI is the gcc-arm-linux-gnueabihf (hf for "hard float") package, rather than the gcc-arm-linux-gnueabi package. This armhf cross-compiler is available in 12.04.

You should not symlink /lib/ld-linux-armhf.so.3 to /lib/ld-linux.so.3. The linkers have different names precisely because they're used for libraries that have different calling conventions. A "hello world" might work ok, but programs will start to fail in mysterious ways as soon as you use any code that needs to pass floating point numbers as arguments to a function.

1
  • Oh wow, wasn't expecting that! (I'd also tried using -mfloat-abi=hard with arm-linux-gnueabi-gcc but didn't get anything worthwhile.) Thanks for pointing me in the right direction.
    – user206468
    Oct 23, 2013 at 6:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .