I have a linux shared library (.so) compiled with a specific version of libc (GLIBC2.4) and I need to use it on a system with different version of libc. I do not have sources for the library in question so I cannot recompile for the new system. Is it somehow possible to change the dependencies in that library to a different libc?
Asked
Active
Viewed 5,001 times
3 Answers
3
If you need the .so on a system with an older glibc, you would need the source code and recompile/relink it with the older glibc. The alternative is to install the required glibc on the old system in a non-default location and adjust the LD_LIBRARY_PATH for the executable that needs this .so
If there's a newer glibc rather, it should normally not be a problem as glibc tend to be backwards compatible.

nos
- 223,662
- 58
- 417
- 506
3
Unless your library really uses interfaces that changed (unlikely), you can just hexedit the references to versions in the resulting .so
file. They're all text anyway.

R.. GitHub STOP HELPING ICE
- 208,859
- 35
- 376
- 711
-
Very hackish, as is the question. I didn't know that the references were all text. – Stephen Eilert Jan 12 '12 at 19:06
-
The GLIBC_... version strings are not all text, if you change them to a lower version in the binary, the symbol still wouldn't work. – pts Oct 12 '13 at 10:14
-
They are text. They're in the `.dynstr` string table just like the strings for symbol names to be resolved. – R.. GitHub STOP HELPING ICE Oct 12 '13 at 12:31
1
Best you can do is compile the old glibc version for your system and then build your application with that glibc and your shared library. Ugly though ...

user231967
- 1,935
- 11
- 9