hugoledoux / startinpy

A Python library for modelling and processing 2.5D terrains using a (2D) Delaunay triangulation.
https://startinpy.rtfd.io/
MIT License
25 stars 6 forks source link

CI: Add Linux aarch64 target #7

Closed EwoutH closed 2 years ago

EwoutH commented 2 years ago

This PR contains two commits:

Linux aarch64 wheels are nice for people using ARMv8 systems, like Raspberry Pi's and such. I also tried Windows Arm64 builds, but those failed unfortunately.

messense commented 2 years ago

Actually Raspberry Pi by default uses 32 bit OS, so it's better to also provide armv7l wheels. Its Rust target is armv7-unknown-linux-gnueabihf.

EwoutH commented 2 years ago

The Raspberry Pi 3 and 4 do both support Aarch64 though, and especially the 4 often uses is as OS. It's also a Tier 1 platform, but adding ARMv7 could still be useful for some people.

I added the armv7-unknown-linux-gnueabihf target in 0899be2.

messense commented 2 years ago

Oops, the current approach seems wrong, pyo3 needs PYO3_CROSS_LIB_DIR env var to do cross compilation: https://pyo3.rs/v0.15.0/building_and_distribution.html#cross-compiling , so we need to split cross compilation jobs like this: https://github.com/milesgranger/pyrus-cramjam/blob/9692a1389d590a6eb499c87df4efbcdebccb4a25/.github/workflows/CI.yml#L153-L174

Or if startinpy is compatible with ABI3, it can be much easier: https://github.com/messense/rjieba-py/blob/d539cb7b85244cf2ec60d3b27a3a035e7b903539/.github/workflows/CI.yml#L108-L123

messense commented 2 years ago

BTW, you need to upgrade to pyo3 0.13 or later versions to support cross compilation.

https://github.com/hugoledoux/startinpy/blob/4e1c83bb1b45a37fc84dda8dc0a7c824cbb31a9a/Cargo.toml#L19-L21

EwoutH commented 2 years ago

I removed the last commit, it now just adds aarch64 on Linux as the original PR intended. Lets get this in first and then figure out 32-bit builds in a next PR.

@hugoledoux ready for review

messense commented 2 years ago

I suspect it's not going to work for aarch64 wheel, it may contain a x86_64 .so file in it. I suggest try to add a run-on-arch step to verify it's importable, see https://github.com/messense/rjieba-py/blob/d539cb7b85244cf2ec60d3b27a3a035e7b903539/.github/workflows/CI.yml#L124-L142

Edit: Opened https://github.com/PyO3/maturin/issues/679 to track the potential issue.

EwoutH commented 2 years ago

@messense I understand, thanks for looking into this! I will mark this PR as draft until PyO3/maturin#679 is resolved.

messense commented 2 years ago

BTW, you need to upgrade to pyo3 0.13 or later versions to support cross compilation.

https://github.com/hugoledoux/startinpy/blob/4e1c83bb1b45a37fc84dda8dc0a7c824cbb31a9a/Cargo.toml#L19-L21

Try upgrade to pyo3 0.15.0 first, I think https://github.com/PyO3/maturin/issues/679 is already covered in pyo3.