NetBSD Problem Report #36568
From martin@duskware.de Wed Jun 27 19:42:10 2007
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
by narn.NetBSD.org (Postfix) with ESMTP id D1CA463B8E6
for <gnats-bugs@gnats.netbsd.org>; Wed, 27 Jun 2007 19:42:09 +0000 (UTC)
Message-Id: <20070627181226.2202E63B8E6@narn.NetBSD.org>
Date: Wed, 27 Jun 2007 18:12:26 +0000 (UTC)
From: idart@performancedesign.no
Reply-To: idart@performancedesign.no
To: netbsd-bugs-owner@NetBSD.org
Subject: [patch] devel/glib2 linker error on Darwin/OS X with certain linker flags
X-Send-Pr-Version: www-1.0
>Number: 36568
>Category: pkg
>Synopsis: [patch] devel/glib2 linker error on Darwin/OS X with certain linker flags
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bsiegert
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Jun 27 19:45:00 +0000 2007
>Closed-Date: Sat Nov 22 20:44:11 +0000 2014
>Last-Modified: Sat Nov 22 20:44:11 +0000 2014
>Originator: Idar Tollefsen
>Release: glib2-2.12.12
>Organization:
Performance Design
>Environment:
Darwin fulcrum.performancedesign.no 8.10.0 Darwin Kernel Version 8.10.0: Wed May 23 16:50:59 PDT 2007; root:xnu-792.21.3~1/RELEASE_PPC Power Macintosh powerpc
>Description:
If "-dead_strip" is used as a linker flag, devel/glib2 fails during linking on Darwin/OS X with messages like "ld: .libs/gatomic.o relocation overflow for relocation entry 0 in section (__TEXT,__text) (displacement too large)". Here's the output:
gcc -DHAVE_CONFIG_H -I. -I.. -DG_LOG_DOMAIN=\"GLib\" -DG_DISABLE_CAST_CHECKS -DG_DISABLE_DEPRECATED -DGLIB_COMPILATION -DNDEBUG -DPREFIX=\"/usr/pkg\" -DPKGLOCALEDIR=\"share\" -DPKG_SYSCONFDIR=\"/usr/pkg/etc\" -no-cpp-precomp -I/usr/pkg/pkgsrc/devel/glib2/work/.buildlink/include -D_REENTRANT -O2 -Wall -MT gspawn.lo -MD -MP -MF .deps/gspawn.Tpo -c gspawn.c -o gspawn.o >/dev/null 2>&1
/bin/sh ../libtool --mode=link gcc -DNDEBUG -O2 -I/usr/pkg/include -I/usr/include -Wall -Wl,-x -Wl,-dead_strip -L/usr/pkg/lib -L/usr/lib -o libglib-2.0.la -rpath /usr/pkg/lib -version-info 1200:12:1200 -export-dynamic -export-symbols-regex "^[^_].*" garray.lo gasyncqueue.lo gatomic.lo gbacktrace.lo gbase64.lo gbookmarkfile.lo gcache.lo gcompletion.lo gconvert.lo gdataset.lo gdate.lo gdir.lo gerror.lo gfileutils.lo ghash.lo ghook.lo giochannel.lo gkeyfile.lo glist.lo gmain.lo gmappedfile.lo gmarkup.lo gmem.lo gmessages.lo gnode.lo goption.lo gpattern.lo gprimes.lo gqsort.lo gqueue.lo grel.lo grand.lo gscanner.lo gshell.lo gslice.lo gslist.lo gstdio.lo gstrfuncs.lo gstring.lo gthread.lo gthreadpool.lo gtimer.lo gtree.lo guniprop.lo gutf8.lo gunibreak.lo gunicollate.lo gunidecomp.lo gutils.lo gprintf.lo libcharset/libcharset.la giounix.lo gspawn.lo -liconv -lintl
generating symbol list for `libglib-2.0.la'
nm .libs/garray.o .libs/gasyncqueue.o .libs/gatomic.o .libs/gbacktrace.o .libs/gbase64.o .libs/gbookmarkfile.o .libs/gcache.o .libs/gcompletion.o .libs/gconvert.o .libs/gdataset.o .libs/gdate.o .libs/gdir.o .libs/gerror.o .libs/gfileutils.o .libs/ghash.o .libs/ghook.o .libs/giochannel.o .libs/gkeyfile.o .libs/glist.o .libs/gmain.o .libs/gmappedfile.o .libs/gmarkup.o .libs/gmem.o .libs/gmessages.o .libs/gnode.o .libs/goption.o .libs/gpattern.o .libs/gprimes.o .libs/gqsort.o .libs/gqueue.o .libs/grel.o .libs/grand.o .libs/gscanner.o .libs/gshell.o .libs/gslice.o .libs/gslist.o .libs/gstdio.o .libs/gstrfuncs.o .libs/gstring.o .libs/gthread.o .libs/gthreadpool.o .libs/gtimer.o .libs/gtree.o .libs/guniprop.o .libs/gutf8.o .libs/gunibreak.o .libs/gunicollate.o .libs/gunidecomp.o .libs/gutils.o .libs/gprintf.o .libs/giounix.o .libs/gspawn.o libcharset/.libs/libcharset.a | sed -n -e 's/^.*[ ]\([BCDEGRST][BCDEGRST]*\)[ ][ ]*_\([_A-Za-z][_A-Za-z0-9]*\)$/\1 _\2 \2/p' |
/usr/bin/sed 's/.* //' | sort | uniq > .libs/libglib-2.0.exp
/usr/bin/egrep -e "^[^_].*" ".libs/libglib-2.0.exp" > ".libs/libglib-2.0.expT"
mv -f ".libs/libglib-2.0.expT" ".libs/libglib-2.0.exp"
rm -fr .libs/libglib-2.0.lax
mkdir .libs/libglib-2.0.lax
rm -fr .libs/libglib-2.0.lax/libcharset.a
mkdir .libs/libglib-2.0.lax/libcharset.a
Extracting /usr/pkg/pkgsrc/devel/glib2/work/glib-2.12.12/glib/libcharset/.libs/libcharset.a
(cd .libs/libglib-2.0.lax/libcharset.a && ar x /usr/pkg/pkgsrc/devel/glib2/work/glib-2.12.12/glib/libcharset/.libs/libcharset.a)
sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < .libs/libglib-2.0.exp > .libs/libglib-2.0-symbols.expsym
gcc -dynamiclib ${wl}-undefined ${wl}dynamic_lookup -o .libs/libglib-2.0.0.1200.12.dylib .libs/garray.o .libs/gasyncqueue.o .libs/gatomic.o .libs/gbacktrace.o .libs/gbase64.o .libs/gbookmarkfile.o .libs/gcache.o .libs/gcompletion.o .libs/gconvert.o .libs/gdataset.o .libs/gdate.o .libs/gdir.o .libs/gerror.o .libs/gfileutils.o .libs/ghash.o .libs/ghook.o .libs/giochannel.o .libs/gkeyfile.o .libs/glist.o .libs/gmain.o .libs/gmappedfile.o .libs/gmarkup.o .libs/gmem.o .libs/gmessages.o .libs/gnode.o .libs/goption.o .libs/gpattern.o .libs/gprimes.o .libs/gqsort.o .libs/gqueue.o .libs/grel.o .libs/grand.o .libs/gscanner.o .libs/gshell.o .libs/gslice.o .libs/gslist.o .libs/gstdio.o .libs/gstrfuncs.o .libs/gstring.o .libs/gthread.o .libs/gthreadpool.o .libs/gtimer.o .libs/gtree.o .libs/guniprop.o .libs/gutf8.o .libs/gunibreak.o .libs/gunicollate.o .libs/gunidecomp.o .libs/gutils.o .libs/gprintf.o .libs/giounix.o .libs/gspawn.o .libs/libglib-2.0.lax/libcharset.a/localcharset.o -L/u
sr/pkg/pkgsrc/devel/glib2/work/.buildlink/lib -lc /usr/lib/libiconv.dylib /usr/pkg/pkgsrc/devel/glib2/work/.buildlink/lib/libintl.dylib /usr/lib/libc.dylib -Wl,-x -Wl,-dead_strip -install_name /usr/pkg/lib/libglib-2.0.0.dylib -Wl,-compatibility_version -Wl,1201 -Wl,-current_version -Wl,1201.12
ld: warning multiple definitions of symbol _locale_charset
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libiconv.dylib(localcharset.o) definition of _locale_charset
/usr/pkg/pkgsrc/devel/glib2/work/.buildlink/lib/libintl.dylib(localcharset.o) definition of _locale_charset
ld: .libs/gatomic.o relocation overflow for relocation entry 0 in section (__TEXT,__text) (displacement too large)
ld: .libs/gatomic.o relocation overflow for relocation entry 1 in section (__TEXT,__text) (displacement too large)
ld: .libs/gatomic.o relocation overflow for relocation entry 2 in section (__TEXT,__text) (displacement too large)
ld: .libs/gatomic.o relocation overflow for relocation entry 3 in section (__TEXT,__text) (displacement too large)
/usr/bin/libtool: internal link edit command failed
gnumake[4]: *** [libglib-2.0.la] Error 1
gnumake[3]: *** [all-recursive] Error 1
gnumake[2]: *** [all] Error 2
gnumake[1]: *** [all-recursive] Error 1
gnumake: *** [all] Error 2
*** Error code 2
Stop.
bmake: stopped in /usr/pkg/pkgsrc/devel/glib2
*** Error code 1
Stop.
bmake: stopped in /usr/pkg/pkgsrc/devel/glib2
>How-To-Repeat:
On Darwin/OS X, add "-Wl,-dead_strip" to LDFLAGS in mk.conf. Then try to build devel/glib2.
>Fix:
Remove -dead_strip from LDFLAGS. Here's a patch against devel/glib2/Makefile. It also adds xgettext to USE_TOOLS to pull this into the build tree as glib2 uses it as it uses msgfmt that's allready part of USE_TOOLS.
--- Makefile.orig 2007-06-24 14:06:44.000000000 +0200
+++ Makefile 2007-06-27 19:18:39.000000000 +0200
@@ -16,7 +16,7 @@
PKG_DESTDIR_SUPPORT= user-destdir
USE_PKGLOCALEDIR= yes
-USE_TOOLS+= gmake msgfmt perl:run pkg-config
+USE_TOOLS+= gmake msgfmt xgettext perl:run pkg-config
USE_LANGUAGES= c c++ c99
USE_LIBTOOL= yes
TEST_TARGET= check
@@ -71,6 +71,10 @@
CONFIGURE_ENV+= gt_cv_c_wchar_t=no
.endif
+.if ${OPSYS} == "Darwin" && ${PKGSRC_COMPILER} == "gcc"
+LDFLAGS:= ${LDFLAGS:N-Wl,-dead_strip}
+.endif
+
# Handle directories shared with devel/glib.
PRINT_PLIST_AWK+= /^@dirrm include\/glib$$/ \
{ print "@unexec $${RMDIR} %D/" $$2 \
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: pkg-manager->wiz
Responsible-Changed-By: obache@netbsd.org
Responsible-Changed-When: Wed, 27 Jun 2007 22:11:59 +0000
Responsible-Changed-Why:
Over to maintainer.
From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/36568: [patch] devel/glib2 linker error on Darwin/OS X with certain linker flags
Date: Thu, 28 Jun 2007 16:43:34 +0200
On Wed, Jun 27, 2007 at 07:45:00PM +0000, idart@performancedesign.no wrote:
> It also adds xgettext to USE_TOOLS to pull this into the build tree as
> glib2 uses it as it uses msgfmt that's allready part of USE_TOOLS.
The gettext tools pull in each other, so this is not really necessary.
Joerg
From: Amitai Schlair <schmonz@NetBSD.org>
To: Idar Tollefsen <idart@performancedesign.no>
Cc: gnats-bugs@NetBSD.org
Subject: Re: pkg/36568: [patch] devel/glib2 linker error on Darwin/OS X with
certain linker flags
Date: Thu, 28 Jun 2007 12:49:53 -0400
idart@performancedesign.no wrote:
> If "-dead_strip" is used as a linker flag, devel/glib2 fails during
> linking on Darwin/OS X with messages like "ld: .libs/gatomic.o
> relocation overflow for relocation entry 0 in section (__TEXT,__text)
> (displacement too large)".
Where is -dead_strip coming from? Are you setting it in mk.conf? Does it
work in most other packages?
From: Idar Tollefsen <idart@performancedesign.no>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: pkg/36568: [patch] devel/glib2 linker error on Darwin/OS X with
certain linker flags
Date: Fri, 29 Jun 2007 11:32:51 +0200
> The gettext tools pull in each other, so this is not really necessary.
OK. I just noticed that it didn't link xgettext into the ${WRKSRC} and
the configure script picked it from ${PREFIX}/bin. With xgettext added
to USE_TOOLS, the configure script picked it from the build tree.
> Where is -dead_strip coming from? Are you setting it in mk.conf?
Yes. From my mk.conf:
LDFLAGS= -Wl,-x -Wl,-dead_strip
> Does it work in most other packages?
Yes. This is the only package so far that has a problem with it. And the
problem wasn't there before. I had glib2-2.12.4 (I think, or was it
2.4.x...) installed before, and that version didn't have this problem.
For more information about -dead_strip, see
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/ld.1.html
Responsible-Changed-From-To: wiz->darwin-pkg-people
Responsible-Changed-By: wiz@netbsd.org
Responsible-Changed-When: Mon, 23 Jul 2007 23:49:52 +0000
Responsible-Changed-Why:
Darwin pkgsrc problem with certain compiler flags.
Responsible-Changed-From-To: darwin-pkg-people->macos-pkg-people
Responsible-Changed-By: dholland@NetBSD.org
Responsible-Changed-When: Wed, 07 Mar 2012 06:47:44 +0000
Responsible-Changed-Why:
darwin-pkg-people has been changed to macos-pkg-people
Responsible-Changed-From-To: macos-pkg-people->bsiegert
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Sat, 22 Nov 2014 20:44:11 +0000
Responsible-Changed-Why:
Taking this seven-year old bug.
State-Changed-From-To: open->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Sat, 22 Nov 2014 20:44:11 +0000
State-Changed-Why:
This patch is not worth applying, sorry.
If you are building with non-standard compiler flags and things break,
you are on your own.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.