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

Binary wheels for armv6 #64

Closed
JEnoch opened this issue May 24, 2022 · 10 comments
Closed

Binary wheels for armv6 #64

JEnoch opened this issue May 24, 2022 · 10 comments
Labels
help wanted Extra attention is needed new feature Something new is needed

Comments

@JEnoch
Copy link
Member

JEnoch commented May 24, 2022

Describe the feature

zenoh-python relies on pypa/cibuildwheel to build the binary wheels that are released on pypi.org.
However it doesn't support armv6 and armv7 architectures. The reason being there is no manylinux image available for armv6 nor armv7.

EDIT 2022-06-08:
Thanks to #66 an armv7 wheel is now built. The build now relies on messense/maturin-action which doesn't provide a solution for armv6.

@JEnoch JEnoch added the help wanted Extra attention is needed label May 24, 2022
@JEnoch
Copy link
Member Author

JEnoch commented May 24, 2022

For Raspberry Pi, an alternative could have been to rely on the piwheels project. Unfortunately its infrastructure relies on Debian's Rust which is 1.48 and is too old to build some of the zenoh dependencies (see piwheels/packages#263)

@JEnoch
Copy link
Member Author

JEnoch commented May 24, 2022

The ideal solution would be to create a custom manylinux image for armv6 and armv7.
But that looks challenging looking at the long standing discussion in pypa/manylinux#84.

Another solution suggested on zenoh Discord by CircleOWO:

We once built the zenoh rust on RPi by cross-compiling with the toolchain armv7-unknown-linux-musleabihf.
I can confirm PyO3 can build up zenoh-python in wheel package for ARMv7 through musl, but the problem is python wheel doesn't support musl on RPi. So even you can build it, you can't install it in on your RPi.
So there's another solution for the cross-compiling, you need to build zenoh-python by the tool chain armv7-unknown-linux-gnueabihf and try to pack it to a manylinux wheel. But this comes with other difficulties since the glibc version on your RPi may be mismatched with your host machine, which may take some time to resolve it.

@YuanYuYuan
Copy link
Contributor

YuanYuYuan commented Jun 3, 2022

Hi, @JEnoch, I proposed a PR #66 to resolve this issue. It is a breaking change in the workflows of CI/Release. Any comments are welcome.
BTW, I had checked the building parts in CI and release. But haven't checked the publishment since I don't have permission. So this part may need your help. Thanks!

@JEnoch JEnoch closed this as completed in 2e291a9 Jun 8, 2022
@JEnoch JEnoch reopened this Jun 8, 2022
@JEnoch
Copy link
Member Author

JEnoch commented Jun 8, 2022

Thanks @YuanYuYuan ! I tested your solution and it works well (see results here: https://pypi.org/project/eclipse-zenoh-nightly/0.6.0.dev20220608/#files). The armv7 wheel works at least in a arm32v7/ubuntu Docker container.

So I merged you PR, and Github automatically closed this ticket (as the commit includes "resolve #64").
I re-open and update this ticket for the armv6 case that still needs a solution, since messense/maturin-action doesn't yet provide an armv6 Docker container.

@JEnoch JEnoch changed the title Binary wheels for armv6 and armv7 Binary wheels for armv6 Jun 8, 2022
@YuanYuYuan
Copy link
Contributor

Thanks.

@messense
Copy link

messense commented Jun 20, 2022

I've added linux armv6l support in PyO3/maturin#966, although we don't have a docker image for maturin-action, I do have a arm-unknown-linux-gnueabihf cross compiler for macOS in https://github.com/messense/homebrew-macos-cross-toolchains that you can try on macos-latest GitHub Actions runners.

brew tap messense/macos-cross-toolchains
brew install arm-unknown-linux-gnueabihf

export CC_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-gcc
export CXX_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-g++
export AR_arm_unknown_linux_gnueabihf=arm-unknown-linux-gnueabihf-ar
export CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-unknown-linux-gnueabihf-gcc

pip3 install maturin
maturin build --release --target arm-unknown-linux-gnueabihf --out dist

@YuanYuYuan
Copy link
Contributor

YuanYuYuan commented Jun 20, 2022

@messense, thanks for your great help!

From our experience, cross-compiling through gnueabihf has the potential glibc version mismatch between the host and the target. @JEnoch can we figure out the glibc version used in supported armv6l platforms?

@messense
Copy link

FYI, that toolchain is built for glibc 2.17.

https://github.com/messense/homebrew-macos-cross-toolchains/blob/a81b3d935169f4ef18e9777e12ab6ef3397db2fa/arm-unknown-linux-gnueabihf/.config#L438

@JEnoch
Copy link
Member Author

JEnoch commented Jun 21, 2022

I think all armv6 use cases we saw were "old" Raspberry Pis such as RPi Zero W or RPi 1-B.
The oldest Raspberry OS was based on Debian Wheezy that uses glibc 2.13.
But then (in 2015) Jessie-based Raspberry OS came with glibc 2.19.

So I think supporting glibc 2.17 is very fine since for the vast majority of those old hardware their users already moved (or are able to move) to Jessie or even more recent Raspberry OS.

Thanks @messense for your great support! We'll try your cross toolchain on GitHub Actions ASAP.

@JEnoch
Copy link
Member Author

JEnoch commented Jun 22, 2022

I confirm that the wheel built with arm-unknown-linux-gnueabihf cross-compiler works well on Raspberry Pi Zero W (ARMv6Z) with latest Raspberry Pi OS (glibc 2.31). 🎉
PR coming...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed new feature Something new is needed
Projects
None yet
Development

No branches or pull requests

3 participants