与旧版本的 libstdc++ 链接 [英] Link with an older version of libstdc++

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

问题描述

安装新的构建机器后,我发现它带有标准 C++ 库的 6.0.10

After installing a new build machine, I found out it came with 6.0.10 of the standard C++ library

-rw-r--r--  1 root root 1019216 2009-01-02 12:15 libstdc++.so.6.0.10

但是,我们的许多目标机器仍然使用旧版本的 libstdc++,例如:

Many of our target machines, however, still use an older version of libstdc++, for example:

-rwxr-xr-x 1 root root  985888 Aug 19 21:14 libstdc++.so.6.0.8

显然 ABI 在最后两个 0.0.1 中发生了变化,因为尝试运行程序会导致

Apparently the ABI changed in those last two 0.0.1's, as trying to run a program results in

/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found

我尝试显式安装旧版本的 gcc,但没有帮助.升级目标机器是我无法控制的,所以不是一个选择.让我的构建在具有较旧 libstdc++ 的机器上运行的最佳方法是什么?

I tried explicitly installing an older version of gcc but that didn't help. Upgrading the target machines is out of my control, so not an option. What's the best way to get my builds to work on machines with an older libstdc++?

我在 apt-cache 中搜索了要安装的旧 libstdc++ 版本,但显然没有旧版本 6 可用?

I searched in apt-cache for older libstdc++ versions to install, but apparently no older versions of 6 are available?

推荐答案

你不需要链接到不同的库,你需要使用旧版本的编译器.

You don't need to link to a different library, you need to use an older version of the compiler.

查看 GNU ABI 政策.libstdc++ 共享库被设计为向前兼容.IE.如果需要 6.0.8,可以使用 6.0.10 版本.在政策中,您可以从 gcc-4.2.0 开始阅读,需要 6.0.9,因此您需要 gcc-4.1.x.

Have a look at the GNU ABI policy. The libstdc++ shared library is designed to be forward compatible. I.e. version 6.0.10 can be used if you need 6.0.8. In the policy you can read that from gcc-4.2.0 on, 6.0.9 is needed, so you need a gcc-4.1.x.

简而言之,这就是为什么您的系统上只有一个 libstdc++.so.6.0.x,您只需要最新的.

In short, that's why there's only one libstdc++.so.6.0.x on your system, you only need the latest.

至于将构建系统设置为仅使用特定版本的编译器:确保不能使用标准 g++(重命名链接,删除提供它的包,将其从 PATH 中取出),然后开始挖掘.为我工作.

As for setting up your build system to use only a specific version of the compiler: make sure the standard g++ can't be used (rename the link, remove the package providing it, take it out of PATH), and start digging. Worked for me.

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

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