Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any downsides to using statically linked applications on Linux?

I seen several discussions here on the subject, but wanted to ask about my particular situation:

If I have some 3rd part libraries which my application is using, and I'd like to link them together in order to save myself the hassle in LD_LIBRARY, etc., is there any downside to it on Linux, other then larger file size?

Also, is it possible to statically link only some libraries, and other (standard Linux libraries) to link dynamically?

Thanks.

like image 254
SyRenity Avatar asked Feb 14 '26 07:02

SyRenity


1 Answers

It is indeed possible to dynamically link against some libraries and statically link against others.

It sounds like what you really want to do is dynamically link against the system libraries, and statically link against the nonstandard ones that a user may not have installed (or that different users may have different installations of).

That's perfectly reasonable.

It's not generally a good idea to statically link against system libraries, especially libc.

It can often make sense to statically link against libraries that do not come with the OS and that will not be distributed with your application.

like image 74
chuck Avatar answered Feb 15 '26 23:02

chuck