Static Linking on Linux

Archives Forums/Linux Discussion/Static Linking on Linux

Tachyon(Posted 2008) [#1]
I am looking into the legalities of statically linking public libraries with the Linux version of the game, and if it is legal to do, how to go about it.


Brucey(Posted 2008) [#2]
Depends on the library.

If it is LGPL, then no, unless it has an exclusion clause like wxWidgets has which allows for specifically that case of static linking.

any other licenses, like MPL, Apache, MIT, zlib etc, yes, you can statically link if you prefer.


Tachyon(Posted 2008) [#3]
Thanks Brucey! Care to give (or point to) a very basic explanation or tutorial for static linking with Linux? Specifically, I need to statically link to libcurl.so.4.


Brucey(Posted 2008) [#4]
Oh, you can't static link to a shared object.

You'd need a static (.a) version of it.... which usually means getting the source and building the static version. The same with any other libs you need.

Of course, the whole thing about shared libraries, is that they are shared, so you don't need to have every app on Linux with its own copy of a library, statically linked in.


My BaH.libcurl (and libcurlssl) modules are an example of building it from source into a static library (in this case a custom version specifically for a module).