0

I'm trying to build for an android device and I don't have real SDK/NDK for it. Unlike usual Android devices that have libc.so this one has symbolic link libc.so.6 --> libc-2.7.so. If I build with regular android NDK-x86 my shared lib (as reported by readelf -d) imports from libc.so which doesn't exist on the device.

What's that numbering is about, how does gcc/ld knows to link to libc.so.6 if I simply say -lc?

To be more specific, that device is an android google tv box (Logitech revue) and it seems that it's a bit different from regular android, my guess it doesn't use retarded bionic and uses normal libc, regular pthread and it's seems to be closer to regular linux.

So, can I use regular android-x86 toolchain to generate code for the google tv device that has different libc? How does it know to link to libc.so.6 instead (so I can tell it what libs to link to?). I tried to simply hardcode these libs at link time, but then I get some problems at runtime (missing symbols, because it used incompatible headers and libs).

Pavel P
  • 15,789
  • 11
  • 79
  • 128

1 Answers1

0

What's that numbering is about

You can read about external library versioning here.

how does gcc/ld knows to link to libc.so.6 if I simply say -lc?

On Linux with glibc, the libc.so is actually a linker script, containing something like:

GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a 
         AS_NEEDED ( /lib/ld-linux-x86-64.so.2 ) )

So, can I use regular android-x86 toolchain to generate code for the google tv device that has different libc?

No, you need a cross-compiler for this. A cross-compiler is one that runs on one OS (regular Linux here), but creates an executable that will run somewhere else (on Google V).

Your best bet is to download SDK for GoogleTV, which will include such a cross-compiler, as well as required libraries.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362