4) 检测NDK是否安装完成: 在shell中输入“ndk-build”命令来检查你的安装是否成功,如果不是显示“ndk-build not found”。
NDK编译 NPU JNI so库
下载NPU JNI源码后,进入khadas_android_npu_library目录,如下
1 2 3 4 5 6 7 8
root@lxx-NUC10i7FNH:/home/lxx/khadas_android_npu/khadas_android_npu_library# ll total 24 drwxr-xr-x 5 root root 4096 Jun 3 13:46 ./ drwxr-xr-x 4 root root 4096 Jun 3 13:45 ../ drwxr-xr-x 5 root root 4096 Jun 4 13:54 detect_code/ drwxr-xr-x 8 root root 4096 Jun 3 14:04 .git/ drwxr-xr-x 5 root root 4096 Jun 3 13:46 model_code/ -rw-r--r-- 1 root root 28 Jun 3 13:45 README.md
1) 编译libkhadas_npu_jni.so
1 2 3 4 5 6 7 8 9
root@lxx-NUC10i7FNH:/home/lxx/khadas_android_npu/khadas_android_npu_library/detect_code# ndk-build Android NDK: android-9 is unsupported. Using minimum supported version android-14. Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information. /bin/sh: 1: test: -ge: unexpected operator Android NDK: WARNING:jni/Android.mk:khadas_npu_jni: non-system libraries in linker flags: -lopencv_java4 Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module [armeabi-v7a] Install : libkhadas_npu_jni.so => libs/armeabi-v7a/libkhadas_npu_jni.so
2) 编译libnn_yoloface.so
1 2 3 4 5 6 7 8 9
root@lxx-NUC10i7FNH:/home/lxx/khadas_android_npu/khadas_android_npu_library/model_code/detect_yoloface# ndk-build Android NDK: android-9 is unsupported. Using minimum supported version android-14. Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information. /bin/sh: 1: test: -ge: unexpected operator Android NDK: WARNING:jni/Android.mk:nn_yoloface: non-system libraries in linker flags: -lovxlib Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module [armeabi-v7a] Install : libnn_yoloface.so => libs/armeabi-v7a/libnn_yoloface.so
3) 编译libnn_yolo_v2.so
1 2 3 4 5 6 7 8 9
root@lxx-NUC10i7FNH:/home/lxx/khadas_android_npu/khadas_android_npu_library/model_code/detect_yolo_v2# ndk-build Android NDK: android-9 is unsupported. Using minimum supported version android-14. Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information. /bin/sh: 1: test: -ge: unexpected operator Android NDK: WARNING:jni/Android.mk:nn_yolo_v2: non-system libraries in linker flags: -lovxlib Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module [armeabi-v7a] Install : libnn_yolo_v2.so => libs/armeabi-v7a/libnn_yolo_v2.so
4) 编译libnn_yolo_v3.so
1 2 3 4 5 6 7 8 9
root@lxx-NUC10i7FNH:/home/lxx/khadas_android_npu/khadas_android_npu_library/model_code/detect_yolo_v3# ndk-build Android NDK: android-9 is unsupported. Using minimum supported version android-14. Android NDK: WARNING: APP_STL gnustl_static is deprecated and will be removed in the next release. Please switch to either c++_static or c++_shared. See https://developer.android.com/ndk/guides/cpp-support.html for more information. /bin/sh: 1: test: -ge: unexpected operator Android NDK: WARNING:jni/Android.mk:nn_yolo_v3: non-system libraries in linker flags: -lovxlib Android NDK: This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES Android NDK: or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the Android NDK: current module [armeabi-v7a] Install : libnn_yolo_v3.so => libs/armeabi-v7a/libnn_yolo_v3.so