Skip to content

gh-155813: Stop overwriting LIBFFI_CFLAGS and LIBFFI_LIBS on macOS - #156486

Open
advitrocks9 wants to merge 1 commit into
python:mainfrom
advitrocks9:build/darwin-libffi-override
Open

gh-155813: Stop overwriting LIBFFI_CFLAGS and LIBFFI_LIBS on macOS#156486
advitrocks9 wants to merge 1 commit into
python:mainfrom
advitrocks9:build/darwin-libffi-override

Conversation

@advitrocks9

@advitrocks9 advitrocks9 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

On macOS, configure sets LIBFFI_CFLAGS and LIBFFI_LIBS from the SDK before the pkg-config
check, so values passed on the command line are ignored. Doc/using/configure.rst documents both
as overrides. This uses the same preserve-if-set form as the pkg-config fallback and the libuuid
probe.

Configuring with LIBFFI_CFLAGS=-I/nonexistent/include/ffi LIBFFI_LIBS="-L/nonexistent/lib -lffi",
the Makefile currently ends up with the SDK paths:

MODULE__CTYPES_CFLAGS=-fno-strict-overflow -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi -DUSING_APPLE_OS_LIBFFI=1 -DUSING_MALLOC_CLOSURE_DOT_C=1
MODULE__CTYPES_LDFLAGS=-lffi -ldl

and with this change keeps the given values:

MODULE__CTYPES_CFLAGS=-fno-strict-overflow -I/nonexistent/include/ffi -DUSING_MALLOC_CLOSURE_DOT_C=1
MODULE__CTYPES_LDFLAGS=-L/nonexistent/lib -lffi -ldl

With no overrides the output is unchanged. USING_APPLE_OS_LIBFFI drops out when overriding
since it guards Apple-libffi code in _ctypes. iOS sets a different ac_sys_system and is
unaffected. The other documented *_CFLAGS/*_LIBS pairs already preserve user values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant