Subject: bin/2524: building ld.so links with wrong libc_pic.a when DESTDIR set
To: None <gnats-bugs@NetBSD.ORG>
From: Phillip F Knaack <flipk@ncremp.ag.iastate.edu>
List: netbsd-bugs
Date: 06/06/1996 16:29:42
>Number:         2524
>Category:       bin
>Synopsis:       building ld.so links with wrong libc_pic.a when DESTDIR set
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun  6 18:20:03 1996
>Last-Modified:
>Originator:     Phillip F Knaack
>Organization:
   IDEA (Information Development for Extension Audiences)
>Release:        NetBSD 1.2_ALPHA (Wed Jun 5 1996 sup)
>Environment:
System: NetBSD ncremp.ag.iastate.edu 1.1B NetBSD 1.1B (NCREMP) #3: Sun May 5 11:44:44 CDT 1996 root@ncremp.ag.iastate.edu:/usr/src/sys/arch/i386/compile/NCREMP i386
  building 1.2_ALPHA on 1.1B, using DESTDIR variable set to "/usr/dest"

>Description:
	The ld/rtld/Makefile links with "-lc_pic", but if DESTDIR is set
this is the wrong libc_pic.a (should be $DESTDIR/usr/lib/libc_pic.a).
>How-To-Repeat:
	set DESTDIR, temporarily remove /usr/lib/libc_pic.a, and build 
/usr/src/gnu/usr.bin/ld/rtld; it will fail trying to link with the wrong one.
>Fix:
	The following patch (or something like it) will link with 
the correct (new) libc_pic.a:

*** gnu/usr.bin/ld/rtld/Makefile.old	Thu Jun  6 16:10:09 1996
--- gnu/usr.bin/ld/rtld/Makefile	Thu Jun  6 16:27:47 1996
***************
*** 10,16 ****
--- 10,20 ----
  CFLAGS+=-I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE_ARCH) $(PICFLAG) -DRTLD -DLIBC_SCCS
  LDFLAGS+=-Bshareable -Bsymbolic -assert nosymbolic
  ASFLAGS+=-k
+ .if !defined(DESTDIR)
  LDADD+=	-lc_pic
+ .else
+ LDADD+= $(DESTDIR)/usr/lib/libc_pic.a
+ .endif
  BINDIR= /usr/libexec
  MLINKS=	rtld.1 ld.so.1
  
>Audit-Trail:
>Unformatted: