NetBSD Problem Report #7283

Received: (qmail 8156 invoked from network); 29 Mar 1999 20:05:05 -0000
Message-Id: <199903292005.MAA18192@digital.clock.org>
Date: Mon, 29 Mar 1999 12:05:04 -0800 (PST)
From: "Erik E. Fair" <fair@digital.clock.org>
Reply-To: fair@digital.clock.org
To: gnats-bugs@gnats.netbsd.org
Subject: shared library builds use old dependent libraries when DESTDIR set
X-Send-Pr-Version: 3.95

>Number:         7283
>Category:       lib
>Synopsis:       shared library builds use old dependent libraries when DESTDIR set
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    fair
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 29 12:20:01 +0000 1999
>Closed-Date:    Sat Apr 03 09:07:55 +0000 1999
>Last-Modified:  Sat Apr 03 09:08:45 +0000 1999
>Originator:     Erik E. Fair
>Release:        NetBSD-current 19990329
>Organization:
International Organization of Internet Clock Watchers
>Environment:

System: NetBSD digital.clock.org 1.3 NetBSD 1.3 (DIGITAL) #1: Mon May 25 14:16:49 PDT 1998 fair@digital.clock.org:/usr/src/sys/arch/sparc/compile/DIGITAL sparc


>Description:
	When building the system, shared libraries which depend on
	other libraries still search /usr/lib when DESTDIR is set;
	this causes the new library to be dependent on an old
	installed shared library, instead of one just built and
	installed in ${DESTDIR}${LIBDIR}

>How-To-Repeat:
	Install a snapshot from outside the USA (i.e. without "domestic").

	Attempt to build the whole system (including "domestic")
	with DESTDIR set to /altroot.

	Discover that since you don't have the domestic libraries
	already installed in /usr/lib (!!), shared libkrb won't
	load because it can't find libcom_err.

>Fix:

	Please double check this patch. I don't feel sufficiently
	versed in the complete vagaries of the build/make system
	to apply it myself (i.e. I don't wanna get flamed into
	the ground if it's the wrong thing for some case I'm
	unfamiliar with even though this worked for me for the
	specific case I found). In particular, will this have any
	deleterious effects on libraries for packages?


*** src/share/mk/bsd.lib.mk.orig	Mon Mar 29 11:30:36 1999
--- src/share/mk/bsd.lib.mk	Mon Mar 29 11:41:00 1999
***************
*** 242,251 ****
--- 242,260 ----
      ${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
  	@echo building shared ${LIB} library \(version ${SHLIB_MAJOR}.${SHLIB_MINOR}\)
  	@rm -f lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR}
+ .if defined(DESTDIR)
+ 	$(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
+ 	    ${SHLIB_LDSTARTFILE} \
+ 	    --whole-archive lib${LIB}_pic.a \
+ 	    -nostdlib -L${DESTDIR}${LIBDIR} -R${LIBDIR} \
+ 	    --no-whole-archive ${LDADD} \
+ 	    ${SHLIB_LDENDFILE}
+ .else
  	$(LD) -x -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
  	    ${SHLIB_LDSTARTFILE} \
  	    --whole-archive lib${LIB}_pic.a --no-whole-archive ${LDADD} \
  	    ${SHLIB_LDENDFILE}
+ .endif
  .if ${OBJECT_FMT} == "ELF"
  	rm -f lib${LIB}.so.${SHLIB_MAJOR}
  	ln -s lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} \

>Release-Note:
>Audit-Trail:

From: Ross Harvey <ross@ghs.com>
To: fair@digital.clock.org, gnats-bugs@gnats.netbsd.org
Cc:  Subject: Re: lib/7283: shared library builds use old dependent libraries when DESTDIR set
Date: Mon, 29 Mar 1999 18:00:00 -0800 (PST)

 This change doesn't look complete, but more fundamentally, it's trying
 to do something that shouldn't be supported.

 A DESTDIR build is fine, but you should first build and install to /.
 If you won't run it yourself, don't ask anyone else to...

 There are too many little things that are different if you try to do
 a build directly to an empty DESTDIR.

From: "Erik E. Fair" <fair@clock.org>
To: Ross Harvey <ross@ghs.com>
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: lib/7283: shared library builds use old dependent libraries
 when DESTDIR set
Date: Mon, 29 Mar 1999 18:23:31 -0800

 The goal here is to build a complete release in isolation, and *then*
 install it if it looks good. I've been hosed quite a few times by changes
 -current that contaminated by toolchain or otherwise made it necessary to
 back out to a previous release in the days when I used to do a "live" make
 build into the build system. bsd.prog.mk already does this stuff; we just
 missed doing it in bsd.lib.mk and I was unfortunate enough to stumble on it.

 What I want to make sure is that I don't hose up the ELF systems, or the
 package libraries in the process of getting this fixed.

 It's worth noting that the NetBSD release process calls for the same sort
 of thing: "make distribution" into a clean space, then "checkflist",
 "maketars" and so on.

 	Erik
State-Changed-From-To: open->feedback 
State-Changed-By: fair 
State-Changed-When: Tue Mar 30 01:30:58 PST 1999 
State-Changed-Why:  
Patch applied. 


Responsible-Changed-From-To: lib-bug-people->fair 
Responsible-Changed-By: fair 
Responsible-Changed-When: Tue Mar 30 01:30:58 PST 1999 
Responsible-Changed-Why:  
I'm the one who applied the patch, and will watch for additional issues 
for a time. 
State-Changed-From-To: feedback->closed 
State-Changed-By: fair 
State-Changed-When: Sat Apr 3 01:07:55 PST 1999 
State-Changed-Why:  
This problem is fixed. It was also noted that it helps the cross-compiles, 
too. 

From: Todd Vierling <tv@pobox.com>
To: "Erik E. Fair" <fair@digital.clock.org>
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: lib/7283: shared library builds use old dependent libraries when
 DESTDIR set
Date: Thu, 15 Apr 1999 11:27:24 -0400 (EDT)

 On Mon, 29 Mar 1999, Erik E. Fair wrote:

 : >Synopsis:       shared library builds use old dependent libraries when DESTDIR set

 : + 	    -nostdlib -L${DESTDIR}${LIBDIR} -R${LIBDIR} \

 Fortunately, I have added -nostdlib handling to the binutils based ld used
 on ELF systems, so this will work, but ONLY with a fairly recent ELF ld on
 those platforms.

 -- 
 -- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com)

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.