Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Jan 2007 16:50:31 +0200
From:      Andriy Gapon <avg@icyb.net.ua>
To:        freebsd-gnome@freebsd.org, jylefort@freebsd.org
Subject:   problem with devel/glib20+COLLATION_FIX=yes+devel/icu+THREADS=yes
Message-ID:  <45B8C3B7.5000606@icyb.net.ua>

next in thread | raw e-mail | index | archive | help

The problem with combination of port devel/glib20 config-ed with
COLLATION_FIX=yes and port devel/icu config-ed with THREADS=yes is that
glib2 pkg-config files are not updated with new dependencies coming from
icu. When icu is built with threads support then icu shared libraries
become dependent on system thread library (libthr/libpthread) and thus
glib20 libraries also become dependent on system thread library (when
COLLATION_FIX=yes). But this dependency is not reflected in pkg-config
--libs.

This leads to potential problems with programs that are linked with
shared glib2 libraries and not explicitly linked with -pthread  where
libc is loaded by run-time linker before libpthread and then program
fails with a message like the following:

Fatal error 'Recurse on a private mutex.' at line 986 in file
/usr/src/lib/libpthread/thread/thr_mutex.c (errno = 0)

I do observe this problem in practice. The only remedy is to force
loading of libpthread before libc via LD_PRELOAD.

Some data points just in case:
$ ldd /usr/local/bin/xscreensaver-hacks/bouncingcow

              /usr/local/bin/xscreensaver-hacks/bouncingcow:

                                    libXpm.so.4 =>
/usr/X11R6/lib/libXpm.so.4 (0x48084000)

libgdk_pixbuf_xlib-2.0.so.0 =>
/usr/local/lib/libgdk_pixbuf_xlib-2.0.so.0 (0x48094000)

libgdk_pixbuf-2.0.so.0 => /usr/local/lib/libgdk_pixbuf-2.0.so.0
(0x480a3000)
                      libm.so.4 => /lib/libm.so.4 (0x480b9000)

                                    libgobject-2.0.so.0 =>
/usr/local/lib/libgobject-2.0.so.0 (0x480d0000)

libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x48109000)

              libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0
(0x4810d000)
                                  libiconv.so.3 =>
/usr/local/lib/libiconv.so.3 (0x481a2000)

libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0x48290000)

              libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0x4832f000)

                            libXxf86vm.so.1 =>
/usr/X11R6/lib/libXxf86vm.so.1 (0x483a6000)

libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0x483ab000)

              libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0x483b3000)

                            libXt.so.6 => /usr/X11R6/lib/libXt.so.6
(0x483ca000)
                                              libX11.so.6 =>
/usr/X11R6/lib/libX11.so.6 (0x4841c000)

libXmu.so.6 => /usr/X11R6/lib/libXmu.so.6 (0x484f0000)

              libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x48505000)

                            libc.so.6 => /lib/libc.so.6 (0x48513000)

                                          libintl.so.6 =>
/usr/local/lib/libintl.so.6 (0x485fc000)

libicui18n.so.36 => /usr/local/lib/libicui18n.so.36 (0x48605000)

              libGLcore.so.1 => /usr/X11R6/lib/libGLcore.so.1
(0x4873d000)
                                      libnvidia-tls.so.1 =>
/usr/X11R6/lib/libnvidia-tls.so.1 (0x49060000)

libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x49062000)

              libicuuc.so.36 => /usr/local/lib/libicuuc.so.36
(0x49138000)
                                      libicudata.so.36 =>
/usr/local/lib/libicudata.so.36 (0x4924f000)

libpthread.so.2 => /usr/lib/libpthread.so.2 (0x49bff000)

$ ldd /usr/local/lib/libicuuc.so.36

              /usr/local/lib/libicuuc.so.36:

                                    libicudata.so.36 =>
/usr/local/lib/libicudata.so.36 (0x48285000)

libpthread.so.2 => /usr/lib/libpthread.so.2 (0x48c35000)

              libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x48c5c000)

                            libm.so.4 => /lib/libm.so.4 (0x48d32000)


I can verify with ktrace that libc is loaded (mmap-ed) before
libpthread. The program aborts with the quoted above message 'Recurse on
a private mutex.'
If I run the program with env LD_PRELOAD=libpthread.so.2 then everything
is OK.

Also:
$ pkg-config --libs glib-2.0
-L/usr/local/lib -lglib-2.0 -liconv

$ pkg-config --libs gdk-pixbuf-2.0
-L/usr/local/lib -lgdk_pixbuf-2.0 -lm -lgobject-2.0 -lgmodule-2.0
-lglib-2.0 -liconv


-- 
Andriy Gapon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45B8C3B7.5000606>