Build sherpa-onnx for Qualcomm NPU
Before you continue, we assume you have followed Download QNN SDK
to download QNN SDK and set up the environment variable QNN_SDK_ROOT.
You should run:
echo $QNN_SDK_ROOT
to check that it points to the QNN SDK directory.
Also, we assume you have installed Android NDK and set up the environment variable ANDROID_NDK.
You can use the following commands to build sherpa-onnx for Qualcomm NPU.
git clone https://github.com/k2-fsa/sherpa-onnx
cd sherpa-onnx
export SHERPA_ONNX_ENABLE_QNN=ON
export SHERPA_ONNX_ENABLE_BINARY=ON
./build-android-arm64-v8a.sh
After building, you should get the following shared libraries and executables.
Executable files
ls -lh build-android-arm64-v8a/install/bin/sherpa-onnx-offline
-rwxr-xr-x@ 1 fangjun staff 2.2M 20 Nov 17:05 build-android-arm64-v8a/install/bin/sherpa-onnx-offline
file build-android-arm64-v8a/install/bin/sherpa-onnx-offline
build-android-arm64-v8a/install/bin/sherpa-onnx-offline: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /system/bin/linker64, BuildID[sha1]=6d693f987dea91ad36931a1709315ae88f3b7090, stripped
We describe how to run the executable files on your phone with adb in Run executables on your phone with adb.
See Build Android examples for how to use the generated shared libraries.