Subject: devel/glib workaround
To: None <tech-pkg@netbsd.org>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-pkg
Date: 02/25/2003 13:14:19
--=Merlin-ASDIC-CDMA-Vince-Foster-broadside-JSOFC3IP-SP4-S-Box-Serbian=
I've found that the glib package has broken gmodule support in
-current do to an interaction between one of its configure tests and
libpthread. The problem manifests as an inability to find symbols in
gmodule-opened shared objects, such as the error reported in PR 20050:
$ galeon
/usr/X11R6/lib/vfs/modules/libhttp.so: Undefined PLT symbol
"gnome_vfs_pthread_recursive_mutex_init"
The problem is that glib has a configure test for some broken
RTLD_GLOBAL behavior on OSF/1, and the test calls
dlopen("libpthread.so"). The test succeds in finding that NetBSD's
dlopen isn't broken in the way that OSF/1 is or was, but then it
triggers an assertion on exit (inside the mutex locking in atexit(),
where one of the libc pthread stubs correctly detects that libpthread
has been loaded and it shouldn't be running), and the abort/core dump
is read by configure as the test reporting "broken, OSF/1 style".
Making it safe to dynamically load and use libpthread.so is pretty
unlikely (as best I can tell, only AIX currently supports that, and
most of the industry thinks "ow, what a bad idea"), and so I'd prefer
to keep the behavior that the libc routines detect this and fail
noisily rather than silently. So I'd like to patch glib in pkgsrc to
avoid this problem, by removing the relevant configure test.
The patches are attached; comments requested.
- Nathan
--=Merlin-ASDIC-CDMA-Vince-Foster-broadside-JSOFC3IP-SP4-S-Box-Serbian=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=mkdiff
Content-Description: patch to devel/glib/Makefile
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/glib/Makefile,v
retrieving revision 1.52
diff -u -r1.52 Makefile
--- Makefile 2002/12/19 13:07:42 1.52
+++ Makefile 2003/02/25 17:57:08
@@ -18,6 +18,7 @@
USE_BUILDLINK2= yes
GNU_CONFIGURE= yes
USE_LIBTOOL= yes
+AUTOCONF_REQD= 2.13
LTCONFIG_OVERRIDE= ${WRKSRC}/ltconfig
PKGCONFIG_OVERRIDE= ${WRKSRC}/glib.pc.in
PKGCONFIG_OVERRIDE+= ${WRKSRC}/gmodule.pc.in
@@ -45,7 +46,7 @@
# one derived from the package name.
#
pre-configure:
- @cd ${WRKSRC}; \
+ @cd ${WRKSRC} && ${AUTOCONF}; \
files="glib-config.in docs/glib-config.1.in glib.pc.in gmodule.pc.in gthread.pc.in"; \
for file in $${files}; do \
${SED} -e "s|@GLIB_VERSION@|${GLIB_VERSION}|g" \
@@ -79,6 +80,7 @@
cd ${WRKSRC} && ${MAKE_ENV} ${MAKE_PROGRAM} check 2>&1 | \
tee ${WRKDIR}/check.log
+.include "../../mk/autoconf.mk"
.include "../../mk/pthread.buildlink2.mk"
.include "../../mk/texinfo.mk"
.include "../../mk/bsd.pkg.mk"
--=Merlin-ASDIC-CDMA-Vince-Foster-broadside-JSOFC3IP-SP4-S-Box-Serbian=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=patch-ad
Content-Description: replacement for devel/glib/patches/patch-ad
$NetBSD$
--- configure.in.orig Thu Mar 15 10:37:37 2001
+++ configure.in Thu Feb 20 16:26:54 2003
@@ -33,7 +33,7 @@
#
GLIB_MAJOR_VERSION=1
GLIB_MINOR_VERSION=2
-GLIB_MICRO_VERSION=10
+GLIB_MICRO_VERSION=23
GLIB_INTERFACE_AGE=10
GLIB_BINARY_AGE=10
GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
@@ -555,36 +555,6 @@
LDFLAGS_orig="$LDFLAGS"
LIBS="$LIBS $G_MODULE_LIBS"
LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
-dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
- AC_CACHE_CHECK([for RTLD_GLOBAL brokenness],
- glib_cv_rtldglobal_broken,[
- AC_TRY_RUN([
- #include <dlfcn.h>
- #ifndef RTLD_GLOBAL
- #define RTLD_GLOBAL 0
- #endif
- #ifndef RTLD_LAZY
- #define RTLD_LAZY 0
- #endif
- int pthread_create;
- int main () {
- void *handle, *global, *local;
- global = &pthread_create;
- handle = dlopen ("libpthread.so", RTLD_GLOBAL | RTLD_LAZY);
- if (!handle) return 0;
- local = dlsym (handle, "pthread_create");
- return global == local;
- }],
- [glib_cv_rtldglobal_broken=no],
- [glib_cv_rtldglobal_broken=yes],
- [])
- rm -f plugin.c plugin.o plugin.lo
- ])
- if test "x$glib_cv_rtldglobal_broken" = "xyes"; then
- G_MODULE_BROKEN_RTLD_GLOBAL=1
- else
- G_MODULE_BROKEN_RTLD_GLOBAL=0
- fi
dnl *** check whether we need preceeding underscores
AC_MSG_CHECKING(for preceeding underscore in symbols)
AC_CACHE_VAL(glib_cv_uscore,[
--=Merlin-ASDIC-CDMA-Vince-Foster-broadside-JSOFC3IP-SP4-S-Box-Serbian=--