我应该链接哪个 Linux 发行版以获得最佳二进制兼容性?

发布于 2024-09-15 12:13:29 字数 168 浏览 2 评论 0原文

我想知道在链接应该在尽可能多的发行版上针对共享库运行的二进制文件时,哪个 Linux 发行版是最好的(即引入最少的依赖性)。

我已经在 Ubuntu 上完成了,但是依赖项列表非常糟糕。 SDL 推出了 PulseAudio 等。我的下一个猜测是使用 Debian lenny - 您认为最好的发行版是什么?

I'm wondering which Linux distribution would be best (i.e. introduces the least dependencies) when linking a binary that should work on as many distributions as possible against shared libraries.

I've done it on Ubuntu, but the list of dependencies is horrible. SDL introduces PulseAudio and whatnot. My next guess would be to use Debian lenny - what's the best distribution for that in your opinion?

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

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

发布评论

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

评论(4

一城柳絮吹成雪 2024-09-22 12:13:29

如果您不想发布源代码并使用安装脚本在目标系统上编译它,则提供静态链接的所有内容或发送您自己的 so 文件并使用 LD_LIBRARY_PATHLD_PRELOAD 脚本中用于启动可执行文件的环境变量。 (有关如何完成的示例可以在 mozilla firefox 包装中看到)

还存在法律问题:切勿使用 GPL 代码。并且切勿静态链接 LGPL 代码(以及其他问题)。

任何其他解决方案都会给好运或坏运留下太多空间,只会带来挫败感。

If you do not want to release your source and compile it on the target systems using an installation script, then provide everything statically linked or ship your own so files and use LD_LIBRARY_PATH and LD_PRELOAD environment variables in the script used to start your executable. (An example on how it is done can be seen in the mozilla firefox packaging)

Also legal issues apply: NEVER use GPL code. And do never link statically against LGPL code (among other issues).

Any other solution leaves too much room for good or bad luck and will generate nothing but frustration.

懒的傷心 2024-09-22 12:13:29

如果我没记错的话,在一个将pulseaudio作为SDL依赖项的发行版上链接到SDL并不意味着您的程序必须始终在每个发行版上链接到pulseaudio。您实际上不必在编译行上放置 -lpulseaudio ,对吗?我的 Ubuntu 盒子上的 sdl-config --libs 没有列出它。

If I recall correctly, linking against SDL on one distro that has pulseaudio as an SDL dependency does not mean your program must always be linked against pulseaudio on every distro. You don't actually have to put an -lpulseaudio on your compile line, do you? sdl-config --libs on my Ubuntu box doesn't list it.

玉环 2024-09-22 12:13:29

为 Linux 制作软件的正确方法是将每个版本的源代码 tarball 放在网站上的稳定位置,然后让发行版处理其他所有事情。不要尝试自己生成二进制文件。你会把自己从无尽的悲伤中拯救出来。

The correct way to produce software for Linux is to put one tarball of source code per release in a stable location on your website, and let the distributions deal with everything else. Don't try to produce binaries yourself. You will save yourself from an unending supply of grief.

变身佩奇 2024-09-22 12:13:29

如果您查看 QT 文档,http://doc.trolltech.com/4.6/deployment -x11.html 部分“创建应用程序包”,他们建议创建一个类似于 Mac 捆绑包的包,并使用 shell 脚本来启动它。

你也可以做同样的事情;您将必须创建所需的库并将它们包含在您的包中,不幸的是这会使其变得更大。至少这应该鼓励您只链接到您需要的库:)

If you look at QT documentation, http://doc.trolltech.com/4.6/deployment-x11.html section "Creating the Application Package" they suggest to create a package like a Mac bundle, with a shell script to start it.

You can do the same thing; you will have to create the libraries you need and include them in your package which will make it bigger unfortunately. At least this should encourage you to only link to the libs you need :)

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