prgbenz
prgbenz

Reputation: 1189

How to link to an older version math library?

I'm about to release a library (.so) to my client. However, my client's platform is a very old debian(9.1 released on 2017). My libray only works with >= glibc-2.27.
I managed to run program by the following tricks

// copy libm-2.27.so from my computer to the old debian
ln -sf ./libm-2.27.so libm.so.6
gcc ./test.c -o ./test -lmylib -L ./ -lm
LD_LIBRARY_PATH=`pwd` ./test

But my client don't accept this solution.
Is it possible to link to an older version of math library ?
For instance, the client gives me the math library and I link my library against it in my computer.

thanks!

Upvotes: 1

Views: 678

Answers (1)

Employed Russian
Employed Russian

Reputation: 213456

My libray only works with >= glibc-2.27.

Is it because you actually require functionality that was added to GLIBC-2.27, or because you system just happens to have that version installed and you don't know how to build for an older system?

From the comments, it appears that you don't actually need GLIBC-2.27.

In that case, the simplest solution is to install a VM with Debian 9.1 in it, and build you library inside that VM.

This has an added advantage that you can test your library before you ship it to your client, in the environment that matches that of the client.

If you do not want a VM, other solutions are listed here.

I managed to run program by the following tricks ... But my client don't accept this solution.

Your client is smart to reject that solution: it can not generally work, and running in such environment would expose your client to a multitude of potential undefined behaviors and crashes. To understand why this is so, read this answer.

Upvotes: 1

Related Questions