-
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
Linux ARM64 wheel build with QEMU fails because cibuildwheel tries execute container in x86_64 mode #1771
Comments
I'm not sure why docker wouldn't try to run this image under emulation - that's what it does with the manylinux images, which are invoked the exact same way. Others might know more. I can offer a workaround though, CIBW_CONTAINER_ENGINE lets you specify extra arguments to the create call. This is a global option, so you'd have to invoke cibuildwheel twice, but you could do something like # build native wheels
cibuildwheel --archs auto .
# build aarch64
export CIBW_CONTAINER_ENGINE="docker; create_args: --platform linux/arm64/v8"
cibuildwheel --archs aarch64 . |
Thanks for the extremely fast response! :) So I tried it with this bash script with the default image (compilation would fail, but I want to see if at least the docker container works properly):
And even there it says for me
So it's using the offical image, the correct aarch64 also, but still tries to execute it as an amd image? EDIT: To clarify, it was not crashing immediatly as in the Github Action. It just won't be able to actually build the wheel later down the line because build dependencies are missing in the official image. As @joerick pointed out, it's able to still run this image because binfmt_misc will transparently run it through QEMU. But the important thing here is that the Github Action crashes instead. With your hint Is there any way to fix this without having to introduce separate build steps with this ~"hack"? I'd like that because in this job it's actually doing a 2 package (fastwarc + resiliparse), 3 OS (linux, windows, macos), 2 architectures (amd64,arm64) build and I don't want to introduce verbosity/complexity here.. :/ Interesting sideinfo:
EDIT: I guess something's going wrong here? :/ (i.e. it's missing |
I think that warning is saying that Docker is kinda confused that the image is a different arch to the machine arch. But it tries to run it anyway, and thanks to the binfmt_misc feature of the Linux kernel, it is emulated via QEMU. The confusing part here is that the behaviour is different on your image. Having said that, there is an argument that it's kinda a bug smell that Docker is producing this warning in normal use. I also don't see much downside in cibuildwheel adding a @mayeut is our resident manylinux expert, let's see what he thinks... |
Note that my example above was just forcing a local Linux & ARM64 build; in the actual repository, the one github action should ideally be able to cope with Linux/Mac/Windows + Arm64/AMD64. That's why I at least think one can not easily introduce a hardcoded I don't know exactly why the particular custom-built image is such a problem (if it is?). Adjusting the script above slightly to use that:
This will result in
So locally, it just works. For some reason, the github action does have problems. |
Inspecting the manifest (which docker will do to determine which image to actually pull), the one we built in a github action yields this:
Doing that on the official manylinux image interestingly shows no platform information at all:
So the diff is:
I think the point about the layer information could be because we left out all the metadata annotation (https://github.com/docker/metadata-action) but I'm unsure here; shouldn't be relevant after all. Could it be that using the official image works because docker will "blindly" pull that image (given there is only one image after all and that one does not even platform annotations) and only at execution time, through If that's the case, this is somewhat of a big missing feature since all custom built images with platform information could then lead to problems? |
I've just pushed #1792 to provide a better workaround for this issue. I think I'd like to see some evidence that it's a wider issue than just you before we make any bigger changes. The setting is pretty widely used. |
It's certainly reproducible on my GitHub actions pipeline. |
I've also just run into this issue here with a custom manylinux image: https://github.com/Cantera/pypi-packages/actions/runs/9979506048/job/27589540410#step:6:184 Let me know if I can help debug! |
It seems the difference is that the custom images are using a manifest list but manylinux images are not.
The issue might thus be multi-arch images (even if only one arch listed). |
I also just ran into this with the aarch64 image from here. Manifest for completeness:
|
Description
I'm currently working on a pull request (chatnoir-eu/chatnoir-resiliparse#34) enabling Linux ARM64 wheel builds for a certain package.
They use a special manylinux container since they need some other dependencies available in their build environment. I already prepared containers for both x86_64 and aarch64 that are available here (built from this Dockerfile and this workflow):
Trying both of these out locally works without a problem; I'm working on a Linux x86_64 machine and ran the aarch64 docker container through QEMU.
The wheel builds on Linux x86_64 work without a problem, but unfortunately the aarch64 one crashes: https://github.com/jonded94/chatnoir-resiliparse/actions/runs/8109883876/job/22165995057
It's correctly detecting that it wants to build aarch64 wheels now, correctly chooses the resiliparse-manylinux_2_28_aarch64 image but apparently tries to execute it in x86_64 mode:
no matching manifest for linux/amd64 in the manifest list entries
. This is also apparent through the executed docker command:['docker', 'create', '--env=CIBUILDWHEEL', '--env=SOURCE_DATE_EPOCH', '--name=cibuildwheel-b6474ae9-7c52-468f-96c7-d91c73f4ae12', '--interactive', '--volume=/:/host', 'ghcr.io/jonded94/resiliparse-manylinux_2_28_aarch64', '/bin/bash']
. Here, it should say--platform linux/arm64/v8
but that's missing.The workflow that executes these wheel builds is this one here: https://github.com/jonded94/chatnoir-resiliparse/blob/develop/.github/workflows/build-wheels.yml
Build log
https://github.com/jonded94/chatnoir-resiliparse/actions/runs/8109883876/job/22165995057
CI config
https://github.com/jonded94/chatnoir-resiliparse/blob/develop/.github/workflows/build-wheels.yml
The text was updated successfully, but these errors were encountered: