linux - 为不同版本的 Ubuntu 管理共享库

标签 linux shared-libraries

我们构建了一个依赖于libsdl-gfx 的共享库。

在 Ubuntu 12.04 到 14.10 上,链接了 libSDL_gfx.so.13;在 Ubuntu 15.0415.10 上,libSDL_gfx 更新为 libSDL_gfx.so.15

为了让它工作,我们需要构建另一个版本的共享库,它依赖于 libSDL_gfx.so.15

那么问题是这种情况的正确方法是什么?是否可以只构建一次可在 Ubuntu 12Ubuntu 15 上使用的库?谢谢。

刘杰

最佳答案

So the question is what is the correct way for this case?

您已经在做的事情:构建您的库的两个版本。

Is it possible to just build my library once which can be used on both Ubuntu 12 and Ubuntu 15?

没有。假设 libSDL_gfx.so 开发人员有能力,他们更改库的外部版本是有原因的:ABI 更改。如果您尝试将您的库与 ABI 不兼容版本的 libSDL_gfx 一起使用,您会遇到崩溃(或更糟的情况——微妙的内存损坏)。阅读有关外部库版本控制的信息 here .

关于linux - 为不同版本的 Ubuntu 管理共享库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36312415/

相关文章:

c++ - 如何查找并替换存储在 char 数组中的字符串?

c - 如何从 FILE* 写入 fd?

c++ - 无法在 qt creator (linux) 上链接共享库

使用 GNU 工具链 (gcc/ld) 从静态库创建共享库

c++ - dlopen - undefined symbol 错误

linux - 如何列出非 native 二进制文件的库依赖项?

linux - bash中间接引用数组的访问范围

c++ - 我如何知道 USB 设备是否已在使用中?

linux - 如何让 supervisord 无法被杀死

linux - 在 linux 上为 opencart 设置虚拟主机/多个商店