fail to build QNN backend on macOS #8082
Labels
module: qnn
Issues related to Qualcomm's QNN delegate and code under backends/qualcomm/
triaged
This issue has been looked at a team member, and triaged and prioritized into an appropriate module
🐛 Describe the bug
I'm following https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/LlamaDemo/docs/delegates/qualcomm_README.md to build QNN model on my M1 mac. I'm currently stuck at the step to build Build QNN backend with ExecuTorch. there are two errors I encountered.
when I build
and I can overcome this by hardcode https://github.com/pytorch/executorch/blob/main/backends/qualcomm/runtime/backends/CMakeLists.txt#L48 to be aarch64
then the command
cmake --build cmake-out -j16 --target install --config Release
is giving me
`[ 1%] Building CXX object third-party/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags.cc.o
[ 1%] Building CXX object third-party/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_reporting.cc.o
[ 1%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_binary.cpp.o
[ 1%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_parser.cpp.o
[ 2%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_text.cpp.o
[ 2%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_csharp.cpp.o
[ 2%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_kotlin.cpp.o
[ 2%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/reflection.cpp.o
[ 2%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/util.cpp.o
[ 3%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_cpp.cpp.o
[ 3%] Building CXX object third-party/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_completions.cc.o
[ 3%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_dart.cpp.o
[ 5%] Built target pthreadpool
[ 7%] Built target cpuinfo
[ 9%] Built target cpuinfo_internals
[ 10%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_kotlin_kmp.cpp.o
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_parser.cpp:17:10: fatal error: 'algorithm' file not found
17 | #include
| ^~~~~~~~~~~
/Users/tianhaogu/Documents/executorch/third-party/gflags/src/gflags_reporting.cc:51:10: fatal error: 'cstdio' file not found
51 | #include
| ^~~~~~~~
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_binary.cpp:19:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_binary.h:20:10: fatal error: 'memory' file not found
20 | #include
| ^~~~~~~~
[ 11%] Building CXX object kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/single.cpp.o
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_csharp.cpp:19:
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_csharp.h:20:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/code_generator.h:20:10: fatal error: 'string' file not found
20 | #include
| ^~~~~~~~
In file included from /Users/tianhaogu/Documents/executorch/third-party/gflags/src/gflags.cc:91:
/Users/tianhaogu/Documents/executorch/cmake-out/third-party/gflags/include/gflags/gflags.h:81:10: fatal error: 'string' file not found
81 | #include
| ^~~~~~~~
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_kotlin.cpp:19:
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_kotlin.h:20:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/code_generator.h:20:10: fatal error: 'string' file not found
20 | #include
| ^~~~~~~~
[ 11%] Building CXX object kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/double.cpp.o
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/util.cpp:20:10: fatal error: 'cstring' file not found
20 | #inclIn file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/reflection.cpp:17ude :
| In file included from ^~~~~~~~~/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/reflection.h
:25:
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/reflection_generated.h:7:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/flatbuffers.h:20:10: fatal error: 'algorithm' file not found
20 | #include
| ^~~~~~~~~~~
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_cpp.cpp:19:
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_cpp.h:20:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/code_generator.h:20:10: fatal error: 'string' file not found
20 | #include
| ^~~~~~~~
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_text.cpp:18:
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_text.h:20:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/code_generator.h:20:10: fatal error: 'string' file not found
20 | #include
| ^~~~~~~~
[ 11%] Building CXX object third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_go.cpp.o
/Users/tianhaogu/Documents/executorch/third-party/gflags/src/gflags_completions.cc:49:10: fatal error: 'cstdio' file not found
49 | #include
| ^~~~~~~~
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_dart.cpp:18:
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_dart.h:20:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/code_generator.h:20:10: fatal error: 'string' file not found
20 | #include
| ^~~~~~~~
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_kotlin_kmp.cpp:19:10: fatal error: 'functional' file not found
19 | #include
| ^~~~~~~~~~~~
In file included from In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/double.cpp/Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/single.cpp::1615:
:
In file included from In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/level1_impl.h/Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/level1_impl.h::10:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/common.h:21:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/Core:19:
/Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/src/Core/util/Macros.h:10714:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/common.h:21:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/Core:19:
/Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/src/Core/util/Macros.h:714:10: fatal error: 'cmath' file not found
: 714 | #in10c:l udefatal error: <c'cmath' file not foundmath>
| ^~~~~~~
714 | #include
| ^~~~~~~
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_go.cpp:19:
In file included from /Users/tianhaogu/Documents/executorch/third-party/flatbuffers/src/idl_gen_go.h:20:
/Users/tianhaogu/Documents/executorch/third-party/flatbuffers/include/flatbuffers/code_generator.h:20:10: fatal error: 'string' file not found
20 | #include
| ^~~~~~~~
1 error generated.
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/util.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
11 error error generated.
generated.
make[2]: *** [third-party/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_completions.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
1 error generated.
make[2]: *** [third-party/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags_reporting.cc.o] Error 1
1 error generated.
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/reflection.cpp.o] Error 1
make[2]: *** [third-party/gflags/CMakeFiles/gflags_nothreads_static.dir/src/gflags.cc.o] Error 1
make[1]: *** [third-party/gflags/CMakeFiles/gflags_nothreads_static.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
1 error generated.
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_binary.cpp.o] Error 1
1 error generated.
1 error generated.
1 error generated.
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_csharp.cpp.o] Error 1
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_text.cpp.o] Error 1
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_cpp.cpp.o] Error 1
[ 11%] Building CXX object kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/complex_single.cpp.o
1 error generated.
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_dart.cpp.o] Error 1
1 error generated.
1 error generated.
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_parser.cpp.o] Error 1
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_kotlin.cpp.o] Error 1
[ 11%] Building CXX object kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/complex_double.cpp.o
1 error generated.
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_kotlin_kmp.cpp.o] Error 1
1 error generated.
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/complex_single.cpp:16:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/level1_impl.h:10:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/common.h:21:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/Core:19:
/Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/src/Core/util/Macros.h:714:10: fatal error: 'cmath' file not found
714 | #include
| ^~~~~~~
make[2]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/src/idl_gen_go.cpp.o] Error 1
make[1]: *** [third-party/flatbuffers/CMakeFiles/flatc.dir/all] Error 2
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/complex_double.cpp:16:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/level1_impl.h:10:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/common.h:21:
In file included from /Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/Core:19:
/Users/tianhaogu/Documents/executorch/kernels/optimized/third-party/eigen/blas/../Eigen/src/Core/util/Macros.h:714:10: fatal error: 'cmath' file not found
714 | #include
| ^~~~~~~
1 error generated.
1 error generated.
make[2]: *** [kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/double.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/single.cpp.o] Error 1
1 error generated.
1 error generated.
make[2]: *** [kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/complex_double.cpp.o] Error 1
make[2]: *** [kernels/optimized/CMakeFiles/eigen_blas.dir/third-party/eigen/blas/complex_single.cpp.o] Error 1
make[1]: *** [kernels/optimized/CMakeFiles/eigen_blas.dir/all] Error 2
make: *** [all] Error 2
`
I had similar symptom with #5570 which i had issue with when running ./install_executorch.sh but I've already set the xcode to be correct path in my environment.
Versions
Collecting environment information...
PyTorch version: 2.6.0.dev20250104
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 15.3 (arm64)
GCC version: Could not collect
Clang version: 16.0.0 (clang-1600.0.26.6)
CMake version: version 3.31.4
Libc version: N/A
Python version: 3.10.0 (default, Mar 3 2022, 03:54:28) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-15.3-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Apple M1 Pro
Versions of relevant libraries:
[pip3] executorch==0.6.0a0+733973
[pip3] numpy==2.2.2
[pip3] torch==2.6.0.dev20250104
[pip3] torchao==0.8.0+git11333ba2
[pip3] torchaudio==2.6.0.dev20250104
[pip3] torchsr==1.0.4
[pip3] torchvision==0.22.0.dev20250104
[conda] executorch 0.6.0a0+733973 pypi_0 pypi
[conda] numpy 2.2.2 pypi_0 pypi
[conda] torch 2.6.0.dev20250104 pypi_0 pypi
[conda] torchao 0.8.0+git11333ba2 pypi_0 pypi
[conda] torchaudio 2.6.0.dev20250104 pypi_0 pypi
[conda] torchsr 1.0.4 pypi_0 pypi
[conda] torchvision 0.22.0.dev20250104 pypi_0 pypi
cc @cccclai
The text was updated successfully, but these errors were encountered: