NetBSD Problem Report #47700

From campbell@mumble.net  Thu Mar 28 03:25:58 2013
Return-Path: <campbell@mumble.net>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id D746463F314
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 28 Mar 2013 03:25:57 +0000 (UTC)
Message-Id: <20130328032451.CD7A6604F0@jupiter.mumble.net>
Date: Thu, 28 Mar 2013 03:24:51 +0000 (UTC)
From: Taylor R Campbell <campbell+netbsd@mumble.net>
Reply-To: Taylor R Campbell <campbell+netbsd@mumble.net>
To: gnats-bugs@gnats.NetBSD.org
Subject: MKSTATICLIB, MKPICLIB, and `-g' interact badly in bsd.lib.mk
X-Send-Pr-Version: 3.95

>Number:         47700
>Category:       misc
>Synopsis:       MKSTATICLIB, MKPICLIB, and `-g' interact badly in bsd.lib.mk
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 28 03:30:00 +0000 2013
>Closed-Date:    Mon Oct 07 07:18:18 +0000 2013
>Last-Modified:  Mon Oct 07 07:18:18 +0000 2013
>Originator:     Taylor R Campbell <campbell+netbsd@mumble.net>
>Release:        NetBSD 6.99.17
>Organization:
>Environment:
System: NetBSD vox.local 6.99.17 NetBSD 6.99.17 (GENERIC) #0: Thu Mar 28 03:12:05 UTC 2013 root@vox.local:/home/riastradh/netbsd/current/obj.vax/sys/arch/vax/compile/GENERIC vax
Architecture: vax
Machine: vax
>Description:

	MKDEBUG=yes is broken on VAX, because...

	The logic surrounding CSHLIBFLAGS affects which variants of a
	library (.a, _pic.a), and the initialization of CSHLIBFLAGS
	depends on whether `-g' has turned up.  This breaks the case of
	MKDEBUG=yes/MKSTATICLIB=no/MKPICLIB=no, which happens in
	librumphijack (which sets NOSTATICLIB) on VAX (which sets
	MKPICLIB=no) if you set MKDEBUG=yes in your mk.conf -- the
	symlink at librumphijack_pic.a is omitted from the destdir in
	spite of its presence in the set lists.

	A separate problem is that librumphijack_pic.a has no business
	being installed, really, any more than librumphijack.a does.
	But fixing this sounds even more convoluted and I think I've
	had enough of a foray into architecture necrophilia and the
	tortu(r)ous convolutions of logic in bsd.lib.mk for now.

>How-To-Repeat:

	build.sh -m vax -V MKDEBUG=yes distribution

	See that librumphijack_pic.a is not installed.

>Fix:

	Apply the following patch to set CSHLIBFLAGS a little later,
	after it could change the decision of what libraries get built:

Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.lib.mk,v
retrieving revision 1.332
diff -p -u -r1.332 bsd.lib.mk
--- share/mk/bsd.lib.mk	5 Mar 2013 21:16:24 -0000	1.332
+++ share/mk/bsd.lib.mk	28 Mar 2013 03:22:12 -0000
@@ -47,13 +47,6 @@ CFLAGS+=        ${PIE_CFLAGS}
 AFLAGS+=        ${PIE_AFLAGS}
 .endif

-.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \
-    (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
-# We only add -g to the shared library objects
-# because we don't currently split .a archives.
-CSHLIBFLAGS+=	-g
-.endif
-
 ##### Libraries that this may depend upon.
 .if defined(LIBDPLIBS) && ${MKPIC} != "no"				# {
 .for _lib _dir in ${LIBDPLIBS}
@@ -200,6 +193,13 @@ MKSHLIBOBJS= yes
 MKSHLIBOBJS= no
 .endif

+.if (defined(MKDEBUG) && (${MKDEBUG} != "no")) || \
+    (defined(CFLAGS) && !empty(CFLAGS:M*-g*))
+# We only add -g to the shared library objects
+# because we don't currently split .a archives.
+CSHLIBFLAGS+=	-g
+.endif
+
 # Platform-independent linker flags for ELF shared libraries
 SHLIB_SOVERSION=	${SHLIB_MAJOR}
 SHLIB_SHFLAGS=		-Wl,-soname,${_LIB}.so.${SHLIB_SOVERSION}

>Release-Note:

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47700 CVS commit: src/share/mk
Date: Mon, 22 Apr 2013 22:16:15 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Mon Apr 22 22:16:15 UTC 2013

 Modified Files:
 	src/share/mk: bsd.lib.mk

 Log Message:
 Move addition of -g to CSHLIBFLAGS later in bsd.lib.mk.

 It is now past any conditionals where its emptiness or nonemptiness can
 influence the decision of what objects get built.

 Fixes MKDEBUG=yes build on vax (PR 47700).


 To generate a diff of this commit:
 cvs rdiff -u -r1.334 -r1.335 src/share/mk/bsd.lib.mk

 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: dholland@NetBSD.org
State-Changed-When: Mon, 07 Oct 2013 07:18:18 +0000
State-Changed-Why:
submitter fixed it


>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.