开发者

Distributing a statically linked ELF 32bit Binary - Will it run on all platforms?

开发者 https://www.devze.com 2023-01-13 23:35 出处:网络
My team is ready开发者_开发问答 to release the first version of our Linux program and would like to do so in the easiest possible manner (for users).

My team is ready开发者_开发问答 to release the first version of our Linux program and would like to do so in the easiest possible manner (for users).

The program needs no external files, no install, and is statically linked.

ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, for GNU/Linux 2.6.15, not stripped

My question is whether such a binary will run on most Linux platforms (Ubuntu, Redhat, OpenSuse, etc)?

I'm also a bit concerned about the part where it says 'for GNU/Linux 2.6.15', does this mean that they need kernel 2.6.15 or higher?


Full statically linked programs are not recommended anymore.

The portability layer moved from kernel calls into the basic libraries (remember the pthread desaster and the problems with LinuxThreads <-> NPTL threads?).

Follow the LSB 4.0 standard. Trust in the existence of the libraries mentioned there (not so many unfortunately) and bundle all the other shared libraries with your application. There is a linker flag - i think it was -L - where you can set a ldd path which has precedence over all other settings during shared library loading so your libs are always loaded first.

Make sure that all libraries only call LSB approved API functions (or have a look on the LSB website and see how serious a non supported LSB API call is - sometimes you simply can't avoid it and they have a list of Distributions that support this call).

This is the recommended way to deliver binary executables. And it still sucks a lot on Linux compared to Windows/MacOSX.

0

精彩评论

暂无评论...
验证码 换一张
取 消