Skip to content

Commit 049bef0

Browse files
authored
docs: Move libX11 / PyQt stuff to "former quirks" (#739)
This has been working fine since May 2022....
1 parent 01aa806 commit 049bef0

File tree

1 file changed

+10
-58
lines changed

1 file changed

+10
-58
lines changed

docs/quirks.rst

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -142,64 +142,6 @@ Some functionality may behave subtly differently as a result of our choice
142142
to link ``libedit`` by default. (We choose ``libedit`` by default to
143143
avoid GPL licensing requirements of ``readline``.)
144144

145-
.. _quirk_linux_libx11:
146-
147-
Static Linking of ``libX11`` / Incompatibility with PyQt on Linux
148-
=================================================================
149-
150-
The ``_tkinter`` Python extension module in the Python standard library
151-
statically links against ``libX11``, ``libxcb``, and ``libXau`` on Linux.
152-
In addition, the ``_tkinter`` extension module is statically linked into
153-
``libpython`` and isn't a standalone shared library file. This effectively
154-
means that all these X11 libraries are statically linked into the main
155-
Python interpreter.
156-
157-
On typical builds of Python on Linux, ``_tkinter`` will link against
158-
external shared libraries. e.g.::
159-
160-
$ ldd /usr/lib/python3.9/lib-dynload/_tkinter.cpython-39-x86_64-linux-gnu.so
161-
linux-vdso.so.1 (0x00007fff3be9d000)
162-
libBLT.2.5.so.8.6 => /lib/libBLT.2.5.so.8.6 (0x00007fdb6a6f8000)
163-
libtk8.6.so => /lib/x86_64-linux-gnu/libtk8.6.so (0x00007fdb6a584000)
164-
libtcl8.6.so => /lib/x86_64-linux-gnu/libtcl8.6.so (0x00007fdb6a3c1000)
165-
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fdb6a1d5000)
166-
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007fdb6a097000)
167-
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fdb69f49000)
168-
libXft.so.2 => /lib/x86_64-linux-gnu/libXft.so.2 (0x00007fdb69f2e000)
169-
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fdb69ee6000)
170-
libXss.so.1 => /lib/x86_64-linux-gnu/libXss.so.1 (0x00007fdb69ee1000)
171-
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fdb69eda000)
172-
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fdb69ebe000)
173-
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fdb69e9c000)
174-
/lib64/ld-linux-x86-64.so.2 (0x00007fdb6a892000)
175-
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fdb69e70000)
176-
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fdb69dad000)
177-
libXrender.so.1 => /lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fdb69da0000)
178-
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fdb69d71000)
179-
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fdb69d68000)
180-
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007fdb69d53000)
181-
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007fdb69d4b000)
182-
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fdb69d43000)
183-
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007fdb69d08000)
184-
libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007fdb69cfa000)
185-
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fdb69ce2000)
186-
libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007fdb69cbd000)
187-
libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007fdb69cb0000)
188-
189-
The static linking of ``libX11`` and other libraries can cause problems when
190-
3rd party Python extension modules also loading similar libraries are also
191-
loaded into the process. For example, extension modules associated with ``PyQt``
192-
are known to link against a shared ``libX11.so.6``. If multiple versions of
193-
``libX11`` are loaded into the same process, run-time crashes / segfaults can
194-
occur. See e.g. https://github.com/astral-sh/python-build-standalone/issues/95.
195-
196-
The conceptual workaround is to not statically link ``libX11`` and similar
197-
libraries into ``libpython``. However, this requires re-linking a custom
198-
``libpython`` without ``_tkinter``. It is possible to do this with the object
199-
files included in the distributions. But there isn't a turnkey way to do this.
200-
And you can't easily remove ``_tkinter`` and its symbols from the pre-built
201-
and ready-to-use Python install included in this project's distribution
202-
artifacts.
203145

204146
.. _quirk_references_to_build_paths:
205147

@@ -254,6 +196,7 @@ make distributions more portable, please file a GitHub issue.
254196

255197
.. _quirk_former:
256198
.. _quirk_missing_libcrypt:
199+
.. _quirk_linux_libx11:
257200

258201
Former quirks
259202
=============
@@ -283,4 +226,13 @@ been resolved.
283226
New in Python 3.13`_ about third-party replacements for the ``crypt``
284227
module.
285228

229+
* "Static Linking of ``libX11`` / Incompatibility with PyQt on Linux":
230+
The 20220318 release and earlier exported dynamic symbols for the
231+
internal, statically-linked build of ``libX11`` and other libraries.
232+
These would cause conflicts and potential crashes when using
233+
third-party extension modules such as PyQt that load an actual shared
234+
``libX11`` library (usually provided by your OS). Starting with the
235+
20220502 release, symbols from internal dependencies are no longer
236+
exported.
237+
286238
.. _What's New in Python 3.13: https://docs.python.org/3/whatsnew/3.13.html#whatsnew313-pep594

0 commit comments

Comments
 (0)