Skip to content

Commit 63c54c2

Browse files
committed
docs: document musl linking quirks
Related to #86.
1 parent 0736a66 commit 63c54c2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/quirks.rst

+23
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,29 @@ Some functionality may behave subtly differently as a result of our choice
225225
to link ``libedit`` by default. (We choose ``libedit`` by default to
226226
avoid GPL licensing requirements of ``readline``.)
227227

228+
Static Linking of musl libc Prevents Extension Module Library Loading
229+
=====================================================================
230+
231+
Our musl libc linked Linux builds link musl libc statically and the resulting
232+
binaries are completely static and don't have any external dependencies.
233+
234+
Due to how Linux/ELF works, a static/non-dynamic binary cannot call
235+
``dlopen()`` and therefore it cannot load shared library based Python
236+
extension modules (``.so`` based extension modules). This significantly
237+
limits the utility of these Python distributions. (If you want to use
238+
additional extension modules you can use the build artifacts in the
239+
distributions to construct a new ``libpython`` with the additional
240+
extension modules configured as builtin extension modules.)
241+
242+
Another consequence of statically linking musl libc is that our musl
243+
distributions aren't compatible with
244+
`PEP 656 <https://www.python.org/dev/peps/pep-0656/>`_. PEP 656
245+
stipulates that Python and extension modules are linked against a
246+
dynamic musl. This is what you'll find in Alpine Linux, for example.
247+
248+
See https://github.com/indygreg/python-build-standalone/issues/86 for
249+
a tracking issue to improve the state of musl distributions.
250+
228251
.. _quirk_linux_libx11:
229252

230253
Static Linking of ``libX11`` / Incompatibility with PyQt on Linux

0 commit comments

Comments
 (0)