pypa / cibuildwheel

🎡 Build Python wheels for all the platforms with minimal configuration.
https://cibuildwheel.pypa.io
Other
1.78k stars 227 forks source link

arm32 / armv7l wheels #1421

Open modem7 opened 1 year ago

modem7 commented 1 year ago

Description

Is there a way to build for arm32v7?

I looked at the documentation, but I could only see references to arm64.

Specifically, I'm looking to build for arm32 on alpine, with Python 3.11.

Thanks in advance!

henryiii commented 1 year ago

There's no manylinux image for arm32v7, so no. You can see the discussion in https://github.com/pypa/manylinux/discussions/1405. I think the main problem is there isn't an upstream distribution of the base images for manylinux for armv7. But I haven't looked into it.

The piwheels project builds wheels for armv7, but they probably don't work across other OSs, especially not a musl-based one. Actually, I wonder if supporting armv7 only in musllinux would be easier...

bigcat88 commented 1 year ago

Even ability to build only musllinux_1_2_armv7l tag will be a great option (Alpine 3.13+) for me.

Czaki commented 1 year ago

We understand, but it requires someone who will maintain a proper docker image. And such maintenance is out of the scope of cibuildwheel (we depend here on manylinux).

If you could provide such a contribution to manylinux or in another place that could promise maintenance then adding support to cibuildwheel should not be a problem.

henryiii commented 1 year ago

If alpine has a armv7 build, it might be an easy contribution to make to manylinux (musllinux lives in the pypa/manylinux repo).

modem7 commented 1 year ago

If alpine has a armv7 build, it might be an easy contribution to make to manylinux (musllinux lives in the pypa/manylinux repo).

It certainly does!

V6 and V7 (alongside 386, s390x and their 64bit brethren (like v8) also).

mayeut commented 1 year ago

I had quick look at adding armv7l to musllinux_1_1 in https://github.com/pypa/manylinux/pull/1455. While the image could probably be built in 32-bit mode on AWS graviton with travis-ci, uname -m reports armv8l rather than armv7l which might have undesirable side-effects, mostly, python will probably label wheels as armv8l rather than armv7l (not tested). Building an image with qemu is a no-go.

If you're aiming at building executables rather than a python extension, you most likely can build it using a python:3.11-alpine image (https://github.com/mayeut/patchelf-pypi uses this trick to build statically linked executable of patchelf that works on musllinux/manylinux with a single build). You can cheat your way into building armv7l executables this way (cibuildwheel does not check the architecture - yet ? - so you can use an armv7 image as an option to musllinux-x86_64-image, #1409 might be relevant to ease setup for armv7 while not providing a default image).

If this does not apply for your use-case, as mentioned by @henryiii, I invite you to comment on https://github.com/pypa/manylinux/discussions/1405.

bjia56 commented 5 months ago

I have a container image for building armv7l wheels, inspired by the contents of existing manylinux images: https://github.com/bjia56/armv7l-wheel-builder

This image was originally built to fill the gap of what cibuildwheel can support, since the projects I worked on required supporting 32bit raspberry pi. While I can't promise long term support to offer it up as a cibuildwheel option, perhaps folks here might find it useful.