fix: link libpython correctly for iOS abi3 PyO3 builds #3366
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.35) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 167 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.307
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3366"
general
weight: 0.35
messense
Since #3226/#3233, maturin writes a
PYO3_CONFIG_FILEwhenever it forces a stable-ABItarget_abi, including for runnable interpreters such as the iOS cross-venvs created by cibuildwheel. When PyO3 reads a config file it no longer queries the interpreter, and PyO3 always links libpython on iOS. With nolib_nameorlib_dirin the file, PyO3 fell back todefault_lib_name_unixwith theabi3minimum version, so the build tried-lpython3.9with no search path and failed withld: library 'python3.9' not found.This is the iOS version of the Android problem fixed in #3130, with two differences:
libpython3.X.dylib(a symlink toPython.framework/Python) and no unversioned stable-ABI library, solib_nameis alwayspython{major}.{minor}{abiflags}of the target interpreter, even for abi3 builds.PYO3_CROSS_LIB_DIR, which maturin already copies into the config file aslib_dir. It doesn't set it for iOS, so maturin now records sysconfigLIBDIRwhen it inspects an interpreter. For iOS targets it writes that path aslib_dirunlessPYO3_CROSS_LIB_DIRis set, matching what pyo3 would have found by querying the interpreter. Without it, linking fails withld: library 'python3.13' not foundeven with the correctlib_name.Fixes #3365