【发布时间】:2023-04-01 16:27:01
【问题描述】:
在 Linux 中,考虑有 test.so 文件。它在运行时需要其他 .so(例如 alpha.so、beta.so、charlie.so)文件。它基本上是一个共享库。当我在终端中运行以下命令时:
$ ldd test.so
显示以下输出:
alpha.1.4.so ==> usr/lib/x86-linux-gnu/alpha.1.4.so
beta.1.4.so ==> usr/lib/x86-linux-gnu/beta.1.4.so
charlie.1.4.so ==> usr/lib/x86-linux-gnu/charlie.1.4.so
我想修改用于构建 test.so 的 cmake 以指向符号链接,像这样
alpha.so ==> usr/lib/x86-linux-gnu/alpha.1.4.so
beta.so ==> usr/lib/x86-linux-gnu/beta.1.4.so
charlie.so ==> usr/lib/x86-linux-gnu/charlie.1.4.so
而不是将其链接到该库的特定版本(alpha.1.4.so、beta1.4.so、charlie.1.4.so)。
如何修改我的 CMake 配置以使 test.so 文件遵循符号链接而不是特定版本?我基本上想让它版本独立。
【问题讨论】:
-
感谢您的回答 Tysvarev。我想将 test.so 链接到 alpha.so、beta.so、charlie.so 文件。在安装的目录中包含 alpha.so -> alpha.so.1.4 (symlink) alpha.so.1.4 我想将 test.so 链接到指向 alpha.so (symlink) 而不是 alpha.so.1.4 以使其与版本无关,就像这个 test.so -> alpha.so -> alpha.so.1.4 但现在它像这个 test.so -> alpha.so.1.4
标签: linux makefile cmake symlink ldd