C / C ++可以将所有动态库构建到一个bin文件中吗?

问题描述:

When I develop across different OS's I find that a program built on one Linux system can not be run on another system, due to the different libc version.

How can I build in all the shared libraries just like golang did in c/c++?

Including libc and libcxx

当我跨不同的操作系统进行开发时,我发现在一个Linux系统上构建的程序无法在另一个系统上运行, 由于libc版本不同。 p>

如何像golang在c / c ++中那样在所有共享库中进行构建? p>

包括libc和 libcxx p> div>

If you want to run on multiple Linux systems, all you really need is to build using the oldest glibc from any of them. The easiest way is to simply download a virtual machine image from an old system like CentOS 5 and build there. You don't need to worry about static linking, just building against an old version will mean you are mostly compatible with newer versions.