简体   繁体   English

如何链接到旧版本的数学库?

[英]How to link to an older version math library?

I'm about to release a library (.so) to my client.我即将向我的客户发布一个库 (.so)。 However, my client's platform is a very old debian(9.1 released on 2017).但是,我客户的平台是一个非常老的 debian(2017 年发布的 9.1)。 My libray only works with >= glibc-2.27.我的库只适用于 >= 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!谢谢!

My libray only works with >= glibc-2.27.我的库只适用于 >= 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?是因为您实际上需要添加到 GLIBC-2.27 的功能,还是因为您的系统恰好安装了该版本而您不知道如何为旧系统构建?

From the comments, it appears that you don't actually need GLIBC-2.27.从评论看来,您实际上并不需要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.在这种情况下,最简单的解决方案是安装一个装有 Debian 9.1 的 VM,然后在该 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 .如果您不需要 VM,此处列出其他解决方案。

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 .要了解为什么会这样,请阅读此答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM