matthewholman / assist

ASSIST is a software package for ephemeris-quality integrations of test particles.
https://assist.readthedocs.io/
GNU General Public License v3.0
23 stars 10 forks source link

conda-forge cross-compile build support #91

Closed mjuric closed 10 months ago

mjuric commented 12 months ago

Conda-forge builds Apple Silicon (arm64) binaries by cross-compiling, not by building on native platforms. This is all rather hacky and poorly documented, with the best documentation at:

https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/

It's really really hacky for Python extension module builds, as distutils doesn't support cross-compilation. The way it works is by running a (hacked, monkeypatched) build-platform Python+distutils to drive the build, which then invokes the cross-platform compiler. This causes all sorts of issues with paths, where the cross-compiler will find the build- rather than host-platform libraries using the default logic from setup.py here.

We avoid this by explicitly detecting conda-forge cross-platform builds by looking for the CONDA_BUILD_CROSS_COMPILATION environment variable. If this variable is set, we set up the library paths by looking at the PREFIX variable (which conda sets to the destination where the package will be installed).

This makes the cross-compilation work. It doesn't make it any less ugly, but that's the world we live in...

matthewholman commented 10 months ago

Sorry for the delay in merging this, @mjuric