-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Handle meson based python-wheel #6454
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
Conversation
Note that this is not ready for testing yet... still early WIP, simply ported in a new PR my pending changes from my local branch. |
additional info:
|
Yup, on my radar, will add that indeed. Although I wonder if numpy 1.26.x might still work with older DSM considering the new meson I'm trying to build-up.
That should be the case from
The per depend fully-generated meson cross-file should now fix that. I had encountered that same issue with cmake long ago where the
Long story short, the meson had never received such enhancement as things we're working just fine. But that's no longer true with python wheels whereas with the python virtual environment things gets totally confused for meson. Thus the need to have a fully functional meson cross-file defining all library and include path properly. have a look at current This is now mostly working with meson, still have a few things to go through but getting there.
That's a current known issue with numpy. We need to force settin the long bit accordingly for
EDIT: with regards to cython (which I just hit) there must be an issue with the PATH although there may be a way to set them in the meson native file such as:
Anyhow, as usual thnx for your feedback, and work slowly progressing on this. EDIT2: It turns out that I have yet to empty the env now when invoking meson build, which is not the case yet. Although it does work for regular meson builds it wont for python-based meson wheel builds. next on my todo. |
@hgy59 having a proof of concept that does build sucessfully for both aarch64 and x64 using latest numpy 2.2.3. Although struggling with armv7 and evansport... I'll check if I can make 1.26.4 to work instead for the moment. |
@th0ma7, was looking at the errors which remain:
And found the following which may be useful if you've not already considered:
Hope they can assist... |
I believe I now have something functional, but unmaintainable as-is. The goodUsing normal
I can now sucesfully cross-compile for arm7, evansport and x64 for DSM-7.1 The badThere is a know bug in gcc<=10 with aarch64 that makes the compiler to segfault. I tried pretty much every possible alternatives of flags/disabling in the code but I wasn't able to workaround it. The uglyPart of my crusade at making meson-python build to work, I ended-up at one point to reproduce the normal meson+ninja build. Surprisingly, this ended-up allowing me to sucesfully build numpy for aarch64... Missing is then the (re)packaging in wheel format, which hapens to be the exact same process as "The good" as long as I re-use the exact same builddir (which I ended-up figuring out tonight). This really is ugly, but does work. This last commit a2068f5 was not tested on previously working x64, evansport and armv7. I'll let this rest for tonight. Good news is, we're probably much closer now... just need to tie-up the remaining loose-ends. |
@th0ma7 the wheels created from python/*/Makefile are not yet added to The |
Thnx for catching this up, will include this. I'm also looking at how to install numpy in the crossenv... I got an idea on how i could reuse the newly cross-compiled numpy wheel so it gets installed into the cross portion of the crossenv so it can then be made available for other wheels that depends on it. Lastly, also looking at adding flexibility to have different vendor managed meson (other than numpy use case where the source package provides its own modified meson.py) and skipping that meson+ninja part when no vendor managed meson is provided (i.e. being the default use case) All in all, taking shape but will require a few more spare cycles before reaching the finishing line... |
@th0ma7 another small issue popped up:
The original wheels in the index (pypi) are cross compiled (like |
@th0ma7 I have successfully built python311-wheels with added python/numpy and python/numpy_1.26 for aarch64-7.1 and armv7-7.1. It would be interresting to validate whether such wheels created with gcc 8.5 will run under DSM 6. I guess if the *.so files within the wheels do not reference GLBC > 2.20 functions, it might work. My background: I am trying to build a final homeassistant package with support for DSM 6. This will be homeassistant 2024.3.3 that depends on numpy 1.26.0. This version is available in the index for x86_64 and aarch64 only, and I will have to build it at least for armv7 and evansport (i686). To support armv7 in homeassistant 2025.1.4, it will be |
Maybe this is similar to msgpack where it can fit in both? |
That's a long shot! Not sure how i can help you though. I could reinstall my armv7 using a 6.2.4 image to try it out if that helps? |
I got some pretty cool code locally that allows installing cross-compiled numpy wheel into the crossenv to allow building scipy and others... But I faced one major major major problem, gcc version. For @hgy59 All in all, this would require bumping our minimal version to DSM-7.2. EDIT: I'll sleep on it... and probably upload my new code online to safeguard it just in case even though it will fail to build. |
Good news, I was able to create a workaround patch for aarch64 ... a few loose ends but looking much better now. |
@hgy59 and @mreid-tt It may look like stagnating but after spending numerous hours on this I finally made a major leap forward which now allows using default This has definitively been taking way longer than anticipated but I believe things will now start to shape nicely 🤞 |
@hgy59 and @mreid-tt I'll let github-action run and if no remaining issues are found I'll merge. I'll do the remaining changes mentioned in the description from another PR helping tracking issues between PR if any. Feel free to let me know if you see anything needing adjustments prior from me merging things. thnx. |
ifeq ($(call version_ge, $(TC_GCC), 4.8),1) | ||
WHEELS += atom==0.10.5 | ||
WHEELS += atom==0.11.0 | ||
endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hgy59 and @mreid-tt just briging your attention that the ability to include wheel requirement definition directly within the WHEELS variable is now functional once again. This can allow avoiding using multiple requirement files for every gcc versions and ease code maintenance. Although, I don't suggest moving away from using requirement files, but use this for special cases.
Lastly, note that you cal add the pure:
, abi3:
or cross:
prefix. With none defaults to cross
.
@th0ma7 it looks like it failed to download https://download.savannah.gnu.org/releases/acl/acl-2.3.1.tar.xz will cancel, delete the download cache an rerun all jobs (not only failed) should fix it. EDIT: |
Now merged. For your infromation, @hgy59 and @mreid-tt note that I will have a reduced availability for a few months. I'll look into doing the other changes mentioned in this PR's description although this could take a little longer. In the meantime let me know if you find something not working out with this PR, thnx. |
@th0ma7 thanks for the huge work! shall we now publish Python 3.13 (and update of Python 3.12)? |
A pleasure, and sorry for taking that long! This was more complex than anticipated.
Sure, although i would not suggest not migrating to 3.13 now (feels like we had that chat but don't recall the ending) Also, if you want to help out on this effort, feel free to move all python module/wheel based entries from cross to the new python folder :) |
already tried py313 with homeassistant >= 2025.2.x, but several wheels fail to cross compile... |
sure, but my cycles are limitted too, in the next few weeks... |
thnx @hgy59 for uploading py312-313. I just noticed the py313 changelog, not that it matter too much:
and likewise for py312:
|
Description
Handle meson based python-wheel
MESON
spksrc.cross-meson-crossfile.mk
)$(ENV_MESON)
)NOTE: Due to a bug
LDFLAGS
is being kept in environment as it otherwise fails to setrpath
properly when having multiple run path definitions.CMAKE
spksrc.cross-cmake-toolchainfile.mk
)NOTE: While meson refers to cross-file, cmake refers to toolchain file.
$(ENV_CMAKE)
)wheel-install
python31*-wheels
Fixes
Checklist
all-supported
completed successfullyType of change
smallframework changes