Now, I want to use the SDK (that uses glibc2.14) in a shared object binary (.so).
You can't.
As this answer explains, ld-linux
and libc.so
must come from the same build of GLIBC.
Since the ld-linux
is determined by the main executable (is hard-coded into it at static link time), it will not match your custom libc.so.6
no matter what you do to compile your .so
.
In addition, specifying --dynamic-linker
while building .so
is pointless: it is the job of ld-linux
to load the .so
, so by definition ld-linux
must already be loaded before any .so
is loaded into the process.
P.S. If it were possible to make your .so
use a different libc.so.6
, the result would be an (almost) immediate crash, as libc.so.6
is not designed to work when multiple copies are loaded into the same process.
Update:
upgrade my OS which I don't think is possible because I am developing the software for a client and getting them to upgrade is not going to be easy. Second would be to ask the SDK supplier to recompile with glibc2.12.
GLIBC-2.14 was released 9 years ago. It's not unreasonable for your supplier to "only" support 2.14 (and later), and it is somewhat unreasonable for your client to run such an old OS.
I think you have 3rd possible option: have the client install newer GLIBC in parallel, and build their main executable with --rpath
and --dynamic-linker
flags (as you have done). Their binary will then have no problem loading your SDK.