NetBSD Problem Report #48966

From kovert@omniscient.com  Sat Jul  5 17:40:08 2014
Return-Path: <kovert@omniscient.com>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 05D0BA5D59
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  5 Jul 2014 17:40:08 +0000 (UTC)
Message-Id: <201407051739.s65HdxfR012444@guinness.omniscient.com>
Date: Sat, 5 Jul 2014 13:39:59 -0400 (EDT)
From: kovert@omniscient.com
Reply-To: kovert@omniscient.com
To: gnats-bugs@gnats.NetBSD.org
Subject: libexecinfo does not work under Darwin 10.9 (mavericks)
X-Send-Pr-Version: 3.95

>Number:         48966
>Category:       pkg
>Synopsis:       libexecinfo does not work under Darwin 10.9 (mavericks)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bsiegert
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 05 17:45:01 +0000 2014
>Closed-Date:    Sat Nov 22 16:37:04 +0000 2014
>Last-Modified:  Sat Nov 22 16:37:04 +0000 2014
>Originator:     Todd Kover
>Release:        Mac OS 10.9.4
>Organization:
Omniscient Technologies
kovert@omniscient.com
>Environment:
System: Darwin transient.omniscient.com 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
Architecture: x86_64
Machine: amd64
>Description:
	devel/libexecinfo fails on Darwin 10.9+Xcode 5 due to gcc assumptions
>How-To-Repeat:
	bootstrap pkgsrc with clang, attempt to build devel/libexecinfo
>Fix:

The --whole-archive option is not legal for gcc, and instead -force_load
needs to be passed to ld via clang.  I don't think there is an equivalent of
--no-whole-archive.

The second of these patches actually fixes the problem for devel/libexecinfo.
The first patch makes a similar change for other pkgsrc items that may be
broken.

I did not test it on an older os/x machine but I think the ifdefs will
cause old gnu based ld's to work, but the newer ones not to.  I did test on
the machine mentioned above.

Note that with the next os/x release (presumably 10.10), the Darwin regexps
will probably start failing; this patch does not address this...

Thanks,
-Todd

--- pkgsrc/mk/platform/Darwin.mk	31 Dec 2013 11:13:43 -0000	1.61
+++ pkgsrc/mk/platform/Darwin.mk	5 Jul 2014 17:29:47 -0000
@@ -121,8 +121,13 @@

 # flags passed to the linker to extract all symbols from static archives.
 # this is GNU ld.
+.if empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+_OPSYS_WHOLE_ARCHIVE_FLAG=	-Wl,-force-load
+_OPSYS_NO_WHOLE_ARCHIVE_FLAG=	
+.else
 _OPSYS_WHOLE_ARCHIVE_FLAG=	-Wl,--whole-archive
 _OPSYS_NO_WHOLE_ARCHIVE_FLAG=	-Wl,--no-whole-archive
+.endif

 _OPSYS_CAN_CHECK_SHLIBS=	no # can't use readelf in check/bsd.check-vars.mk


--- pkgsrc/pkgtools/bootstrap-mk-files/files/mods/Darwin.bsd.lib.mk	25 Oct 2013 13:53:03 -0000	1.4
+++ pkgsrc/pkgtools/bootstrap-mk-files/files/mods/Darwin.bsd.lib.mk	5 Jul 2014 17:30:32 -0000
@@ -370,6 +370,15 @@
 lib${LIB}_pic.a:: ${SOBJS} __archivebuild
 	@echo building shared object ${LIB} library

+#.if defined(PKGSRC_COMPILER) && ${PKGSRC_COMPILER} == 'clang'
+.if empty(MACHINE_PLATFORM:MDarwin-[0-8].*-*)
+_OPSYS_WHOLE_ARCHIVE_FLAG= -Wl,-force_load
+_OPSYS_NO_WHOLE_ARCHIVE_FLAG= 
+.else
+_OPSYS_WHOLE_ARCHIVE_FLAG= --whole-archive
+_OPSYS_NO_WHOLE_ARCHIVE_FLAG= --no-whole-archive
+.endif
+
 lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
     ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
 	@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@@ -377,14 +386,15 @@
 .if defined(DESTDIR)
 	$(CC) -nostdlib -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
 	    ${SHLIB_LDSTARTFILE} \
-	    --whole-archive ${SOLIB} \
-	    --no-whole-archive ${LDADD} \
+	    ${_OPSYS_WHOLE_ARCHIVE_FLAG} ${SOLIB} \
+	    ${_OPSYS_NO_WHOLE_ARCHIVE_FLAG) ${LDADD} \
 	    -L${DESTDIR}${LIBDIR} -R${LIBDIR} \
 	    ${SHLIB_LDENDFILE}
 .else
 	$(CC) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
 	    ${SHLIB_LDSTARTFILE} \
-	    --whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
+	    ${_OPSYS_WHOLE_ARCHIVE_FLAG} ${SOLIB} \
+	    ${_OPSYS_NO_WHOLE_ARCHIVE_FLAG} ${LDADD} \
 	    ${SHLIB_LDENDFILE}
 .endif
 .if ${OBJECT_FMT} == "ELF"

>Release-Note:

>Audit-Trail:
From: Amitai Schlair <schmonz@schmonz.com>
To: gnats-bugs@netbsd.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/48966: libexecinfo does not work under Darwin 10.9 (mavericks)
Date: Sat, 5 Jul 2014 16:30:12 -0400

 I've fixed the devel/libexecinfo build differently (by libtoolizing
 it), but if this change is correct then it's probably still a good
 idea for all the other packages still using BSD-style makefiles.

Responsible-Changed-From-To: pkg-manager->macos-pkg-people
Responsible-Changed-By: obache@NetBSD.org
Responsible-Changed-When: Wed, 16 Jul 2014 12:53:14 +0000
Responsible-Changed-Why:
Problem on Darwin.


Responsible-Changed-From-To: macos-pkg-people->bsiegert
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Sun, 20 Jul 2014 11:56:06 +0000
Responsible-Changed-Why:
taking this.


From: "Benny Siegert" <bsiegert@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48966 CVS commit: pkgsrc
Date: Sat, 22 Nov 2014 16:32:13 +0000

 Module Name:	pkgsrc
 Committed By:	bsiegert
 Date:		Sat Nov 22 16:32:13 UTC 2014

 Modified Files:
 	pkgsrc/mk/platform: Darwin.mk
 	pkgsrc/pkgtools/bootstrap-mk-files: Makefile
 	pkgsrc/pkgtools/bootstrap-mk-files/files/mods: Darwin.bsd.lib.mk

 Log Message:
 Do not use gcc-specific compiler flags on Mac OS versions that come with
 clang. Update version for bootstrap-mk-files.

 Patch provided by Todd Kover in PR pkg/48966.


 To generate a diff of this commit:
 cvs rdiff -u -r1.63 -r1.64 pkgsrc/mk/platform/Darwin.mk
 cvs rdiff -u -r1.43 -r1.44 pkgsrc/pkgtools/bootstrap-mk-files/Makefile
 cvs rdiff -u -r1.4 -r1.5 \
     pkgsrc/pkgtools/bootstrap-mk-files/files/mods/Darwin.bsd.lib.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Benny Siegert" <bsiegert@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/48966 CVS commit: pkgsrc/doc
Date: Sat, 22 Nov 2014 16:34:18 +0000

 Module Name:	pkgsrc
 Committed By:	bsiegert
 Date:		Sat Nov 22 16:34:18 UTC 2014

 Modified Files:
 	pkgsrc/doc: CHANGES-2014

 Log Message:
 Note bootstrap-mk-files update, PR pkg/48966.


 To generate a diff of this commit:
 cvs rdiff -u -r1.4392 -r1.4393 pkgsrc/doc/CHANGES-2014

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: bsiegert@NetBSD.org
State-Changed-When: Sat, 22 Nov 2014 16:37:04 +0000
State-Changed-Why:
Patch applied.

I tried it by building devel/sfio, which is one of the remaining packages
that use bsd.lib.mk. The build of that still fails, but now for a
different reason :).


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.