0

I'm thinking to replace the glibc library (libc.so) with the uClibc library directly in my filesystem. Will it work? Or do I need to recompile all the binaries?

robertjlooby
  • 7,160
  • 2
  • 33
  • 45
ntshetty
  • 1,293
  • 9
  • 20

3 Answers3

1

Extremely bad idea. 3rd sentence on the 'About' page of uclibc:

Porting applications from glibc to uClibc typically involves just recompiling the source code

planetmaker
  • 5,884
  • 3
  • 28
  • 37
1

As all other answers are already saying: this will not work.

uClibc and glibc don't even have the same dynamic library loader (ld-linux.so). Shared executables specify which dynamic library loader and which shared libraries they need. You can get this information with readelf -l /path/to/executable (for the dynamic library loader) and readelf -d for the shared libraries.

A program linked against glibc will give something like this:

  INTERP         0x000154 0x00008154 0x00008154 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.3]

 0x00000001 (NEEDED)                     Shared library: [libc.so.6]

A program linked against uClibc will give something like this:

  INTERP         0x000114 0x00008114 0x00008114 0x00014 0x00014 R   0x1
      [Requesting program interpreter: /lib/ld-uClibc.so.0]

 0x00000001 (NEEDED)                     Shared library: [libc.so.1]
Arnout
  • 2,927
  • 16
  • 24
0

No, this will not work, no matter how you dice it.

All of the the symbol ordinals of important relocations from the procedure linkage table and global offset table will no longer be correct. Any attempts to resolve the interned symbol hash sections would panic and you'd be left with a broken slough of bytes. Even if you were to work around this stunning mess, you'd have a host of either half-copied or overflowed pages containing instructions from multiple dynamic libraries whose size is no longer correctly resolved.

On the plus side, statically linked binaries will be unaffected by this change.

zetavolt
  • 2,989
  • 1
  • 23
  • 33