Skip to content

Commit d267f5f

Browse files
committed
fix path
1 parent f3e2110 commit d267f5f

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

backends/qualcomm/scripts/download_qnn_sdk.py

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,43 @@ def _check_tmp_glibc() -> bool:
273273
return False
274274

275275

276+
def _current_glibc_version() -> str:
277+
try:
278+
return ctypes.CDLL("libc.so.6").gnu_get_libc_version().decode()
279+
except Exception:
280+
return "unknown"
281+
282+
283+
def _ensure_glibc_minimum():
284+
current = _current_glibc_version()
285+
logger.info("[glibc] Current loaded glibc: %s", current)
286+
287+
if current >= GLIBC_VERSION:
288+
logger.info("[glibc] Current glibc is sufficient, no re-exec needed.")
289+
return
290+
291+
if os.environ.get(GLIBC_REEXEC_GUARD) == "1":
292+
logger.error(
293+
"[glibc] Re-exec attempted but glibc is still too low (%s).", current
294+
)
295+
return
296+
297+
if not GLIBC_LOADER.exists():
298+
logger.error("[glibc] Loader not found at %s", GLIBC_LOADER)
299+
return
300+
301+
logger.info(
302+
"[glibc] Re-executing under %s (target=%s)", GLIBC_LOADER, GLIBC_VERSION
303+
)
304+
305+
os.environ[GLIBC_REEXEC_GUARD] = "1"
306+
os.execv(
307+
str(GLIBC_LOADER),
308+
[str(GLIBC_LOADER), "--library-path", str(GLIBC_LIBDIR), sys.executable]
309+
+ sys.argv,
310+
)
311+
312+
276313
####################
277314
# libc++ management
278315
####################
@@ -474,13 +511,14 @@ def install_qnn_sdk() -> bool:
474511
True if both steps succeeded (or were already satisfied), else False.
475512
"""
476513
logger.info("[QNN] Starting SDK installation")
477-
# Re-exec with glibc 2.36 if needed.
478-
# Just check that pre-installed glibc is present and valid
514+
515+
# Check and re-exec with custom glibc if needed
516+
_ensure_glibc_minimum()
517+
479518
if not _check_tmp_glibc():
480519
logger.error("[glibc] Pre-installed glibc check failed. Exiting early.")
481520
return False
482521

483-
if _ensure_libcxx_stack():
484-
if _ensure_qnn_sdk_lib():
485-
return True
522+
if _ensure_libcxx_stack() and _ensure_qnn_sdk_lib():
523+
return True
486524
return False

0 commit comments

Comments
 (0)