Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cp38-macosx_arm64 produces a x86_64 wheel #2080

Open
ns-yanghsing opened this issue Nov 13, 2024 · 4 comments
Open

cp38-macosx_arm64 produces a x86_64 wheel #2080

ns-yanghsing opened this issue Nov 13, 2024 · 4 comments

Comments

@ns-yanghsing
Copy link

Description

I'm building a library wrapping c++ code on macos with Github Action.
In the cp38-macosx_arm64 (os: macos-14) build, the "Building wheel" step went through, but the "Repairing wheel" step failed with

  delocate.libsana.DelocationError: Failed to find any binary with the required architecture: 'x86_64'

The issue only occurs on cp38 where cp39-macosx_arm64 went through without problems.

Here's the log for "building wheel", which passed but seemed to produce a x86_64 wheel for an arm64 build:

+ python -m pip wheel /Users/runner/work/py_jwt_cpp/py_jwt_cpp --wheel-dir=/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/built_wheel --no-deps
  Processing /Users/runner/work/py_jwt_cpp/py_jwt_cpp
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
    Preparing metadata (pyproject.toml): started
    Preparing metadata (pyproject.toml): finished with status 'done'
  Building wheels for collected packages: py_jwt_cpp
    Building wheel for py_jwt_cpp (pyproject.toml): started
    Building wheel for py_jwt_cpp (pyproject.toml): still running...
    Building wheel for py_jwt_cpp (pyproject.toml): finished with status 'done'
    Created wheel for py_jwt_cpp: filename=py_jwt_cpp-0.1.0-cp38-cp38-macosx_14_0_x86_64.whl size=66406 sha256=3a67c0ae39221cb61d1971c5e9e082752298ebf34dd2abe2a18b95f34350f363
    Stored in directory: /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/pip-ephem-wheel-cache-cankgeva/wheels/24/a5/8d/764d337a233749b5593943775402d69ea2e[128](https://github.com/ns-yanghsing/py_jwt_cpp/actions/runs/11810912790/job/32903660483#step:6:132)85755535c006
  Successfully built py_jwt_cpp

And here's the "Repairing" log looking for an x86_64 one for an arm64 build:

+ delocate-wheel --require-archs arm64 -w /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/repaired_wheel -v /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/built_wheel/py_jwt_cpp-0.1.0-cp38-cp38-macosx_14_0_x86_64.whl
  INFO:delocate.delocating:Copying library /opt/homebrew/Cellar/openssl@3/3.3.2/lib/libssl.3.dylib to py_jwt_cpp/.dylibs/libssl.3.dylib
  INFO:delocate.delocating:Copying library /opt/homebrew/Cellar/openssl@3/3.3.2/lib/libcrypto.3.dylib to py_jwt_cpp/.dylibs/libcrypto.3.dylib
  INFO:delocate.delocating:Modifying install name in py_jwt_cpp/jwt_cpp.cpython-38-darwin.so from /opt/homebrew/opt/openssl@3/lib/libssl.3.dylib to @loader_path/.dylibs/libssl.3.dylib
  INFO:delocate.delocating:Modifying install name in py_jwt_cpp/jwt_cpp.cpython-38-darwin.so from /opt/homebrew/opt/openssl@3/lib/libcrypto.3.dylib to @loader_path/.dylibs/libcrypto.3.dylib
  INFO:delocate.delocating:Modifying install name in py_jwt_cpp/.dylibs/libssl.3.dylib from /opt/homebrew/Cellar/openssl@3/3.3.2/lib/libcrypto.3.dylib to @loader_path/libcrypto.3.dylib
  Fixing: /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/built_wheel/py_jwt_cpp-0.1.0-cp38-cp38-macosx_14_0_x86_64.whl
  Traceback (most recent call last):
    File "/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/build/venv/bin/delocate-wheel", line 8, in <module>
      sys.exit(main())
    File "/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/build/venv/lib/python3.8/site-packages/delocate/cmd/delocate_wheel.py", line 116, in main
      copied = delocate_wheel(
    File "/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/build/venv/lib/python3.8/site-packages/delocate/delocating.py", line 1090, in delocate_wheel
      out_wheel_fixed = _check_and_update_wheel_name(
    File "/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/build/venv/lib/python3.8/site-packages/delocate/delocating.py", line 914, in _check_and_update_wheel_name
      new_name, problematic_files = _calculate_minimum_wheel_name(
    File "/private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/build/venv/lib/python3.8/site-packages/delocate/delocating.py", line 848, in _calculate_minimum_wheel_name
      raise DelocationError(
  delocate.libsana.DelocationError: Failed to find any binary with the required architecture: 'x86_64'
  Error: Command delocate-wheel --require-archs arm64 -w /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/repaired_wheel -v /private/var/folders/g6/rgtlsw6n123b0gt5483s5_cm0000gn/T/cibw-run-b894xoq9/cp38-macosx_arm64/built_wheel/py_jwt_cpp-0.1.0-cp38-cp38-macosx_14_0_x86_64.whl failed with code 1. 

And here's the github flow config:

name: Build

on: [push, pull_request]

jobs:
  build_wheels:
    name: Build wheels on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-14]
        # os: [ubuntu-latest, macos-13, macos-14]

    steps:
      - uses: actions/checkout@v4
        with:
          submodules: 'true'

      # Used to host cibuildwheel
      - uses: actions/setup-python@v5

      - name: Install cibuildwheel
        run: python -m pip install cibuildwheel==2.21.3

      - name: Set macOS deployment target
        if: startsWith(matrix.os, 'macos')
        run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1-2)" >> $GITHUB_ENV

      - name: Build wheels
        run: python -m cibuildwheel --output-dir wheelhouse
        env:
          CIBW_BEFORE_BUILD_LINUX: |
            if [ -f "/etc/alpine-release" ]; then
              apk add --no-cache openssl-dev
            else
              yum install -y openssl openssl-devel
            fi
          CIBW_BUILD: "cp39*"
          CIBW_SKIP: "pp*"
      - uses: actions/upload-artifact@v4
        with:
          name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
          path: ./wheelhouse/*.whl

Please see the build link here for details. Thanks!

Build log

No response

CI config

No response

@patrikhuber
Copy link

@ns-yanghsing Did you ever solve the issue or find a workaround? I think I'm seeing a related error in #2111.

@Czaki
Copy link
Contributor

Czaki commented Dec 11, 2024

@patrikhuber you need to setup python 3.8 using github actions setup-python action to setup python 3.8 on macos arm runner.

Official installer for python 3.8 don not support macos arm runner.

@long2ice
Copy link

So any solutions?

@Czaki
Copy link
Contributor

Czaki commented Dec 12, 2024

@long2ice follow the documentation https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64 and install python 3.8 using actions/setup-python@v5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants