File tree Expand file tree Collapse file tree 3 files changed +37
-3
lines changed
Expand file tree Collapse file tree 3 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 11import os
22
3- from .scripts .download_qnn_sdk import install_qnn_sdk , is_linux_x86
3+ from .scripts .download_qnn_sdk import check_glibc_exist , install_qnn_sdk , is_linux_x86
44
55
66env_flag = os .getenv ("EXECUTORCH_BUILDING_WHEEL" , "0" ).lower ()
77# If users have preinstalled QNN_SDK_ROOT, we will use it.
88qnn_sdk_root_flag = os .getenv ("QNN_SDK_ROOT" , None )
99
10- if env_flag not in ("1" , "true" , "yes" ) and not qnn_sdk_root_flag and is_linux_x86 ():
10+ if (
11+ env_flag not in ("1" , "true" , "yes" )
12+ and not qnn_sdk_root_flag
13+ and is_linux_x86 ()
14+ and check_glibc_exist ()
15+ ):
1116 ok = install_qnn_sdk ()
1217
1318 if not ok :
Original file line number Diff line number Diff line change @@ -38,6 +38,34 @@ def is_linux_x86() -> bool:
3838 )
3939
4040
41+ REQUIRED_QNN_LIBS = ["libc.so.6" ]
42+
43+
44+ def check_glibc_exist () -> bool :
45+ """
46+ Check if users have glibc installed.
47+ """
48+ paths = ["/lib/x86_64-linux-gnu/libc.so.6" , "/lib64/libc.so.6" , "/lib/libc.so.6" ]
49+
50+ exists = any (os .path .isfile (p ) for p in paths )
51+ if not exists :
52+ logger .error (
53+ r""""
54+ glibc not found. Please install glibc following the commands below.
55+ Ubuntu/Debian:
56+ sudo apt update
57+ sudo apt install libc6
58+
59+ Fedora/Red Hat:
60+ sudo dnf install glibc
61+
62+ Arch Linux:
63+ sudo pacman -S glibc
64+ """
65+ )
66+ return exists
67+
68+
4169def _download_archive (url : str , archive_path : pathlib .Path ) -> bool :
4270 """Download archive from URL with progress reporting."""
4371 logger .debug ("Archive will be saved to: %s" , archive_path )
Original file line number Diff line number Diff line change @@ -467,10 +467,11 @@ def run(self):
467467 # Following code is for building the Qualcomm backend.
468468 from backends .qualcomm .scripts .download_qnn_sdk import (
469469 _download_qnn_sdk ,
470+ check_glibc_exist ,
470471 is_linux_x86 ,
471472 )
472473
473- if is_linux_x86 ():
474+ if is_linux_x86 () and check_glibc_exist () :
474475 os .environ ["EXECUTORCH_BUILDING_WHEEL" ] = "1"
475476
476477 with tempfile .TemporaryDirectory () as tmpdir :
You can’t perform that action at this time.
0 commit comments