macOS: configure does not support linking against a non-system libffi
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- PR 合并指标
- PR 指标待抓取
描述
Bug report
Bug description:
On macOS, the configure script does not provide a way to link _ctypes against a non-system libffi.
Although LIBFFI_CFLAGS and LIBFFI_LIBS are documented as configuration variables for libffi, configure first checks for the system libffi from Apple's SDK and if found overwrites these variables.
The pkg-config based check, which does preserve these variables, is never run when the system libffi is detected.
The confusing --with-system-ffi option, removed in Python 3.12 (#100544), provided a way to invoke the pkg-config based configuration on macOS, bypassing the detection of the SDK libffi.
I ran into this while updating python-build-standalone to use the standard extension configuration in 3.12+ (astral-sh/python-build-standalone#1180). Other than patching configure the best option seemed to be to use ac_cv_lib_ffi_ffi_call=no to force the check to fail.
I also found that conda-forge patches configure to get around this issue when building CPython.
Related issues
CPython versions tested on:
3.12, 3.13, 3.14, 3.15, CPython main branch
Operating systems tested on:
macOS
Linked PRs
- gh-156486
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从第 4363–4392 行附近链接的 configure.ac 检查开始,并将其与生成的 configure 脚本进行比较。跟踪 LIBFFI_CFLAGS、LIBFFI_LIBS、macOS SDK libffi 检查和 pkg-config 检查之间的交互方式。完成的标准是 macOS 构建能够保留用户提供的设置,并将 _ctypes 链接到非系统 libffi。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- build-system
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100