GLIBCXX版本 [英] GLIBCXX versions

查看:257
本文介绍了GLIBCXX版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在计算机上编译一个C ++程序,然后在另一个(使用较旧的软件)上运行它,则会得到:/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found.

If I compile a C++ program on my machine, and run it on another one (with older software) I get: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found.

实际上在我的系统上glibc是较新的(我得到gcc-libs 4.5.1:libstdc ++.so.6.0.14),并且strings /usr/lib/libstdc++.so.6 | grep GLIBCXXGLIBCXX_3.4打印到GLIBCXX_3.4.14.相反,在另一个系统上,它最多只能打印GLIBCXX_3.4.8(我得到的是libstdc ++.so.6.0.8).

In fact on my system glibc is newer (I got gcc-libs 4.5.1: libstdc++.so.6.0.14) and strings /usr/lib/libstdc++.so.6 | grep GLIBCXX prints from GLIBCXX_3.4 to GLIBCXX_3.4.14. On the other system, instead, it only prints up to GLIBCXX_3.4.8 (I got libstdc++.so.6.0.8).

所以我有几个问题:

  1. 为什么我的链接器将C ++二进制文件链接到libstdc ++版本GLIBCXX_3.4.9而不是GLIBCXX_3.4.14?

如果我针对libstdc ++版本GLIBCXX_3.4编译了二进制文件,我猜它几乎可以在任何地方运行.这是否意味着任何问题? (例如:是否会使用较旧的算法,从而使用更差的算法?)

If I complied my binary against libstdc++ version GLIBCXX_3.4 I guess it would run almost on everywhere. Would that imply any sort of issues? (eg: would it use older -and thus worse- algorithm implementations?)

如果相反,我静态将我的程序链接到我的libstdc ++,我猜它会在任何地方运行;当然,二进制文件会更大(〜1MB),还有其他优点/缺点吗?

If instead I statically link my program against my libstdc++ I guess it will run everywhere; the binary will be a lot bigger (~1MB) of course, any other pros/cons?

我可以强制链接器将二进制文件链接到给定版本的libstdc ++吗?

Can I force the linker to link my binary against a given version of libstdc++?

推荐答案

使用readelf -aobjdump -x来检查ELF文件,而不是strings.

Use readelf -a and objdump -x to inspect ELF files in preference to strings.

实际上,并非所有的GLIBCXX_ *版本都适用于整个库,而是适用于每个符号(符号版本控制,请参见 DSO方法).因此,您可以在同一库文件中使用例如std::char_traits<wchar_t>::eq@@GLIBCXX_3.4.5std::ios_base::Init::~Init()@@GLIBCXX_3.4.

Actually, all the GLIBCXX_* versions don't apply to the entire library, but to each symbol (symbol versioning, see DSO-howto). So you can have e.g: std::char_traits<wchar_t>::eq@@GLIBCXX_3.4.5 and std::ios_base::Init::~Init()@@GLIBCXX_3.4 on the same library file.

您的程序需要GLIBCXX_3.4.9的事实可能意味着它已与已引入的符号链接,或已在GLIBCXX_3.4.9上更改了语义.

The fact that your program needs GLIBCXX_3.4.9 probably means that it has been linked against a symbol that has been introduced/has changed semantics on GLIBCXX_3.4.9.

这篇关于GLIBCXX版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆