python libraries vs. RPATH (vs. RUNPATH)

Valery Ushakov <[email protected]>
Newsgroups gmane.os.netbsd.devel.toolchain
Message-ID <[email protected]>
I see this on a NetBSD/macppc 8-STABLE (not *very* recent).  I've
installed devel/py-readline but it doesn't seem to work.  python
doesn't get input line editing and:

  >>> import readline
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  ImportError: Shared object "libreadline.so.8" not found

Poking around I see:

$ ldd /usr/pkg/lib/python3.9/lib-dynload/readline.so
/usr/pkg/lib/python3.9/lib-dynload/readline.so:
        -lreadline.8 => not found
        -lterminfo.1 => /usr/lib/libterminfo.so.1
        -lc.12 => /usr/lib/libc.so.12
$ readelf -d /usr/pkg/bin/python3.9 | grep PATH
 0x0000000f (RPATH)                      Library rpath: [/usr/pkg/lib:/usr/X11R7/lib]
$ readelf -d /usr/pkg/lib/python3.9/lib-dynload/readline.so | grep PATH
 0x0000001d (RUNPATH)                    Library runpath: [/usr/pkg/lib]


The link step for the package was:

gcc -shared -L. -Wl,-zrelro -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -Wl,-zrelro -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -Wl,-zrelro -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -pipe -O2 -D_FORTIFY_SOURCE=2 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.9 -I/usr/pkg/include -I/usr/include -I/usr/pkg/include/python3.9 build/temp.netbsd-8.1_STABLE-macppc-cpython-39/Modules/readline.o -L/usr/pkg/lib -L/usr/pkg/lib -Wl,--enable-new-dtags,-R/usr/pkg/lib -lreadline -ltermcap -o build/lib.netbsd-8.1_STABLE-macppc-cpython-39/readline.so

This works on a recentish current where lib-dynload/readline.so has
RPATH instead of RUNPATH.

I vaguely remember we had a bit of a discussion abour RPATH
vs. RUNPATH a few years ago.  Does anyone remember off-hand if the
relevant fixes made it to -8?

TIA.

-uwe
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.