I'm looking for advice on how to set up a build machine for a Linux application that needs to be compiled for both 32 and 64-bit architectures.
我正在寻找有关如何为需要针对32位和64位架构进行编译的Linux应用程序设置构建机器的建议。
As far as I know, I'll need a 64 bit OS, which can build both 32 and 64. Adding the -m32 flag will produce the right output for 32, no challenge here.
据我所知,我需要一个64位操作系统,它可以构建32和64.添加-m32标志将产生32的正确输出,这里没有挑战。
The main issue is with libraries. I'm not sure on how to proceed... How can I make sure the linker is using the 32 bit versions of simple libraries, such as ldl, lz, lrt? I understand I must install the 32 bit versions of all of them, and then configure the linker path.
主要问题是图书馆。我不确定如何继续...我怎样才能确保链接器使用32位版本的简单库,例如ldl,lz,lrt?我知道我必须安装所有这些版本的32位版本,然后配置链接器路径。
Another issue is the version of the compiler, linker, libc and so on. Should I use the oldest versions, in order to ensure all clients will run without issues? I mean, if I build the app in the latest Debian, in older Debians it won't work properly, correct?
另一个问题是编译器,链接器,libc等版本。我应该使用最旧的版本,以确保所有客户端都能正常运行吗?我的意思是,如果我在最新的Debian中构建应用程序,在较旧的Debian中,它将无法正常工作,对吗?
Thanks for the help!
谢谢您的帮助!
1 个解决方案
#1
2
Most versions of Linux that have a 64-bit build also make a 32-bit build and nearly all libraries are available for both, so all you need to do is install the relevant 32-bit libraries in parallel with the 64-bit ones. The configuration of paths is no different than for a pure 64- or 32-bit build in most cases. There may be a few libraries that have problems, but you really need to go looking for those. All of the mainstream packets will have libraries that work with 32- and 64-bit library versions both installed at the same time.
大多数具有64位版本的Linux版本也构成32位版本,几乎所有库都可用于这两种版本,因此您需要做的就是将相关的32位库与64位库并行安装。在大多数情况下,路径的配置与纯64或32位构建没有什么不同。可能有一些库有问题,但你真的需要去寻找那些。所有主流数据包都将具有同时安装的32位和64位库版本的库。
When it comes to "which libc", etc, that's a more difficult question, since it will really depend on what your customers have on their machines - and it's unlikely that you can dictate that they should be using one of Debian, RedHat or SuSE - they will feel very strongly about using whatever they are using. Using a "too old" library is just as bad as using a "too new" library. The usual solution to this is to build multiple versions, one for a selected RedHat release (and that should work with a few steps newer/older version, typically, as well as the Fedora versions in the same range), a Debian version, and a SuSE version, maybe one or two more distros.
当谈到“哪个libc”等时,这是一个更难的问题,因为它真的取决于你的客户在他们的机器上有什么 - 而且你不太可能要求他们应该使用Debian,RedHat或SuSE之一 - 他们会非常强烈地使用他们正在使用的任何东西。使用“太旧”库与使用“太新”库一样糟糕。通常的解决方案是构建多个版本,一个用于选定的RedHat版本(并且应该使用几个步骤更新/更旧版本,通常,以及相同范围内的Fedora版本),Debian版本,以及一个SuSE版本,也许还有一两个发行版。
And yes, at that point, you probably want to set up a build machine with a few virtual machines on it, so that you don't have to have 3, 5, or 12 physical machines.
是的,此时,您可能想要在其上设置一个包含几个虚拟机的构建计算机,这样您就不必拥有3个,5个或12个物理计算机。
#1
2
Most versions of Linux that have a 64-bit build also make a 32-bit build and nearly all libraries are available for both, so all you need to do is install the relevant 32-bit libraries in parallel with the 64-bit ones. The configuration of paths is no different than for a pure 64- or 32-bit build in most cases. There may be a few libraries that have problems, but you really need to go looking for those. All of the mainstream packets will have libraries that work with 32- and 64-bit library versions both installed at the same time.
大多数具有64位版本的Linux版本也构成32位版本,几乎所有库都可用于这两种版本,因此您需要做的就是将相关的32位库与64位库并行安装。在大多数情况下,路径的配置与纯64或32位构建没有什么不同。可能有一些库有问题,但你真的需要去寻找那些。所有主流数据包都将具有同时安装的32位和64位库版本的库。
When it comes to "which libc", etc, that's a more difficult question, since it will really depend on what your customers have on their machines - and it's unlikely that you can dictate that they should be using one of Debian, RedHat or SuSE - they will feel very strongly about using whatever they are using. Using a "too old" library is just as bad as using a "too new" library. The usual solution to this is to build multiple versions, one for a selected RedHat release (and that should work with a few steps newer/older version, typically, as well as the Fedora versions in the same range), a Debian version, and a SuSE version, maybe one or two more distros.
当谈到“哪个libc”等时,这是一个更难的问题,因为它真的取决于你的客户在他们的机器上有什么 - 而且你不太可能要求他们应该使用Debian,RedHat或SuSE之一 - 他们会非常强烈地使用他们正在使用的任何东西。使用“太旧”库与使用“太新”库一样糟糕。通常的解决方案是构建多个版本,一个用于选定的RedHat版本(并且应该使用几个步骤更新/更旧版本,通常,以及相同范围内的Fedora版本),Debian版本,以及一个SuSE版本,也许还有一两个发行版。
And yes, at that point, you probably want to set up a build machine with a few virtual machines on it, so that you don't have to have 3, 5, or 12 physical machines.
是的,此时,您可能想要在其上设置一个包含几个虚拟机的构建计算机,这样您就不必拥有3个,5个或12个物理计算机。