Subject: pkg/36090: run-time library path checking broken when building/installing with DESTDIR
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <blair.sadewitz@gmail.com>
List: pkgsrc-bugs
Date: 03/26/2007 19:55:00
>Number:         36090
>Category:       pkg
>Synopsis:       run-time library path checking broken when building/installing with DESTDIR
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 26 19:55:00 +0000 2007
>Originator:     Blair Sadewitz
>Release:        4.99.16 on i386 and amd64
>Organization:
>Environment:
NetBSD dexamyl 4.99.16 NetBSD 4.99.16 (DEXAMYL) #2: Sat Mar 24 23:20:41 EDT 2007
  blair@dexamyl:/u/build/nbsd/src/sys/arch/i386/compile/DEXAMYL i386

>Description:
The latest commit to mk/check/check-shlibs.mk removed the leading / from 
line 32.  This results in checking library paths against absolute pathnames in DESTDIR, e.g.:

pkg_info: can't find package `lua-5.1.1nb1'
=> Checking for missing run-time search paths in lua-5.1.1nb1
ERROR: /usr/pkgsrc/lang/lua/work.dexamyl/.destdir/usr/pkg/bin/lua:      -llua.5
=> not found
ERROR: *** The programs/libs shown above will not find the listed
ERROR:     shared libraries at runtime.
ERROR:     Please fix the package (add -Wl,-R.../lib in the right places)!
*** Error code 1

Upon discussion of this issue with Klaus Heinz, it seems that this change--which is a fix--uncovered a bigger problem:  it is possible that prior to this change, no libraries were checked when using relative pathnames.
>How-To-Repeat:
Using DESTDIR support, Try to create a package which installs a shared library.
>Fix:
Find a platform-independent way of doing something like extracting DT_RPATH from ELF binaries to construct LD_LIBRARY_PATH, then use this in mk/check/check-shlibs.mk.

This problem does not apply unless one is using DESTDIR support.