[Bug libstdc++/52590] std::thread Segmentation fault static linking

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Mar 15 07:52:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52590

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-03-15 07:46:27 UTC ---
The weakref attributes are of course correct, the bug is that you aren't
linking the whole libpthread.a into the app.  On some Linux distributions
libpthread.a
has all the objects linked together with ld -r and therefore this will just
work there, on others you need -Wl,--whole-archive -lpthread
-Wl,--no-whole-archive.
Better yet don't link statically, there are many reasons why it is a bad idea.
http://www.akkadia.org/drepper/no_static_linking.html



More information about the Gcc-bugs mailing list