Bug#851805: nspr: testcase 'errcodes' fails with new-dtags: libnspr4.so => not found

Jon Grimm jon.grimm at canonical.com
Wed Jan 18 22:08:20 UTC 2017


Source: nspr
Severity: normal

Dear Maintainer,

ubuntu-zesty linker behavior has changed to --enable-new-dtags,
whereby -rpath now emits DT_RUNPATH instead of -DT_RPATH, which includes
some with respect to searching for dependent libraries.

The 'errcodes' testcase fails with:

./errcodes: error while loading shared libraries: libnspr4.so: cannot open shared object file: No such file or directory

Inspecting the binary:

$ ldd errcodes
	linux-vdso.so.1 =>  (0x00007ffcf5d71000)
	libplc4.so => /build/nspr-f9K1qE/nspr-4.12/nspr/pr/tests/../../dist/lib/libplc4.so (0x00007f95c6fe0000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f95c6c15000)
	/lib64/ld-linux-x86-64.so.2 (0x0000557b797dc000)
	libnspr4.so => not found

The 'errcodes' test case is unique in that while it declares:

'-L../../dist/lib -lplc4 -L../../dist/lib -lnspr4' it only has a direct
dependency on plc4.  However, plc4 itself has a dependency on nspr4.

RUNPATH (unlike RPATH) does not attempt to find indirect library
dependencies, so errcodes fails.  

If using a linker that still defaults to RPATH, the --enable-new-dtags flag
should be able to uncover this issue (possibly needs --as-needed on the
library builds too?) I haven't attempted to reproduce elsewhere.

3 quick and dirty ways to address this:
1) LD_PRELOAD
2) --disable-new-dtags (old rpath behavior)
3) --no-as-needed  (force the lookup)

,or of course other ideas by folks more knowledgeable.

I can patch in Ubuntu, but I'd like to avoid carrying a delta,
so thought I'd open a bug to explore. Its not an issue for Debian (yet)
as far as I know unless linker defaults have changed too. 

I'm leaning towards --disable-new-tags in pr/tests/Makefile.in just to
force the old rpath behavior (patch attached). With this errcodes (and
all of the rest of the pr/tests) pass.  Very open to a more proper fix.

$ ldd errcodes
	linux-vdso.so.1 =>  (0x00007fffd23d9000)
	libplc4.so => /build/nspr-CbIx53/nspr-4.12/nspr/pr/tests/../../dist/lib/libplc4.so (0x00007f9029c4f000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9029884000)
	libnspr4.so => /build/nspr-CbIx53/nspr-4.12/nspr/pr/tests/../../dist/lib/libnspr4.so (0x00007f9029645000)
	/lib64/ld-linux-x86-64.so.2 (0x00005559770dc000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f9029427000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9029223000)
	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f9029019000)



-- System Information:
Debian Release: stretch/sid
  APT prefers yakkety-updates
  APT policy: (500, 'yakkety-updates'), (500, 'yakkety-security'), (500, 'yakkety'), (400, 'yakkety-proposed')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-34-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_test_errcodes_for_runpath.patch
Type: text/x-diff
Size: 380 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-mozilla-maintainers/attachments/20170118/e0660736/attachment.patch>


More information about the pkg-mozilla-maintainers mailing list