构建不需要最新 glibc 的软件的最佳方法是什么?

发布于 2024-08-31 06:45:00 字数 431 浏览 3 评论 0原文

我正在尝试构建一个可以在多个 Linux 发行版上运行的二进制包。它目前在 Ubuntu 10.04 上构建,但在 Ubuntu 8.04 上失败并出现以下错误:

./test: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./test)
./test: /usr/lib/libstdc.so.6: version `GLIBC_2.11' not found (required by ./test)

解决此问题的首选方法是什么?有没有办法在新机器上安装旧的 glibc 并针对它进行构建,或者我是否必须在旧的发行版上构建?如果我针对旧的 glibc 进行构建,它可以在新的 glibc 上运行吗?

或者,是否可以安装一些方便的编译器标志或软件包来解决问题?

I'm attempting to build a binary package that can be run on multiple Linux distributions. It's currently built on Ubuntu 10.04, but it fails on Ubuntu 8.04 with the following error:

./test: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./test)
./test: /usr/lib/libstdc.so.6: version `GLIBC_2.11' not found (required by ./test)

What's the preferred way to solve this problem? Is there a way to install an old glibc on a new box and build against it, or do I have to build on an old distribution? And if I build against an old glibc, will it work on a new glibc?

Or, alternatively, are there just some handy compiler flags or packages I could install to solve the problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苄①跕圉湢 2024-09-07 06:45:00

我发现的最佳解决方案是安装运行 Debian 稳定版的虚拟机,并在此基础上进行构建。 Debian stable 已经足够老了,用它构建的任何软件包都可以在任何其他基于 Debian 的发行版(例如 Ubuntu)上运行。您可能需要解决一些非关键错误,这些错误已在各种软件的更高版本中修复,但未向后移植到 Debian 稳定版。

The best solution I've found is to install a virtual machine running Debian stable, and build on that. Debian stable is old enough that any packages built with it will run on any other Debian-based distribution like Ubuntu. You may have to work around non-critical bugs that have been fixed in later versions of various software but not backported to Debian stable.

黎歌 2024-09-07 06:45:00

如果您确实想确保它在每个最近的发行版上运行,您还可以考虑静态链接您选择的 libC。但是,如果您使用仅由较新的内核提供的功能(例如较新的系统调用),您可能仍然会遇到问题。

If you really want to make sure it runs on every recent distribution, you might also consider statically linking against a libC you select. However you may then still run into problems if you use features that are only provided by newer kernels (newer system calls e.g.).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文