@@ -180,30 +180,29 @@ def _extract_tar(archive_path: pathlib.Path, prefix: str, target_dir: pathlib.Pa
180180 dst .write (src .read ())
181181
182182
183+ ####################
184+ # libc management
185+ ####################
186+
183187####################
184188# libc management
185189####################
186190
187191GLIBC_VERSION = "2.34"
188192GLIBC_ROOT = pathlib .Path (f"/tmp/glibc-install-{ GLIBC_VERSION } " )
189193GLIBC_LIBDIR = GLIBC_ROOT / "lib"
194+
195+ # Loader candidates: Fedora RPM may give us either ld-2.34.so or ld-linux-x86-64.so.2
190196GLIBC_LOADER_CANDIDATES = [
191197 GLIBC_LIBDIR / f"ld-{ GLIBC_VERSION } .so" ,
192198 GLIBC_LIBDIR / "ld-linux-x86-64.so.2" ,
193199]
194200GLIBC_LOADER = next ((p for p in GLIBC_LOADER_CANDIDATES if p .exists ()), None )
195- GLIBC_REEXEC_GUARD = "QNN_GLIBC_REEXEC"
196201
202+ GLIBC_REEXEC_GUARD = "QNN_GLIBC_REEXEC"
197203MINIMUM_LIBC_VERSION = GLIBC_VERSION
198204GLIBC_CUSTOM = str (GLIBC_LIBDIR / "libc.so.6" )
199205
200- REQUIRED_LIBC_LIBS = [
201- GLIBC_CUSTOM ,
202- "/lib64/libc.so.6" ,
203- "/lib/x86_64-linux-gnu/libc.so.6" ,
204- "/lib/libc.so.6" ,
205- ]
206-
207206
208207def _parse_version (v : str ) -> tuple [int , int ]:
209208 parts = v .split ("." )
@@ -212,10 +211,16 @@ def _parse_version(v: str) -> tuple[int, int]:
212211
213212def check_glibc_exist_and_validate () -> bool :
214213 """
215- Check if users have glibc installed ( system or custom in /tmp) .
214+ Validate glibc in /tmp, fallback to system libc only if custom one not found .
216215 """
217- GLIBC_CUSTOM = f"/tmp/glibc-install-{ GLIBC_VERSION } /lib/libc.so.6"
218- candidates = [GLIBC_CUSTOM , "/lib64/libc.so.6" , "/lib/x86_64-linux-gnu/libc.so.6" ]
216+ candidates = [GLIBC_CUSTOM ]
217+
218+ # Optional: keep fallbacks for debugging (not recommended in CI if you always stage custom)
219+ candidates += [
220+ "/lib64/libc.so.6" ,
221+ "/lib/x86_64-linux-gnu/libc.so.6" ,
222+ "/lib/libc.so.6" ,
223+ ]
219224
220225 for path in candidates :
221226 if not pathlib .Path (path ).exists ():
@@ -235,8 +240,7 @@ def check_glibc_exist_and_validate() -> bool:
235240 return True
236241 else :
237242 logger .error (
238- f"[QNN] glibc version { version } is too low at { path } . "
239- f"Need >= { MINIMUM_LIBC_VERSION } ."
243+ f"[QNN] glibc version { version } too low at { path } . Need >= { MINIMUM_LIBC_VERSION } ."
240244 )
241245 else :
242246 logger .error (f"[QNN] Could not parse glibc version from { first_line } " )
@@ -250,8 +254,8 @@ def check_glibc_exist_and_validate() -> bool:
250254
251255
252256def _check_tmp_glibc () -> bool :
253- """Check if glibc in /tmp was installed correctly and log its version."""
254- libc_path = GLIBC_ROOT / "lib" / "libc.so.6"
257+ """Check if staged glibc in /tmp was installed correctly and log its version."""
258+ libc_path = GLIBC_LIBDIR / "libc.so.6"
255259 if not libc_path .exists ():
256260 logger .error ("[glibc] Expected glibc at %s but file not found" , libc_path )
257261 return False
@@ -295,11 +299,11 @@ def _ensure_glibc_minimum(min_version: str = GLIBC_VERSION):
295299
296300 if os .environ .get (GLIBC_REEXEC_GUARD ) == "1" :
297301 logger .info ("[glibc] Already re-exec'd once; continuing under current loader." )
298- _log_current_loader () # ✅ confirm loader after re-exec
302+ _log_current_loader ()
299303 return
300304
301- if not GLIBC_LOADER .exists ():
302- logger .error ("[glibc] Loader not found at %s" , GLIBC_LOADER )
305+ if not GLIBC_LOADER or not GLIBC_LOADER .exists ():
306+ logger .error ("[glibc] Loader not found in %s" , GLIBC_LIBDIR )
303307 return
304308
305309 logger .info (
0 commit comments