Subject: toolchain/20095: cc -shared -pthread doesn't link with libpthread
To: None <>
From: Matthias Scheler <>
List: netbsd-bugs
Date: 01/28/2003 18:37:01
>Number:         20095
>Category:       toolchain
>Synopsis:       cc -shared -pthread doesn't link with libpthread
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 28 09:38:00 PST 2003
>Release:        NetBSD 1.6M 2003-01-27 sources
Matthias Scheler                        
System: NetBSD 1.6M NetBSD 1.6M (LYSSA) #1: Mon Jan 27 22:13:56 CET 2003 i386
Architecture: i386
Machine: i386

The "configure" script of the "glib2" distribution recognized the new
"-pthread" switch of NetBSD's "cc" compiler frontend and uses it:

cc -shared -nodefaultlibs  .libs/gthread-impl.o  -Wl,--rpath -Wl,/src/NetBSD-current/pkgsrc/devel/glib2/work/glib-2.2.0/glib/.libs -Wl,--rpath -Wl,/usr/pkg/lib  -L/src/NetBSD-current/pkgsrc/devel/glib2/work/.buildlink/lib ../glib/.libs/ /usr/lib/  -Wl,-R/usr/pkg/lib -pthread -Wl,-soname -Wl, -o .libs/

Unfortunately "cc" doesn't link the created shared object with "libpthread":

tron@lyssa:/usr/pkgsrc/devel/glib2>ldd work/glib-2.2.0/gthread/.libs/
         -lm.0 => /usr/lib/
         -lm.0 => /usr/lib/
         -liconv.3 => /usr/pkg/lib/
         -lintl.0 => /usr/lib/

This causes lots of build failures in program which are linked with
"libgthread" later e.g. while building the "gtk2" package. Building
these packages worked fine before "cc" had the "-pthread" switch.

pkg_delete -r glib2
cd /usr/pkgsrc/x11/gtk2

None provided.