Subject: pkg/23841: glib2's libgthread needs PTHREAD_LDFLAGS on FreeBSD and propably other OS (if not, problem with gtk2+ occur)
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <dotz@irc.pl>
List: netbsd-bugs
Date: 12/22/2003 16:12:35
>Number:         23841
>Category:       pkg
>Synopsis:       glib2's libgthread needs PTHREAD_LDFLAGS on FreeBSD and propably other OS (if not, problem with gtk2+ occur)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 22 16:13:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Michal Pasternak
>Release:        N/A
>Organization:
Good people with bad reputation
>Environment:
FreeBSD mainframe.w.lub.pl 4.9-RELEASE FreeBSD 4.9-RELEASE #0: Mon Oct 27 17:51:09 GMT 2003     root@freebsd-stable.sentex.ca:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
I mark this as serious, because gtk2+ is important package.

Without the patch, compilation of gtk2+ on FreeBSD fails:
IXBUF_LIBDIR=\"/usr/pkg/lib/gtk-2.0/2.2.0/loaders\"" "-DBUILT_MODULES_DIR=\"./.libs\"" -I/usr/pkg/include/freetype2  -I/usr/pkg/include -I/usr/X11R6/include  -O2 -I/usr/pkg/include -I/usr/X11R6/include -Wall -c gdk-pixbuf-csource.c
/bin/sh ../libtool --mode=link cc  -O2 -I/usr/pkg/include -I/usr/X11R6/include -Wall -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -liconv -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib -o gdk-pixbuf-csource  gdk-pixbuf-csource.o -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -liconv -L/usr/X11R6/lib -Wl,-R/usr/X11R6/lib libgdk_pixbuf-2.0.la -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lintl -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -liconv 
cc -O2 -I/usr/pkgsrc/x11/gtk2/work/.buildlink/include -I/usr/pkgsrc/x11/gtk2/work/.buildlink-x11/include -Wall -Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib -o .libs/gdk-pixbuf-csource gdk-pixbuf-csource.o -Wl,-R/usr/pkg/lib -Wl,-R/usr/X11R6/lib -Wl,-R/usr/pkg/lib -Wl,-R/usr/pkg/lib  -L/usr/pkgsrc/x11/gtk2/work/.buildlink/lib -L/usr/pkgsrc/x11/gtk2/work/.buildlink-x11/lib ./.libs/libgdk_pixbuf-2.0.so -L/usr/pkg/lib /usr/pkg/lib/libgmodule-2.0.so /usr/pkg/lib/libgobject-2.0.so /usr/pkg/lib/libgthread-2.0.so /usr/pkg/lib/libglib-2.0.so -lm /usr/pkg/lib/libintl.so -liconv /usr/pkg/lib/libiconv.so -Wl,--rpath -Wl,/usr/pkg/lib
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libgthread-2.0.so: undefined reference to `pthread_cond_signal'
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libgthread-2.0.so: undefined reference to `pthread_attr_destroy'
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libgthread-2.0.so: undefined reference to `pthread_create'
/usr/pkgsrc/x11/gtk2/work/.buildlink/lib/libgthread-2.0.so: undefined reference to `pthread_getspecific'
[...]
gmake[3]: *** [gdk-pixbuf-csource] Błąd 1
gmake[3]: Leaving directory `/usr/pkgsrc/x11/gtk2/work/gtk+-2.2.4/gdk-pixbuf'
gmake[2]: *** [all-recursive] Błąd 1
gmake[2]: Leaving directory `/usr/pkgsrc/x11/gtk2/work/gtk+-2.2.4/gdk-pixbuf'
gmake[1]: *** [all-recursive] Błąd 1
gmake[1]: Leaving directory `/usr/pkgsrc/x11/gtk2/work/gtk+-2.2.4'
gmake: *** [all-recursive-am] Błąd 2
*** Error code 2

Stop.
bmake: stopped in /usr/pkgsrc/x11/gtk2

Other programs, linking libghtread-2 can be affected too.
>How-To-Repeat:
Obvious.
>Fix:
Use this file as patches/patch-af:

**** WARNING WARNING WARNING WARNING WARNING WARNING WARNING ****

   This was *NOT* tested on NetBSD-*, so until someone confirms
   it is working and doesn't break anything, don't ever think about 
   commiting this. Anyway, AFAIK NetBSD-current lbightread-2 links
   libpthread.so anyway, so this should not break anything there.

**** WARNING WARNING WARNING WARNING WARNING WARNING WARNING ****

   For FreeBSD this patch helps a lot, not only I can build gtk2+,
   gtk-demo works very good, apps run, everythin's fine, everyone's 
   happy and such... 

--- gthread/Makefile.in~        Mon Dec 22 14:37:42 2003
+++ gthread/Makefile.in Mon Dec 22 14:43:20 2003
@@ -180,7 +180,7 @@
 libgthread_2_0_la_SOURCES = gthread-impl.c
 libgthread_2_0_la_LDFLAGS = \
        -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-       -export-dynamic $(no_undefined) $(export_symbols)
+       -export-dynamic $(no_undefined) $(export_symbols) ${PTHREAD_LDFLAGS}
 
 
 libgthread_2_0_la_LIBADD = @G_THREAD_WIN32_RESOURCE@ @G_THREAD_LIBS_EXTRA@ @G_T
HREAD_LIBS_FOR_GTHREAD@ $(libglib)

>Release-Note:
>Audit-Trail:
>Unformatted: