Closed joanibal closed 7 months ago
Most of the CI I have setup for building wheels is based on Scipy since it has a similar set of dependencies (LAPACK and gfortran). I have tried to mirror what they have done to create
MacOS-arm64
wheels, but their process forMacOS-arm64
wheels was much less clear to me.
A quick hint on this: SciPy uses Cirrus CI, which provides native macOS arm64 runners. There's some cibuildwheel
config at the bottom of its pyproject.toml
, and then:
Does Xcode come with a fortran compiler capable of cross compilation?
Thanks @rgommers , I hadn't realized that Cirrus Ci had macOS arm64 runners. I was hesitant to add another CI provider, but I now see that it will likely be much easier than cross compiling on macOS.
Does Xcode come with a fortran compiler capable of cross compilation?
I'm new to apple, but I don't believe Xcode comes with any Fortran compiler. I was planning on using gfortran for that reason. However, I now see that I had taken for granted that gfortran could cross compile from macOS x86_64 to macOS arm64. From what I can find here, even if cross compiling is possible getting a capable gfortran compiler seems complicated.
I'm going to close this issue since I see that it is best to avoid cross compiling altogether in this case. Thank you for your help!
Fortran compilers are indeed a major issue, on macOS and even more on Windows. Apple doesn't provide one, and the Gfortran builds one can find try to keep compatibility with Apple's Clang, but there are regularly issues when there's an OS update. They also require specific macOS SDK versions, and for wheels require bundling libgcc
, libgfortran
and libquadmath
(delocate
will take care of that, but to be a good citizen you should note in your license that these are LGPL components).
This is all messy, and I recommend looking at this very recent PR that streamlined this as much as possible: https://github.com/numpy/numpy/pull/25253.
Switching to Cirrus CI and following the configuration files from Scipy/Numpy fixed my issues and I can now build wheels for macOS-arm64. Thanks for your help!
Now that macOS-arm64 is in a good place, I'll have to give the window wheels another shot. I got close before (again basically just coping the workflow from Scipy), but got stuck on linking errors related to "relocation truncated to fit: IMAGE_REL_AMD64_REL32 against symbol". I see that you recently modified the meson.build files in Scipy for windows, so I'll make the corresponding changes in my project to see if that does the trick.
Thanks again for all your help!
That sounds like progress, thanks for the update @joanibal. The "relocation truncated" issue doesn't ring a bell for me.
Hello,
I'm trying to create apple silicon python wheels for my application using
cibuildwheel
,meson-python
, and amacos-12
github runner. However, I can not seem to figure out how to do this.In particular I can't get passed this error
Indeed the meson cross file does not mention fortran and it would seem that it is hard coded here. I'm new to meson, so my apologies if I overlooked something basic.
Most of the CI I have setup for building wheels is based on Scipy since it has a similar set of dependencies (LAPACK and gfortran). I have tried to mirror what they have done to create
MacOS-arm64
wheels, but their process forMacOS-arm64
wheels was much less clear to me.Thank you for any help!