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

ARM64 Manylinux wheels #5

Closed
a-hurst opened this issue May 20, 2021 · 4 comments · Fixed by #8
Closed

ARM64 Manylinux wheels #5

a-hurst opened this issue May 20, 2021 · 4 comments · Fixed by #8

Comments

@a-hurst
Copy link
Owner

a-hurst commented May 20, 2021

As per #2, it would be nice to have manylinux ARM wheels given the popularity of devices like the RPi and the advent of systems like the Pinebook Pro.

If Cirrus CI ever gets native ARM container support adding this would be trivial, but until then it would require using QEMU in some capacity (cibuildwheel has examples on how to set this up with GitHub Actions, will need to see if that translates at all to Cirrus). Alternatively, I could just run the manylinux build script in the arm64 manylinux docker image locally via QEMU for releases but that would be a pain to maintain.

@fkorotkov
Copy link

You can do multi-arch build on Cirrus via QEMU https://cirrus-ci.org/guide/docker-builder-vm/#multi-arch-builds

This might help until we have native ARM containers as you mentioned.

@a-hurst
Copy link
Owner Author

a-hurst commented Jun 1, 2021

That's awesome @fkorotkov, thanks for pointing me in the right direction! If I have a pre-existing ARM64 docker image I want to use (the official Python quay.io/pypa/manylinux2014_aarch64 image in my case), would there be anything special I'd need to do to use it, or should it work seamlessly already via Docker's QEMU?

EDIT: Gave it a shot, but got an immediate error on VM startup:

Error starting command: fork/exec /usr/bin/bash: exec format error

I'm assuming there's some step I'm missing that sets up the Docker runner in Cirrus to support QEMU emulation?

@fkorotkov
Copy link

Yeah, only docker_builder support QEMU for now. But we might take a look at running arm containers the same way as we run privileged and KVM enabled ones: via running it in a separate VM. This will affect startup time but I think it might be a good workaround until GCP has ARM instances. Please follow cirruslabs/cirrus-ci-docs#218 for updates. I'll take a look into this in the next few days.

@a-hurst
Copy link
Owner Author

a-hurst commented Jun 3, 2021

@fkorotkov I managed to get it working with a little wrangling! It's not pretty, and it's as slow as you'd expect for emulation, but it seems to work nonetheless. Here's what I did with the .yml:

# Build 64-bit ARM manylinux wheel
task:
  name: "Build $SDL2DLL_PLATFORM (ARM64) wheel"

  env:
    matrix:
      - SDL2DLL_PLATFORM: manylinux_2_24

  compute_engine_instance:
    image_project: cirrus-images
    image: family/docker-builder
    platform: linux
    cpu: 4
    memory: 4G

  script:
    - docker pull quay.io/pypa/manylinux_2_24_aarch64
    - docker run --rm -e SDL2DLL_PLATFORM=manylinux_2_24 -v `pwd`:/io --platform arm64 quay.io/pypa/manylinux_2_24_aarch64 /io/manylinux.sh

  binaries_artifacts:
    path: "dist/*"

For whatever the environment variables aren't working (I had to sub in manylinux_2_24 instead of $SDL2DLL_PLATFORM in the docker commands), but otherwise everything else is fine.

An improved API for this would be wonderful though! Maybe something along the lines of:

  container:
    image: quay.io/pypa/$SDL2DLL_PLATFORM_aarch64
    architecture: arm64
    memory: 4G

or alternatively emulation: arm64 if you want to make it explicit that the architecture is being emulated and not run natively.

Thanks again for reaching out!

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

Successfully merging a pull request may close this issue.

2 participants