Skip to content

Commit 0eb9281

Browse files
committed
Stopped excluding mangled library names
1 parent 07ff928 commit 0eb9281

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

pyinstaller.spec

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,23 @@ a = Analysis(
3535
noarchive=False,
3636
)
3737

38-
# Exclude problematic Linux system libraries.
39-
# These must not be bundled — packages like Pillow vendor their own copies
40-
# (e.g. pillow.libs/libxcb-*.so) which get prepended to LD_LIBRARY_PATH and
41-
# break OCCT's GLX initialization by shadowing the system X11/GL stack.
38+
# Exclude unmangled system X11/GL libraries that would shadow the system stack
39+
# via PyInstaller's LD_LIBRARY_PATH. Manylinux-vendored copies with a hash in
40+
# their name (e.g. libXcursor-1a09904e.so.1.0.2) are safe to keep because
41+
# their SONAME is also mangled and won't conflict with system libraries.
4242
if sys.platform == 'linux':
43-
import os
44-
exclude_libs = (
43+
import os, re
44+
_HASH_RE = re.compile(r'-[0-9a-f]{8}\.')
45+
_SYSTEM_PREFIXES = (
4546
'libGL', 'libEGL', 'libGLX', 'libGLdispatch', 'libGLES',
4647
'libX11', 'libXau', 'libxcb', 'libXcursor', 'libXext',
4748
'libXfixes', 'libXi', 'libXrender',
4849
'libbsd',
4950
)
50-
a.binaries = TOC(
51-
[x for x in a.binaries
52-
if not os.path.basename(x[0]).startswith(exclude_libs)]
53-
)
51+
def _is_conflicting(name):
52+
bn = os.path.basename(name)
53+
return bn.startswith(_SYSTEM_PREFIXES) and not _HASH_RE.search(bn)
54+
a.binaries = TOC([x for x in a.binaries if not _is_conflicting(x[0])])
5455

5556
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
5657

0 commit comments

Comments
 (0)