-
Notifications
You must be signed in to change notification settings - Fork 239
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
Seamless ARM builds using emulation through qemu docker images #364
Comments
Could this be done for other arch's, like arm 32? Since those currently are Travis only, AFAICT. |
you can emulate almost any platform, bitness this way. Ofc, speed is an issue. |
Travis CI does provide ARM64 (and we support it): https://docs.travis-ci.com/user/multi-cpu-architectures/#testing-on-multiple-cpu-architectures
So you don't need the actual hardware? Do you have an example to play around with?
Yes, and we support it if there's a CI offering it, like Travis CI
Yes, I believe so, but only to distinguish between Linux, macOS, and Windows. The architecture is detected with
Ah, so it's still not running on ARM, but doing cross-compilation? Quite similar to https://github.com/dockcross/dockcross/, then? Or how does it work? The manylinux wheels need to be built inside a docker image, though. Is it possible to run these docker images inside of one of these docker images for other architectures?
As laid out above, it'll mostly depend on
Depends a bit on the whole setup. If things work, at first, I could imagine making sure cibuildwheel picks up the correct platform and architecture, etc, and leaving up the setup of the outer docker images to users. Then, as a next step, if it's possible to automate, I could envision |
that's really cool! 👍 Unfortunately, we've recently migrated to GH Actions, which don't.
yes, you don't need. That's the point of the emulation:
great, I think this will tell
similar, but it is really runing on ARM64 (the normal aarch64 OS image can be used), just SW emulated.
exactly. It should work as
Cool, I'm happy you see potential of the idea!
About CIBW fork, I'm not sure I'll have time to dig deep into another (new for me) project now, but I can be of any help with docker x84/arm here. |
To run the above example, please try:
|
Thanks, that's great news! If I have some time, I'll play around with things a bit, but if it's this easy, there's a chance you could just |
I think there might not be many or any changes in cibuildwheel, since this is already supported on travis; and I think travis also emulates this, doing something similar internally. I would love to be able to build for all arch's on GHA. :) |
Indeed. The one thing I'm thinking of is that we might need to make sure some environment variables are transferred. |
you'd still have to create the Dockerfile and know about docker and run the
Since CIBW aims to "make it easy" for all the builds (it already handles python interpreters/versions, which many CI already support), I'd think ability to build for many archs (aarm64, i686, arm32, ...any supported by manylinux2014) this might actually be some useful feature.
might be an issue, we could pass select variables to the docker image. Maybe there's a way to mirror all env vars? |
We'll need to see how things go. Step by step.
Sure. Not saying it's a problem. I'm saying it's the first thing that comes to mind on what might not immediately work out of the box. |
@YannickJadoul and others. We're building ARM64 wheels on Github Actions with two self hosted runners on ec2 a1.xlarge instances running Ubuntu 18.04 lts. Example workflow: https://github.com/Chia-Network/bls-signatures/blob/master/.github/workflows/build-aarch64.yml It's a decent temporary workaround until we have Github Hosted ARM. |
Well, this is an open source project. So it's great to hear that things are working beyond what's officially supported in cibuildwheel, but we can't really test it until GitHub actions offers ARM64 support :-/ |
That's an open source project too - Apache 2.0. Now we can afford to run ARM64 ec2 instances for corporate sponsorship reasons. There are folks offering arm runners for free. Worth googling. Also, my point wasn't about cibuildwheel - it was more for folks trying to build ARM wheels until we all have github hosted runners for ARM. Sorry to cause confusion. |
Oh, right, I see. Sorry for misunderstanding; that's interesting indeed! :-)
Sorry, got that wrong, then! |
Would it be possible to cross compile wheels using something like these images? https://github.com/dockcross/dockcross I haven't looked into this yet, just wondering if anyone else has? |
In PyTables/PyTables#823, @amotl mentioned https://github.com/marketplace/actions/run-on-architecture - this might be perfect for this? I might have time to test it (dealing with a Dec 1 deadline currently for a package). |
By the way, I've attempted this here, and I ran into:
Since this is already running in a container, should I try to keep going and try to get docker to run inside the image? |
If you know how to do it, sure, but if I recall, running docker in docker isn't too trivial? |
Edit: Please see PR #469 Forgive me if I am missing something, but isn't this straightforward given what is in this blog post? https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux/ Seeing as cibuildwheel fires up docker instances, and the images already exist, can we not add a qemu flag to the desired architectures we want to build wheels for, and do the required QEMU/binfmt setup in the initialisation stage as well?
|
Hey nowadays, there's even an action to enable QEMU for us: docker/setup-qemu-action 🚂 , let me try it out |
I'm not sure this is in scope of the project, but it would be a unique functionality, since you aim to create a truly multiplatform wheels.
Situation:
arm
onamd64
HW.pypa/manylinux2014
already supports arm* docker images (for building wheels)os.platform
to build the wheels (?)Here's an example how we build for ARM on x86_64 HW in CI:
https://github.com/htm-community/htm.core/blob/master/.github/workflows/arm.yml
and the Dockerfile:
https://github.com/htm-community/htm.core/blob/master/Dockerfile
The CIBW wheels are built here
https://github.com/htm-community/htm.core/blob/master/.github/workflows/release.yml#L96
for the list of platforms
https://github.com/htm-community/htm.core/blob/master/.github/workflows/release.yml#L17
Workaround/solution:
[ubuntu-latest, ubuntu-18.04]
and spin docker if the "hack" OS is ran:if: matrix.os == 'ubuntu-latest'
run docker and emulate ARM64.Would then CIBW pick up the ARM platform for
manylinux2014
? https://github.com/pypa/manylinux#manylinux2014Do you see a more elegant way to integrate this?
The text was updated successfully, but these errors were encountered: