[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Shared vs Static (please read)



On Thu, 2005-12-15 at 23:48 +0000, Peter Jr. Quiring wrote:
> I'm a C++ programmer that is porting from Windows to the Linux world.  So 
> far things are great.  I've recently tried to use the -static option with 
> gcc to generate binaries that are more portable, and so far it works.  

the problem is that due to a bunch of technicalities, -static binaries
are LESS portable in linux, not more portable.

http://people.redhat.com/drepper/no_static_linking.html

However there is a middle ground; static link only the lib(s) that are a
real portability problem, eg libstdc++, but not the rest. (at which
point you need to be careful wrt the LGPL already but I don't know the
exact details of the libstdc++ license, it may well have an exception
for this).

Linking openssl static sounds like a nightmare from a security update
pov.... it's better to avoid it anyway in non-core-OS software due to
the very unstable ABI. 

btw the way to only link libstdc++ static is this:
-Wl,-static -lstdc++ -Wl,-dynamic


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]