Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create static binary which runs on every distro?

Tags:

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?

like image 598
user1873947 Avatar asked Feb 12 '13 21:02

user1873947


Video Answer


1 Answers

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.

like image 73
thiton Avatar answered Sep 23 '22 13:09

thiton