Static linking considered harmful

John Reiser jreiser at BitWagon.com
Wed Nov 22 15:33:37 UTC 2006


> E.g. ideally we'd drop libpthread.a, librt.a, libstdc++.a, libgfortran.a,
> libboost*.a, all GUI libs that have also *.so libs, etc.

libstdc++.a must stay in Fedora Core.  libstdc++ is not compatible AT ALL
across versions, and there are _many_.  g++ has not learned or implemented
a stable ABI (application binary interface); the "name mangling" to encode
types is not even stable yet.

In fact, the best advice is that libstdc++ MUST be linked static
for any "portable" program.  The mechnanism for doing so isn't
obvious; '-Wl,-Bstatic -lstdc++ -Wl,-Bdynamic' is not sufficient.
Instead use:
   ln -s `g++ --print-file-name=libstdc++.a` .
   g++ -m386 -L. file.cpp
   rm libstdc++.a

See
http://groups.google.com/group/comp.os.linux.development.apps/browse_thread/thread/a0859ce6cfebb9f5/ba5e8db73b87e97f?lnk=st&q=libstdc%2B%2B+group%3A*linux*+author%3APaul+author%3APluzhnikov+%22you%27d+think+that%22&rnum=1#ba5e8db73b87e97f

Even libgcc_s has a couple more years before it can be considered stable.

-- 




More information about the fedora-devel-list mailing list