Skip to content

Fix building `cffi` for macOS with Apple Silicon support + backwards compatibility

Max Bélanger requested to merge topic/default/mac-arm64 into branch/default

Fixes #474 (closed).

We use cffi extensively in our app, which we deploy on macOS 10.10+. To natively support Apple Silicon, we need to:

  • Build a fat binary with x86_64 and arm64
  • Link against the platform-provided libffi using the macOS SDK
  • Set MACOSX_DEPLOYMENT_TARGET=10.10 and properly deal with unguarded-availability warnings.

This patch alters cffi to support the above. We remove CFFI_TRUST_LIBFFI in favor of function-specific checks, which have to be at runtime to deal with deployment on various versions of macOS. This borrows from the approach used in https://github.com/python/cpython/pull/21249 to add support for this in CPython.

Edited by Max Bélanger

Merge request reports

Loading