Specifying the "-pthreads" in combination with "-shared" on should cause libpthread.so to be linked in to the shared library which is produced. Unfortunately it does not and -lpthread has to be added to the link line manually.
This is very similar to bug 8888 which was exactly the same problem except for Linux using the "-pthread" option. -- Summary: "-pthreads" option with "-shared" does not cause libpthread.so to be linked in. Product: gcc Version: 3.4.2 Status: UNCONFIRMED Severity: normal Priority: P2 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: paulg at chiark dot greenend dot org dot uk CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: sparc-sun-solaris2.8 GCC host triplet: sparc-sun-solaris2.8 GCC target triplet: sparc-sun-solaris2.8 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18788