Subject: binary contains wrong RPATH, DESTDIR support suspected
To: None <tech-pkg@NetBSD.org>
From: Klaus Heinz <k.heinz@dezsieben.kh-22.de>
List: tech-pkg
Date: 12/11/2007 23:16:24
Hi,

while building and installing lang/tcl-expect (USE_DESTDIR=full) I can
observe this:

  $ objdump -x work.i386/.destdir/usr/pkg/bin/expect
  ...
  Dynamic Section:
    NEEDED      libexpect543.so.1
    NEEDED      libc.so.12
    NEEDED      libtcl84.so.1
    NEEDED      libpthread.so.0
    NEEDED      libm.so.0
    NEEDED      libutil.so.7
    RPATH       /usr/pkg/lib:/var/tmp2/pkgsrc/lang/tcl-expect/work.i386/.destdir/usr/pkg/lib
  ...

Obviously something isn't quite right here. More research shows this in
my work.log:

  [*] /var/tmp2/pkgsrc/lang/tcl-expect/work.i386/.wrapper/bin/libtool /var/tmp2/pkgsrc/lang/tcl-expect/work.i386/.wrapper/bin/libtool --mode=link cc -O2 -I/usr/pkg/include -I/usr/include -O2 -I/usr/include -pipe -I/usr/include -DDFLT_STTY=\"sane\" -fPIC -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -o expect_installed exp_main_exp.o libexpect543.la -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -ltcl84 -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -lpthread -lm -lutil -Wl,-rpath,/var/tmp2/pkgsrc/lang/tcl-expect/work.i386/.destdir/usr/pkg/lib:/usr/pkg/lib

  <.> /usr/pkg/bin/libtool --mode=link cc -O2 -I/var/tmp2/pkgsrc/lang/tcl-expect/work.i386/.buildlink/include -O2 -pipe -DDFLT_STTY=\"sane\" -fPIC -Wl,-R/usr/pkg/lib -o expect_installed exp_main_exp.o libexpect543.la -L/var/tmp2/pkgsrc/lang/tcl-expect/work.i386/.buildlink/lib -ltcl84 -lpthread -lm -lutil -Wl,-rpath,/var/tmp2/pkgsrc/lang/tcl-expect/work.i386/.destdir/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib

The line above explains why the installed "expect" binary contains a
bad RPATH: the wrapper scripts did not filter out the ${DESTDIR} path.

Can anyone repeat this?
Is this a still missing part of DESTDIR support in pkgsrc?

ciao
     Klaus