user1873947 user1873947 - 1 year ago 72
Linux Question

How to create static binary which runs on every distro?

Some linux apps like supertuxkart or regnum online have static binaries, which after downloading just work without needing to install any shared library. On every distro. How can I make such an app?

Answer Source

Ensure that all your resources are contained in the executable and link the executable statically:

gcc -o foo main.o -static -lbaz -lbar

However, this also has drawbacks. Look up dynamic linking.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download