Skip to content

Commit 90e8881

Browse files
committed
refactor: Exclude system libraries from PyInstaller build to prevent GLIBC version conflicts
1 parent 3282d12 commit 90e8881

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pyinstaller-build.spec

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ using pyenv on our build machine since pyenv relies on libcrypt to run `pyenv in
4747
if "darwin" not in platform.system().lower() and path.isfile('/usr/lib64/libcrypt.so.1'):
4848
binaries.append(('/usr/lib64/libcrypt.so.1', '.'))
4949

50+
# Exclude system libraries that should be provided by the target system to avoid glibc version conflicts
51+
# These libraries will be loaded from the system at runtime instead of being bundled
52+
# This is critical for el9 (glibc 2.34) compatibility when building on systems with newer glibc
53+
excludes_binaries = [
54+
'libgcc_s.so.1', # Exclude libgcc to avoid glibc version conflicts
55+
'libc.so.6', # Exclude glibc itself
56+
'libm.so.6', # Exclude libm (math library)
57+
'libpthread.so.0', # Exclude pthread library
58+
'libdl.so.2', # Exclude dynamic linker library
59+
'librt.so.1', # Exclude realtime extensions library
60+
]
61+
5062
block_cipher = None
5163

5264
asadm_a = Analysis(['asadm.py'],
@@ -63,6 +75,10 @@ asadm_a = Analysis(['asadm.py'],
6375
cipher=block_cipher,
6476
noarchive=False)
6577

78+
# Filter out system libraries from asadm to prevent glibc version conflicts
79+
# This allows the binary to use the system's version of these libraries at runtime
80+
asadm_a.binaries = [x for x in asadm_a.binaries if not any(exc in x[0] for exc in excludes_binaries)]
81+
6682
if not options.exclude_asinfo:
6783
asinfo_a = Analysis(['asinfo.py'],
6884
pathex=[],
@@ -77,6 +93,9 @@ if not options.exclude_asinfo:
7793
win_private_assemblies=False,
7894
cipher=block_cipher,
7995
noarchive=False)
96+
97+
# Filter out system libraries from asinfo as well
98+
asinfo_a.binaries = [x for x in asinfo_a.binaries if not any(exc in x[0] for exc in excludes_binaries)]
8099

81100
MERGE((asadm_a, "asadm", "asadm"), (asinfo_a, "asinfo", "asinfo"))
82101

0 commit comments

Comments
 (0)