Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build self-contained executable with gcc? [duplicate]

I wrote a program, that uses a shared library installed on my system. This library is seldom installed on other systems. How do I compile my program so that the library doesn't need to be installed on other systems? I have the source code for the library available. What's the best way?

The other systems of course have the same architecture and OS.

like image 301
con-f-use Avatar asked Nov 21 '22 01:11

con-f-use


1 Answers

Compile it as a static library and link that into the executable.

like image 179
Ignacio Vazquez-Abrams Avatar answered Dec 06 '22 10:12

Ignacio Vazquez-Abrams