Fix macOS binary compatibility by adding the MACOSX_DEPLOYMENT_TARGET
environment variable
#3786
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This is a fix for an earlier issue I had opened, which is #3698 – the issue description goes into detail about why this environment variable is needed, but the TLDR is that the CasADi binaries for macOS on PyPI are slightly broken in terms of compatibility since they won't work on macOS 11.0. 11.1 is needed because this target was not set, and
pip
can't install binaries with that deployment target yet (pypa/packaging#578). This isn't fully required, and it isn't a critical issue either – since 11.0 is an old macOS version that the majority of people aren't using, but it is valid in the sense that this bears collision with the Python packaging world.I am not sure if these additions are going to work for the release binaries or whether I have added this in the right location (please let me know where it would be best to add!), however, since I don't know where the CasADi releases are built and then pushed to PyPI from, it would be nice to test this. It is to be noted that tools such as
cibuildwheel
set this environment variable automatically for Python wheels to achieve maximum compatibility, but integrating that in CasADi's release infrastructure is a larger ask (and task), and cross-compiling binaries with it through Dockcross images is not fully ready, AFAIK.Fixes #3698
Additional information
I added this to the
release-3.6.6
branch based on my recent contribution, but I can change the base branch tomain
if needed. It would be great if a workflow that emulates the releases could be triggered for testing. A way to verify the binaries would be to run thedelocate
tool on the wheel artifact to validate that all of the dynamic libraries are built against this deployment target; this can be done manually, or I can add a sanity check as a step in an appropriate location in the workflows wheredelocate
will be able to check it on every build.