On Fri, Dec 16, 2005 at 09:11:22AM +0100, Arjan van de Ven wrote: > 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 -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic actually (and always make sure the command line ends in -Bdynamic state, as that's what will be used for the implicitly added libraries (-lc, -lgcc_s (sometimes), -lpthread (sometimes)). I should note that libstdc++ is not bad ABI-wise recently, GCC 3.4, 4.0 (and the upcoming 4.1) are all (backwards) binary compatible. So if you build against GCC 3.4 (e.g. FC3 or RHEL4), it will work on FC3/FC4/FC5/RHEL4/(likely RHEL5) libstdc++/C++ ABI wise as well as any other distro that ships with GCC 3.4/4.0/4.1. Of course other libraries like openssl might be a problem. Jakub -- fedora-devel-list mailing list fedora-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-devel-list