3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-02 16:43:45 +00:00

Use native ARM64 manylinux2014 container for Python wheels

This change replaces cross-compilation with native ARM64 builds using
QEMU emulation. The manylinux2014_aarch64 container provides glibc 2.17
baseline, matching the x86_64 wheels and resolving the glibc ≥ 2.34
requirement issue on ARM64 platforms.

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-15 23:09:02 +00:00
parent af90b23ee1
commit d771032fed
2 changed files with 42 additions and 32 deletions

View file

@ -168,26 +168,31 @@ stages:
targetPath: $(Build.ArtifactStagingDirectory) targetPath: $(Build.ArtifactStagingDirectory)
- job: ManyLinuxPythonBuildArm64 - job: ManyLinuxPythonBuildArm64
displayName: "Python bindings (manylinux Centos ARM64 cross) build" displayName: "Python bindings (manylinux Centos ARM64) build"
timeoutInMinutes: 90 timeoutInMinutes: 90
variables:
name: ManyLinux
python: "/opt/python/cp37-cp37m/bin/python"
pool: pool:
vmImage: "ubuntu-latest" vmImage: "ubuntu-latest"
container: "quay.io/pypa/manylinux2014_x86_64:latest"
steps: steps:
- script: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz?rev=33c6e30e5ac64e6dba8f0431f2c35f1b&hash=9918A05BF47621B632C7A5C8D2BB438FB80A4480' - script: |
- script: mkdir -p /tmp/arm-toolchain/ sudo apt-get update
- script: tar xf /tmp/arm-toolchain.tar.xz -C /tmp/arm-toolchain/ --strip-components=1 sudo apt-get install -y qemu-user-static
- script: "/opt/python/cp38-cp38/bin/python -m venv $PWD/env" displayName: "Install QEMU for ARM64 emulation"
- script: 'echo "##vso[task.prependpath]$PWD/env/bin"' - script: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/bin' displayName: "Register QEMU"
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/aarch64-none-linux-gnu/libc/usr/bin' - script: |
- script: echo $PATH docker run --rm -v $(pwd):/workspace -w /workspace \
- script: "stat `which aarch64-none-linux-gnu-gcc`" quay.io/pypa/manylinux2014_aarch64:latest \
- script: "pip install build git+https://github.com/rhelmot/auditwheel" bash -c "/opt/python/cp38-cp38/bin/python -m venv /workspace/env && \
- script: "cd src/api/python && CC=aarch64-none-linux-gnu-gcc CXX=aarch64-none-linux-gnu-g++ AR=aarch64-none-linux-gnu-ar LD=aarch64-none-linux-gnu-ld Z3_CROSS_COMPILING=aarch64 python -m build && AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && cd ../../.." source /workspace/env/bin/activate && \
pip install build git+https://github.com/rhelmot/auditwheel && \
cd src/api/python && \
python -m build && \
AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && \
cd ../../.. && \
pip install ./src/api/python/wheelhouse/*.whl && \
python - <src/api/python/z3test.py z3 && \
python - <src/api/python/z3test.py z3num"
displayName: "Build and test ARM64 wheel"
- task: CopyFiles@2 - task: CopyFiles@2
inputs: inputs:
sourceFolder: src/api/python/wheelhouse sourceFolder: src/api/python/wheelhouse

View file

@ -172,26 +172,31 @@ stages:
targetPath: $(Build.ArtifactStagingDirectory) targetPath: $(Build.ArtifactStagingDirectory)
- job: ManyLinuxPythonBuildArm64 - job: ManyLinuxPythonBuildArm64
displayName: "Python bindings (manylinux Centos ARM64 cross) build" displayName: "Python bindings (manylinux Centos ARM64) build"
timeoutInMinutes: 90 timeoutInMinutes: 90
variables:
name: ManyLinux
python: "/opt/python/cp37-cp37m/bin/python"
pool: pool:
vmImage: "ubuntu-latest" vmImage: "ubuntu-latest"
container: "quay.io/pypa/manylinux2014_x86_64:latest"
steps: steps:
- script: curl -L -o /tmp/arm-toolchain.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/11.2-2022.02/binrel/gcc-arm-11.2-2022.02-x86_64-aarch64-none-linux-gnu.tar.xz?rev=33c6e30e5ac64e6dba8f0431f2c35f1b&hash=9918A05BF47621B632C7A5C8D2BB438FB80A4480' - script: |
- script: mkdir -p /tmp/arm-toolchain/ sudo apt-get update
- script: tar xf /tmp/arm-toolchain.tar.xz -C /tmp/arm-toolchain/ --strip-components=1 sudo apt-get install -y qemu-user-static
- script: "/opt/python/cp38-cp38/bin/python -m venv $PWD/env" displayName: "Install QEMU for ARM64 emulation"
- script: 'echo "##vso[task.prependpath]$PWD/env/bin"' - script: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/bin' displayName: "Register QEMU"
- script: echo '##vso[task.prependpath]/tmp/arm-toolchain/aarch64-none-linux-gnu/libc/usr/bin' - script: |
- script: echo $PATH docker run --rm -v $(pwd):/workspace -w /workspace \
- script: "stat `which aarch64-none-linux-gnu-gcc`" quay.io/pypa/manylinux2014_aarch64:latest \
- script: "pip install build git+https://github.com/rhelmot/auditwheel" bash -c "/opt/python/cp38-cp38/bin/python -m venv /workspace/env && \
- script: "cd src/api/python && CC=aarch64-none-linux-gnu-gcc CXX=aarch64-none-linux-gnu-g++ AR=aarch64-none-linux-gnu-ar LD=aarch64-none-linux-gnu-ld Z3_CROSS_COMPILING=aarch64 python -m build && AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && cd ../../.." source /workspace/env/bin/activate && \
pip install build git+https://github.com/rhelmot/auditwheel && \
cd src/api/python && \
python -m build && \
AUDITWHEEL_PLAT= auditwheel repair --best-plat dist/*.whl && \
cd ../../.. && \
pip install ./src/api/python/wheelhouse/*.whl && \
python - <src/api/python/z3test.py z3 && \
python - <src/api/python/z3test.py z3num"
displayName: "Build and test ARM64 wheel"
- task: CopyFiles@2 - task: CopyFiles@2
inputs: inputs:
sourceFolder: src/api/python/wheelhouse sourceFolder: src/api/python/wheelhouse