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

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

问题描述

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

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

在最后两个0.0.1的ABI改变,因为试图运行程序导致

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但这没有帮助。
升级目标计算机不受我的控制,因此不是一个选项。

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 ++共享库被设计为向前兼容。也就是说如果您需要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天全站免登陆