Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Nov 2005 09:26:23 +0100 (CET)
From:      Volker Stolz <vs@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/89052: [patch] www/mozilla: Fix ld-run-path issue in libraries
Message-ID:  <200511150826.jAF8QNgh087703@i2.informatik.rwth-aachen.de>
Resent-Message-ID: <200511150830.jAF8UHPI081917@freefall.freebsd.org>

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

>Number:         89052
>Category:       ports
>Synopsis:       [patch] www/mozilla: Fix ld-run-path issue in libraries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 15 08:30:17 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Volker Stolz
>Release:        FreeBSD 4.11-STABLE i386
>Organization:
Lehrstuhl für Informatik II; RWTH Aachen (c) Universität
>Environment:
System: FreeBSD menelaos.informatik.rwth-aachen.de 4.11-STABLE FreeBSD 4.11-STABLE #23: Fri Jan 14 09:26:11 CET 2005 root@menelaos.informatik.rwth-aachen.de:/usr/obj/usr/src/sys/MENELAOS i386

>Description:
The following patch addresses the issues mentioned in Mozilla Bug #304655
https://bugzilla.mozilla.org/show_bug.cgi?id=304655

To quote the important part:
"The problem of course is that the libembedmoz.so doesn't know how to find the
other mozilla libs that it needs. Distros hack around this issue by adding
${moz_libdir} to the global ldconfig path. Which of course means that it works
with either mozilla or firefox but not both (because one or the other must come
first in the ld library search path).

Of course the correct solution is simply to link libembedmoz.so using
-Wl,-rpath,${moz_libdir}. That way it can find the other libs that it needs."

>How-To-Repeat:
- Install mozilla
- Check devel/devhelp: It runs ldconfig on mozlibdir, which isn't The Right Thing to do
    and will no longer be required after the patch.
- Check x11/yelp: It requires a shell-wrapper setting LD_LIBRARY_PATH, which is no
    longer necessary
- Check x11-toolkits/hs-gtk2hs: There's no way to get the gtkembedmoz-part to work without
    applying the same hacks as above.

Also there seems to be some interference with devel/nspr, but IANAE and cannot
grasp the implications of mozilla picking up nspr-config from the port.

>Fix:
The attached patch sets LDFLAGS appropriately. Some manual intervention for
nspr is required.

--- moz.diff begins here ---
Index: Makefile
===================================================================
RCS file: /usr/freebsdcvs/cvs-ports/ports/www/mozilla/Makefile,v
retrieving revision 1.206
diff -u -r1.206 Makefile
--- Makefile	5 Nov 2005 06:20:20 -0000	1.206
+++ Makefile	15 Nov 2005 08:02:00 -0000
@@ -78,7 +78,7 @@
 
 PLIST=		${WRKDIR}/pkg-plist
 MOZ_EXTENSIONS=	default
-CONFIGURE_ENV=	LOCALBASE=${LOCALBASE}
+CONFIGURE_ENV+=	LOCALBASE=${LOCALBASE} LDFLAGS="${LDFLAGS} -Wl,-rpath,${X11BASE}/lib/mozilla"
 PKGINSTALL=	${WRKDIR}/pkg-install
 PKGDEINSTALL=	${WRKDIR}/pkg-deinstall
 FREETYPE_LIB=	libfreetype.so.9
@@ -244,6 +244,8 @@
 		${WRKSRC}/xpcom/io/nsNativeCharsetUtils.cpp
 	@${REINPLACE_CMD} -E -e 's|libfreetype\.so\.[0-9]+|${FREETYPE_LIB}|g' \
 		${WRKSRC}/modules/libpref/src/init/all.js
+	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
+		${WRKSRC}/nsprpub/config/nspr-config.in ${WRKSRC}/nsprpub/config/autoconf.mk.in
 	@for pcfile in ${PKGCONFIG_FILES}; do \
 		${REINPLACE_CMD} -e 's|mozilla-xpcom|mozilla-xpcom${MOZ_SUFX}${PKGNAMESUFFIX}|g ; \
 			s|mozilla-nspr|mozilla-nspr${MOZ_SUFX}${PKGNAMESUFFIX}|g' \
@@ -269,6 +271,9 @@
 		${ECHO_CMD} "${PKGNAME}: bind installed with PORT_REPLACES_BASE_BIND causes build problems."; \
 		${FALSE}; \
 	fi
+
+post-build:
+	${REINPLACE_CMD} -e "s|\(Libs:.*\)\($$\)|\1 -Wl,-rpath,${PREFIX}/lib/mozilla\2|" ${WRKSRC}/build/unix/*.pc
 
 pre-install:
 	${RM} -rf ${FAKEDIR} ${PLIST}
Index: files/patch-nsprpub_config_autoconf.mk.in
===================================================================
RCS file: files/patch-nsprpub_config_autoconf.mk.in
diff -N files/patch-nsprpub_config_autoconf.mk.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-nsprpub_config_autoconf.mk.in	14 Nov 2005 17:42:43 -0000
@@ -0,0 +1,16 @@
+
+$FreeBSD$
+
+--- nsprpub/config/autoconf.mk.in.orig
++++ nsprpub/config/autoconf.mk.in
+@@ -32,8 +32,8 @@
+ MOD_MINOR_VERSION = @MOD_MINOR_VERSION@
+ MOD_PATCH_VERSION = @MOD_PATCH_VERSION@
+ 
+-LIBNSPR		= @LIBNSPR@
+-LIBPLC		= @LIBPLC@
++LIBNSPR		= -Wl,-rpath,%%PREFIX%%/lib/mozilla @LIBNSPR@
++LIBPLC		= -Wl,-rpath,%%PREFIX%%/lib/mozilla @LIBPLC@
+ 
+ CROSS_COMPILE	= @CROSS_COMPILE@
+ BUILD_OPT	= @MOZ_OPTIMIZE@
Index: files/patch-nsprpub_config_nspr-config.in
===================================================================
RCS file: files/patch-nsprpub_config_nspr-config.in
diff -N files/patch-nsprpub_config_nspr-config.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ files/patch-nsprpub_config_nspr-config.in	14 Nov 2005 17:46:22 -0000
@@ -0,0 +1,14 @@
+
+$FreeBSD$
+
+--- nsprpub/config/nspr-config.in.orig
++++ nsprpub/config/nspr-config.in
+@@ -95,7 +95,7 @@
+ fi
+ 
+ if test "$echo_libs" = "yes"; then
+-      libdirs=-L${exec_prefix}/lib
++      libdirs="-Wl,-rpath,%%PREFIX%%/lib/mozilla -L${exec_prefix}/lib"
+       if test -n "$lib_plds"; then
+ 	libdirs="$libdirs -lplds${major_version}"
+       fi
--- moz.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



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