-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow dynamic loading in musl builds while CPython itself is static #86
Comments
When you produce a fully static ELF executable, you can't load dynamic libraries. That Now, what we probably could do is produce a Python distribution that is dynamically linked against musl libc and the executable only has a dependency on musl. This should enable the distributions to load extensions that were also compiled to target musl libc. We could potentially also include a placeholder shared library to force the resulting executable to be dynamic. Or maybe there's another way to force the linker into making the final executable dynamic. Something to keep in mind here is once you support loading dynamic libraries, you have to worry about multiple libc versions being loaded. I believe musl - like glibc - is sensitive about multiple versions existing in the same process space. So we probably don't want to statically link musl and enable extensions to also statically link musl, as this is a recipe for disaster. Having a dynamically linked musl is probably the safest route here. Out of curiosity, could you please explain your use case? Is this for better support for Alpine Linux and/or compatibility with the new platform tag for musl (https://discuss.python.org/t/pep-656-platform-tag-for-linux-distributions-using-musl/7165)? |
Thanks for the reply. I think there are two ways if it's not feasible to build static-musl version of Python with import capability:
|
@indygreg can I help you anything to make musl dynamic build possible for x64 - aarch64? As I understand I need:
And not related question: |
Hi! |
Just piping* up with another use case: Using Hatch to run Python matrix tests, for wheels built on Alpine. Hatch uses Here is what it looks like when you try that today. I see this patch, Note that it's not just code that directly uses One could also upstream (*piping up, not pip-ing up, because I can't pip. Sorry, bad pip joke.) |
I'd like to ship a few wheels including pre-built C modules along with the musl-based standalone Python from here.
When I try to run
python -m ensurepip
(e.g., #84) or any other imports that involves dynamic loading of C libraries (e.g.,ctypes
,pyzmq
, etc.) then it exits withOSError: Dynamic loading not supported
.Could we have a musl-based static build that allows dynamic loading of additional non-standard modules?
It seems that 0d3ae2a has disabled the ability to use dynamic loading.
The text was updated successfully, but these errors were encountered: