我怎样才能弄清楚一个特定版本的库为什么在依赖项中?

时间:2022-12-25 22:57:32

I'm building a large C++ project using cmake on ubuntu 12.04 and then taking the resulting binary package and trying to run it on ubuntu 11.04. However the program fails saying it needs glibc version 2.14 but can only find up to version 2.13. How can I find out exactly why glibc=>2.14 is required?

我正在使用ubuntu 12.04上的cmake构建一个大型c++项目,然后获取生成的二进制包并尝试在ubuntu 11.04上运行它。但是程序失败了,说它需要glibc版本2.14,但是只能找到版本2.13。我如何才能确切地知道为什么glibc=>2.14是必需的?

2 个解决方案

#1


3  

Unlike most libraries, glibc versions its symbols. Every symbol is tagged with a value (e.g. "GLIBC_2.3.4") representing the version of the library where it's interface was last changed. This allows the library to contain more than one version of a given symbol and support binaries compiled against older versions while preserving the ability to evolve. You can see this detail with objdump -T /lib/libc.so.6.

与大多数库不同,glibc对其符号进行了版本化。每个符号都带有一个值。“GLIBC_2.3.4”)表示库的版本,它的接口最后一次被修改。这允许库包含一个给定符号的多个版本,并支持针对旧版本编译的二进制文件,同时保留演化的能力。您可以使用objdump -T /lib/libc.so.6查看这个细节。

Basically, something in your app was linked against a symbol that was changed since 11.04. Try objdump -T on your binary and see what tags it's looking for.

基本上,你的应用程序中的某些东西被链接到一个自11.04以来发生了变化的符号上。尝试objdump -T在你的二进制文件上,看看它在寻找什么标签。

But broadly, backwards compatibility doesn't work like that in Linux. If you want something to run on older software, you should build it on older software. It's possible to set up a backwards-compatible toolchain on more recent distros, but it's not the default.

但是总的来说,向后兼容在Linux中并不像这样工作。如果您想要在旧的软件上运行,您应该在旧的软件上构建它。在最近的发行版上建立一个向后兼容的工具链是可能的,但它不是默认的。

#2


0  

When you build your C++ project, it will link to the version of the glibc library on your 12.04 installation. What are the linker options in your build command?

当您构建c++项目时,它将在您的12.04安装中链接到glibc库的版本。构建命令中的链接器选项是什么?

Without knowing exactly what you are building, I'd say you might be better off building on 11.04 and then running on 12.04.

在不知道你正在构建什么东西的情况下,我认为你最好在11.04构建,然后在12.04运行。

#1


3  

Unlike most libraries, glibc versions its symbols. Every symbol is tagged with a value (e.g. "GLIBC_2.3.4") representing the version of the library where it's interface was last changed. This allows the library to contain more than one version of a given symbol and support binaries compiled against older versions while preserving the ability to evolve. You can see this detail with objdump -T /lib/libc.so.6.

与大多数库不同,glibc对其符号进行了版本化。每个符号都带有一个值。“GLIBC_2.3.4”)表示库的版本,它的接口最后一次被修改。这允许库包含一个给定符号的多个版本,并支持针对旧版本编译的二进制文件,同时保留演化的能力。您可以使用objdump -T /lib/libc.so.6查看这个细节。

Basically, something in your app was linked against a symbol that was changed since 11.04. Try objdump -T on your binary and see what tags it's looking for.

基本上,你的应用程序中的某些东西被链接到一个自11.04以来发生了变化的符号上。尝试objdump -T在你的二进制文件上,看看它在寻找什么标签。

But broadly, backwards compatibility doesn't work like that in Linux. If you want something to run on older software, you should build it on older software. It's possible to set up a backwards-compatible toolchain on more recent distros, but it's not the default.

但是总的来说,向后兼容在Linux中并不像这样工作。如果您想要在旧的软件上运行,您应该在旧的软件上构建它。在最近的发行版上建立一个向后兼容的工具链是可能的,但它不是默认的。

#2


0  

When you build your C++ project, it will link to the version of the glibc library on your 12.04 installation. What are the linker options in your build command?

当您构建c++项目时,它将在您的12.04安装中链接到glibc库的版本。构建命令中的链接器选项是什么?

Without knowing exactly what you are building, I'd say you might be better off building on 11.04 and then running on 12.04.

在不知道你正在构建什么东西的情况下,我认为你最好在11.04构建,然后在12.04运行。