FS#80136 - [python] libpython3.so does not link to libpython3.x.so.y.z since python 3.11

Attached to Project: Arch Linux
Opened by Yichao Yu (yuyichao) - Thursday, 02 November 2023, 01:30 GMT
Last edited by Buggy McBugFace (bugbot) - Saturday, 25 November 2023, 20:22 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To David Runge (dvzrv)
Felix Yan (felixonmars)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

Description:

Python provides a version specific library with the soname libpython3.x.so.y.z (for python 3.11 this is currently libpython3.11.so.1.0) that contains the actual implementation of basically everything as well as a ABI-stable (https://peps.python.org/pep-0384/) library libpython3.so that conforming libraries can link to. Accessing the latter should allow accessing symbols from the former. AFAICT, the way this is implemented is that libpython3.so links to libpython3.x.so.y.z so it pulls in the real library when loaded. This is indeed the case up to the latest 3.10 version package but is not the case anymore for any of the 3.11 packages. This causes applications that loads libpython3.so to not work anymore.

Additional info:
* package version(s)
* config and/or log files etc.
* link to upstream bug report, if any

Steps to reproduce:

run `objdump -p /usr/lib/libpython3.so` and see that it doesn't link to the actual python library anymore.
This task depends upon

Closed by  Buggy McBugFace (bugbot)
Saturday, 25 November 2023, 20:22 GMT
Reason for closing:  Moved
Additional comments about closing:  https://gitlab.archlinux.org/archlinux/p ackaging/packages/python/issues/3
Comment by Toolybird (Toolybird) - Thursday, 02 November 2023, 01:42 GMT Comment by Yichao Yu (yuyichao) - Thursday, 02 November 2023, 02:04 GMT
There might be some compile option differences since the ArchLinuxARM version of the same file is indeed linked to the right library.
Comment by Toolybird (Toolybird) - Thursday, 02 November 2023, 02:33 GMT
Just to highlight the difference (with DSOs renamed for clarity):

$ readelf -d libpython3.so-3.10.9-1-x86_64 | grep NEEDED
0x0000000000000001 (NEEDED) Shared library: [libpython3.10.so.1.0]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]

$ readelf -d libpython3.so-3.11.5-2-x86_64 | grep NEEDED
<empty>

> ArchLinuxARM version

Where can I find the PKGBUILD?
Comment by Yichao Yu (yuyichao) - Thursday, 02 November 2023, 02:40 GMT
I believe the PKGBUILD is here https://github.com/archlinuxarm/PKGBUILDs/blob/master/core/python/PKGBUILD . I have not tried comparing the source or tried to build it yet. I only checked my local installed version (3.11.3-2) and the latest version (http://mirror.archlinuxarm.org/aarch64/core/python-3.11.5-2-aarch64.pkg.tar.xz) which both have the correct linkage.
Comment by Toolybird (Toolybird) - Thursday, 02 November 2023, 03:25 GMT
From the build log at [1]. This bit looks a bit suss:

checking for -Wl,--no-as-needed... no

Edit: something is wrong with the autofoo. From config.log

cc1: error: unrecognized argument to '-flto=' option: 'auto-Wl,--no-as-needed'

[1] https://reproducible.archlinux.org/api/v0/builds/521885/log
Comment by Toolybird (Toolybird) - Thursday, 02 November 2023, 04:03 GMT Comment by Toolybird (Toolybird) - Thursday, 02 November 2023, 04:22 GMT
Attached is a quick'n'dirty patch. Could you please test it by rebuilding python and see if it resolves the issue?
Comment by Toolybird (Toolybird) - Thursday, 02 November 2023, 06:27 GMT
> Could you please test it

Don't worry. I've just built it with the patch and it does indeed solve the problem.

Loading...