简体   繁体   中英

How to compile Linux C program to run on another Linux machine?

I am using a VPS to host my website, but the gcc package is not installed. The libc.so.6 is mapped to libc-2.12.so and this is my problem, because on my home computer the library is mapped to libc-2.15.so

From time to time, I need to run some programs on VPS, so when I compile the C sources I use the -static option to include in the executable file everything is needed. The program works fine, but it bothers me that executable is about 800 Kb. If I compile without using -static option, executable is about 80 Kb, but it doesn't work on VOS.

Does anybody know any other solution to compile without using -static option, such that the executable be smaller ?

Thank you very much.

构建一个chroot,其中包含与另一台计算机上相同的库和可执行文件,然后在其中执行构建。

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