Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to cross compile with QNN backend #7468

Open
huangzhiyuan opened this issue Jan 2, 2025 · 1 comment
Open

Failed to cross compile with QNN backend #7468

huangzhiyuan opened this issue Jan 2, 2025 · 1 comment
Labels
module: qnn Related to Qualcomm's QNN delegate

Comments

@huangzhiyuan
Copy link

Compile with reference to these two documents.

The steps I used to reproduce:

mkdir build_cross
cd build_cross

export QNN_SDK_ROOT=the/path/to/qnn/sdk
export EXECUTORCH_ROOT=./executorch
export LD_LIBRARY_PATH=$QNN_SDK_ROOT/lib/x86_64-linux-clang/:$LD_LIBRARY_PATH
export PYTHONPATH=$EXECUTORCH_ROOT/..

cmake .. \
    -DCMAKE_INSTALL_PREFIX=$PWD \
    -DEXECUTORCH_BUILD_QNN=ON \
    -DQNN_SDK_ROOT=$QNN_SDK_ROOT \
    -DEXECUTORCH_BUILD_DEVTOOLS=ON \
    -DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
    -DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
    -DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
    -DPYTHON_EXECUTABLE=python3 \
    -DCMAKE_TOOLCHAIN_FILE=cross_compile.cmake \
    -DEXECUTORCH_SEPARATE_FLATCC_HOST_PROJECT=OFF \
    -B$PWD

cmake --build $PWD -j16 --target install

cross_compile.cmake:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)

set(TOOLCHAIN_ROOT "/opt/toolchains/aarch64-oe-linux-9.3-glibc-2.31")
set(TOOLCHAIN_PREFIX ${TOOLCHAIN_ROOT}/sysroots/x86_64-oesdk-linux/usr/bin/aarch64-oe-linux/aarch64-oe-linux-)
set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++)
set(CMAKE_SYSROOT ${TOOLCHAIN_ROOT}/sysroots/aarch64-oe-linux)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a")

error log:

/bin/sh: 1: flatc: not found
backends/qualcomm/CMakeFiles/qcir.dir/build.make:70: recipe for target 'backends/qualcomm/qcir_schema_output' failed
make[2]: *** [backends/qualcomm/qcir_schema_output] Error 127
CMakeFiles/Makefile2:1054: recipe for target 'backends/qualcomm/CMakeFiles/qcir.dir/all' failed
make[1]: *** [backends/qualcomm/CMakeFiles/qcir.dir/all] Error 2
/bin/sh: 1: flatc: not found
backends/qualcomm/CMakeFiles/qnn_schema.dir/build.make:70: recipe for target 'schema/include/executorch/backends/qualcomm/qc_compiler_spec_generated.h' failed
make[2]: *** [schema/include/executorch/backends/qualcomm/qc_compiler_spec_generated.h] Error 127
CMakeFiles/Makefile2:1614: recipe for target 'backends/qualcomm/CMakeFiles/qnn_schema.dir/all' failed
make[1]: *** [backends/qualcomm/CMakeFiles/qnn_schema.dir/all] Error 2
/bin/sh: 1: flatc: not found
devtools/CMakeFiles/bundled_program_schema.dir/build.make:72: recipe for target 'devtools/bundled_program/executorch/devtools/bundled_program/schema/bundled_program_schema_generated.h' failed
make[2]: *** [devtools/bundled_program/executorch/devtools/bundled_program/schema/bundled_program_schema_generated.h] Error 127
CMakeFiles/Makefile2:1804: recipe for target 'devtools/CMakeFiles/bundled_program_schema.dir/all' failed
make[1]: *** [devtools/CMakeFiles/bundled_program_schema.dir/all] Error 2
Makefile:135: recipe for target 'all' failed
make: *** [all] Error 2

but I have added the flatc to $PATH :

$ which flatc
./third-party/flatbuffers/flatc

Any suggestions for this error? thanks~

@kimishpatel
Copy link
Contributor

Can you detail the steps you took to install ExecuTorch?

Another option is to specify flatc localtion via -DFLATC_EXECUTABLE='which flatc like here

-DFLATC_EXECUTABLE="$(which flatc)" \
. However, I believe it should not be needed if things are setup correctly

@kimishpatel kimishpatel added the module: qnn Related to Qualcomm's QNN delegate label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: qnn Related to Qualcomm's QNN delegate
Projects
None yet
Development

No branches or pull requests

2 participants