[pypy-dev] Installation layout of the PyPy 3.8 Fedora package

Antonio Cuni anto.cuni at gmail.com
Sat Dec 4 05:21:32 EST 2021


On Thu, Dec 2, 2021 at 11:49 PM Armin Rigo <armin.rigo at gmail.com> wrote:

>
> https://cffi.readthedocs.io/en/latest/embedding.html.  If we want to
> go the full CPython way, we need to rename and move
> "$localdir/libpypy3-c.so" to something like "/usr/lib/libpypy38.so"
> and have /usr/bin/pypy3.8 be a program that is linked to
> "libpypy38.so" instead of "$localdir/libpypy3-c.so".  This would have
> consequences for my own habits---e.g. the executable would no longer
> find its .so if it lives simply in the same directory.  Arguably not a
> big issue :-)  A freshly translated pypy would not work without
> LD_LIBRARY_PATH tricks, just like a freshly compiled CPython does not.
>

I fear this would break much more than your own habits. To start with, it
would break mine :)
Jokes apart, it would break three big uses cases:
1. Download&run: if you want to try pypy, currently you can download the
tarball, unpack and run, and it just works
2. non-privileged installation: currently you can install PyPy for your own
user even if you don't have root power
3. install pypy in docker: this is basically the same as (1) but it's worth
mentioning because a pattern which I saw a lot in real life production
codie: it's very easy to install pypy in a Dockerfile, you just
wget&unpack the tarball. If we require libpypy3.so so be in a system-wide
directory, people will have to figure out themselves how to "install" pypy
and/or we would need to provide an "install" script which will be very
complex because of the zillions of slightly different details of linux
distros

So, I'm -1 to remove the possibility of $localdir/libpypy3-c.so.
Maybe a solution which solves both problems is a compilation flag:
1. by default, we link to $localdir/libpypy3-c.so as we do now (and maybe
we could even rename the file nowadats. The '-c' suffix is a relic of the
past and it's probably no longer needed);
2. if you translate pypy with a special option, we link to a system-wide
libpypy38.so, so that distros can compile a pypy which suits their needs

Also, note that an poor's man (2) is already possible nowadays: we
link to $localdir/libpypy3-c.so because
pypy3-c it has an rpath set to $ORIGIN, but I think you can just patch the
binary to remove it:
https://stackoverflow.com/questions/13769141/can-i-change-rpath-in-an-already-compiled-binary

ciao,
Anto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/pypy-dev/attachments/20211204/939c8a07/attachment.html>


More information about the pypy-dev mailing list