Linux distribution binary compatibility

2020-05-13 20:29发布

Any way to make a binary in a Linux distribution and run it on another distribution with same architecture? Or I should compile and build it on different distributions?

Is there any compatibility between Redhat, Debian based distributions for binary files? (I want to use my Ubuntu binary file on fedora!)

9条回答
乱世女痞
2楼-- · 2020-05-13 20:59

Normally it's ok to use binaries across linux distributions as long as you have the same set of libraries available. You can use 'ldd' to check which libraries are needed by a binary. libc should sure have the same version in the distributions involved.

查看更多
祖国的老花朵
3楼-- · 2020-05-13 21:01

Statically linking your binaries makes them LESS portable because some libraries won't then work correctly for that machine (differing authentication methods, etc).

If you statically link any "unusual" libraries and keep your set of supported distros to a minimum, you should be ok.

Don't statically link the C library (or the whole binary), that's a recipe for trouble :)

Look at what (e.g.) Google do with Chrome.

查看更多
我欲成王,谁敢阻挡
4楼-- · 2020-05-13 21:01

LSB is definitely worth checking out. Though in regards of working with libraries I was most satisfied by this answer here at SO https://stackoverflow.com/questions/1209674/shipping-closed-source-application-for-linux/1242738#1242738 and this detailed treatment of the rpath mechanism http://www.eyrie.org/~eagle/notes/rpath.html

查看更多
登录 后发表回答