ratt-ru / arcae

Arrow C++ and Python Bindings for casacore
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

MacOS wheels need a GCC built with MACOSX_DEPLOYMENT_TARGET #99

Closed sjperkins closed 3 weeks ago

sjperkins commented 4 months ago

casacore depends on libgfortran and libquadmath, which are both installed with brew install gcc during the wheel build process.

Unfortunately, the brew gcc is built targeting the host versions of MacOS (Ventura 13 and Sonoma 14), so when delocate is run this conflicts with the MACOSX_DEPLOYMENT_TARGET (currently 11)

    File "/private/var/folders/vy/h7r6h43j203gstfh6fj9_tyh0000gn/T/cibw-run-0555lp4k/cp311-macosx_x86_64/build/venv/lib/python3.11/site-packages/delocate/delocating.py", line 839, in _check_and_update_wheel_name
      raise DelocationError(
  delocate.libsana.DelocationError: Library dependencies do not satisfy target MacOS version 11.0:
  /private/var/folders/vy/h7r6h43j203gstfh6fj9_tyh0000gn/T/tmpyehn1qku/wheel/arcae/.dylibs/libquadmath.0.dylib has a minimum target of 13.0
  /private/var/folders/vy/h7r6h43j203gstfh6fj9_tyh0000gn/T/tmpyehn1qku/wheel/arcae/.dylibs/libgfortran.5.dylib has a minimum target of 13.0

brew doesn't really support installing bottles for older MacOS versions:

Excluding these two libraries from the MacOS wheels seems to result in the basic MS read/write sanity check passing:

and inspection of the .sos indicates that the measures libraries (there may be other libs) depend on libgfortran and libquadmath. No measures code is currently called by arcae so this should be OK for now.

In the longer term, it will probably be necessary to build gcc from scratch:

It also might be possible to create a custom homebrew formula to install gcc targetting macos 11.

The following PR illustrates the use of a custom gfortran build:

It also might be worth just using conda as a build environment since it's possible to install the required compilers: