Skip to content

[BUG] cross compiling 3.15 abi3 wheels fails due to new multiarch support #5351

Closed

Description

@vfazio

setuptools version

80.9.0

Python version

Python 3.15

OS

Linux (Buildroot)

Additional environment information

This is in buildroot builds which is slightly complicated but we can get into that if necessary

Description

When building the https://github.com/pyca/pynacl package in buildroot, we may have to cross compile for a foreign architecture.

when doing so, we use host python but feed a lot of environment information to denote the cross environment:

>>> python-pynacl 1.6.2 Extracting
gzip -d -c /home/vfazio/development/buildroot/dl/python-pynacl/pynacl-1.6.2.tar.gz | tar --strip-components=1 -C /home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/build/python-pynacl-1.6.2   -xf -
>>> python-pynacl 1.6.2 Patching
>>> python-pynacl 1.6.2 Configuring
>>> python-pynacl 1.6.2 Building
(cd /home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/build/python-pynacl-1.6.2//; _PYTHON_HOST_PLATFORM="linux-arm" _PYTHON_PROJECT_BASE="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/build/python3-3.15.0" _PYTHON_SYSCONFIGDATA_NAME="`{ [ -e /home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/arm-buildroot-linux-musleabi/sysroot/usr/lib/python3.15//_sysconfigdata__linux_*.py ] && basename /home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/arm-buildroot-linux-musleabi/sysroot/usr/lib/python3.15//_sysconfigdata__linux_*.py .py; } || true`" PATH="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin:/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" GIT_DIR=. PATH="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin:/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" AR="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gcc-ar" AS="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-as" LD="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-ld" NM="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gcc-nm" CC="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gcc" GCC="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gcc" CPP="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-cpp" CXX="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-g++" FC="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gfortran" F77="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gfortran" RANLIB="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gcc-ranlib" READELF="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-readelf" STRIP="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-strip" OBJCOPY="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-objcopy" OBJDUMP="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-objdump" AR_FOR_BUILD="/usr/bin/ar" AS_FOR_BUILD="/usr/bin/as" CC_FOR_BUILD="/usr/bin/gcc" GCC_FOR_BUILD="/usr/bin/gcc" CXX_FOR_BUILD="/usr/bin/g++" LD_FOR_BUILD="/usr/bin/ld" CPPFLAGS_FOR_BUILD="-I/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/include" CFLAGS_FOR_BUILD="-O2 -I/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/include" CXXFLAGS_FOR_BUILD="-O2 -I/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/include" LDFLAGS_FOR_BUILD="-L/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/lib -Wl,-rpath,/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/lib" FCFLAGS_FOR_BUILD="" DEFAULT_ASSEMBLER="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-as" DEFAULT_LINKER="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-ld" CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -O2 -g0 " CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -O2 -g0 " LDFLAGS="" FCFLAGS=" -O2 -g0" FFLAGS=" -O2 -g0" PKG_CONFIG="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/pkg-config" STAGING_DIR="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/arm-buildroot-linux-musleabi/sysroot" INTLTOOL_PERL=/usr/bin/perl PYTHONPATH="/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/arm-buildroot-linux-musleabi/sysroot/usr/lib/python3.15/" PYTHONNOUSERSITE=1 SODIUM_INSTALL=system /home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/python3 -m build -n -w )

When the build_ext phase runs, we see this:

running build_ext
generating cffi module 'build/temp.linux-arm-cpython-315/_sodium.c'
creating build/temp.linux-arm-cpython-315
building '_sodium' extension
creating build/temp.linux-arm-cpython-315/build/temp.linux-arm-cpython-315
/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gcc -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -I/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/build/python3-3.15.0/Include -I/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/build/python3-3.15.0 -c build/temp.linux-arm-cpython-315/_sodium.c -o build/temp.linux-arm-cpython-315/build/temp.linux-arm-cpython-315/_sodium.o
/home/vfazio/development/buildroot/output/TestPythonPy3Pynacl/host/bin/arm-linux-gcc -shared -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g0 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 build/temp.linux-arm-cpython-315/build/temp.linux-arm-cpython-315/_sodium.o -L. -lsodium -o build/lib.linux-arm-cpython-315/nacl/_sodium.abi3-x86_64-linux-gnu.so
installing to build/bdist.linux-arm/wheel
running install

While the compiler invoked is correct (arm) the generated library has the wrong architecture (x86_64).

I think this is due to https://github.com/pypa/setuptools/blob/main/setuptools/command/build_ext.py#L79

this line is looking for .abi3 but after python/cpython#152461 landed, the multiarch abi3 entry is enumerated first:

>>> import importlib.machinery
>>> importlib.machinery.EXTENSION_SUFFIXES
['.cpython-315-x86_64-linux-gnu.so', '.abi3-x86_64-linux-gnu.so', '.abi3.so', '.abi3t-x86_64-linux-gnu.so', '.abi3t.so', '.so']

This was backported to 3.15: python/cpython#154772

So this function now returns an incompatible string for the name of the shared/static library that gets generated.

Expected behavior

The target architecture should be specified in the generated shared library or it should be agnostic and not specify the multiarch name.

How to Reproduce

clone buildroot

I'm tracking some of this migration in https://gitlab.com/buildroot.org/buildroot/-/work_items/193

Output

Activity

  1. added
    Needs TriageIssues that need to be evaluated for severity and status.
    on Oct 16, 2026
  2. vfazio commented on Oct 16, 2026

    @vfazio
    ContributorAuthor
  3. vfazio commented on Oct 16, 2026

    @vfazio
    ContributorAuthor

    I guess if we fix logic around this, there may also be considerations for abi3t

  4. vfazio commented on Oct 16, 2026

    @vfazio
    ContributorAuthor

    dynload_shlib::_PyImport_DynLoadFiletab defines these values.

    Changing the pattern to .abi3. fixes my immediate problem but has the downside of not allowing multiarch wheels to be generated.

  5. added a commit that references this issue on Oct 16, 2026
    dfd04e8
  6. jameshilliard commented on Oct 16, 2026

    @jameshilliard
    Contributor

    I think something like #5352 should fix this properly.

  7. added 3 commits that reference this issue on Oct 16, 2026
    3c3a334
    28b1988
    97b75e6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions