pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg_install fails when archivers/xz is installed



On 2020-08-11 06:38, Rhialto wrote:
On Tue 11 Aug 2020 at 13:29:43 +0200, Rhialto wrote:
I did manage to create a not very complete copy of libc.so without
SONAME, using "ld -shared -no-as-needed libc.so -o libc2.so", and when
linking that, I got indeed

Dynamic Section:
   NEEDED               /tmp/c/libc2.so
and the libc2.so file has

   NEEDED               libc.so.12

It occurred to me that from this result you can even today create a
hacky way to link to shared libraries with an absolute path.

For each shared lib, create a shim as above that has no SONAME. It can
link itself to the real library. Since it refers to just one, it can
have an RPATH plus basename and still only find the correct library.

Then link your program with the shim instead of the real library, and do
this by specifying the full path.  Your program will then include the
same path to the shim.

It's not ideal, but it should work.

-Olaf.
Nice work tracking this down.

To me this looks like a high cost for modest benefit, though.  It's nice to be able to override LD_LIBRARY_PATH, but in my environment, users have to load an env module or source a script to get pkgsrc trees into their path anyway.  I can unset LD_LIBRARY_PATH in those scripts, which is good enough to prevent almost all shared lib issues.  If a clever but unwise user figures out how to bypass my protections, my response will be "you're on your own".  ;-)

Thanks,

    JB



Home | Main Index | Thread Index | Old Index