简体   繁体   中英

About the binary compatibility of Linux

如果我得到一些C ++代码,比如Ubuntu上的GCC 4.8,代码没有GUI /接口,只调用标准的Linux库,那么二进制文件可以运行在RHEL 5/6上,还有更老的GCC吗?

Normally it can't. It will complain about libc being too old, for one.

If you statically link with libstdc++ and carefully avoid newer glibc features, you may be able to get away with it. The latter is not always possible though. Static linking with libc is not officially supported and may work or not work for you.

The issue is probably more Glibc than libstdc++ (which you can indeed link statically) or GCC itself.

You could use an alternative Libc, such as MUSL libc (which is supposed to be more friendly with static linking)

Also, there might be some kernel dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM