Repository navigation
Conversation
…amework The rules for the libpython dylib and for the macOS and iOS frameworks did not pass $(MODLIBS), unlike the rule for libpython.so. When a module is built in (for example via Modules/Setup.local), the libraries it needs, such as the HACL* objects used by _blake2, were left out. The framework link then fails with undefined symbols, while the dylib, which is linked with -undefined dynamic_lookup, fails only when the missing symbol is called at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The rules that link
libpython$(LDVERSION).dyliband the macOS and iOS frameworks don't pass$(MODLIBS), unlike thelibpython$(LDVERSION).sorule. When a module is built in, for example viaModules/Setup.local, the libraries that module needs are left out:--enable-framework: the build fails with undefined symbols.--enable-shared: the dylib is linked with-undefined dynamic_lookup, so the build succeeds and the failure only shows up at runtime.To reproduce, build on macOS with this
Modules/Setup.local:On
main:--enable-framework: linkingPython.frameworkfails with 12 undefined_Py_LibHacl_*symbols.--enable-shared:nm -u libpython3.16.dyliblists the same 12 symbols. Aftermake install,python3 -c "import _blake2; _blake2.blake2b(b'abc')"aborts withdyld: missing symbol called, and so does a C program that embeds Python.With this change, both builds link with no undefined HACL symbols, and
_blake2works as a built-in module. In default builds$(MODLIBS)is empty, so they are unaffected.test_hashlib,test_hmac,test_embedandtest_sysconfigpass for shared and framework builds, both with and without theSetup.localabove (macOS 14, arm64). I haven't tested the iOS framework rule, which gets the same one-line change.python-build-standalone already carries the dylib part of this as a patch (astral-sh/python-build-standalone#870). This PR doesn't remove
-undefined dynamic_lookup, as the earlier gh-145186 did.Written with assistance from Claude Code Opus 5.5