Subject: problems with shared libraries during a "make build"
To: None <tech-toolchain@netbsd.org>
From: Simon Burge <simonb@telstra.com.au>
List: tech-toolchain
Date: 04/03/1999 21:22:16
Folks,

Just a quick report that I haven't had time to investigate yet.

I've got sources that are up-to-date as of about 18 hours ago (Saturday
afternoon Aus time), and I can't run binaries compiled some against
$DESTDIR libraries).  Here's an example where "make depend" failed for
tn3270 (\ and newlines added by me):

	mona:~ 5# cd /usr/src/usr.bin/tn3270/tools/prt3270
	mona:tn3270/tools/prt3270 6# ( cd obj.pmax ; \
		/usr/src/usr.bin/tn3270/tools/mkhits/obj.pmax/mkhits \
		/usr/src/usr.bin/tn3270/tools/prt3270/../../ctlr/hostctlr.h \
		TMPfunc.out < \
		/usr/src/usr.bin/tn3270/tools/prt3270/../../ctlr/unix.kbd > \
		kbd.tmp )
	Segmentation fault (core dumped)
	Exit 139
	mona:tn3270/tools/prt3270 7# ( cd obj.pmax ; env \
		LD_LIBRARY_PATH=/z/destdir/usr/lib \
		/usr/src/usr.bin/tn3270/tools/mkhits/obj.pmax/mkhits \
		/usr/src/usr.bin/tn3270/tools/prt3270/../../ctlr/hostctlr.h \
		TMPfunc.out < \
		/usr/src/usr.bin/tn3270/tools/prt3270/../../ctlr/unix.kbd > \
		kbd.tmp )
	mona:tn3270/tools/prt3270 8#

Notice how adding LD_LIBRARY_PATH fixes the problem?  As soon as I
install this snapshot over my system, the problem is going to go away.
Is setting LD_LIBRARY_PATH before executing anything that is built and
run as part of a "make build" the right thing to do to fix this (and
will it work on a.out as well as ELF)?

FWIW, I've never noticed this before and I've been doing DESTDIR builds
for quite a while (years)...

Simon.