Closed VivienFu closed 7 years ago
Ubuntu下,通过CMake编译成功,在ncnn-master/build/src下生成了libncnn.a,并能够正确运行squeezenet实例。
现在将ncnn-master/example/squeezencnn/jni下android.mk中路径改为我的路径,如下: NCNN_INSTALL_PATH := /home/workspace/ncnn/ncnn-master LOCAL_SRC_FILES := $(NCNN_INSTALL_PATH)/build/src/libncnn.a LOCAL_C_INCLUDES := $(NCNN_INSTALL_PATH)/src 并把ncnn-master/build/src下platform.h复制到ncnn-master/src中。
然后在ncnn-master/example/squeezencnn/jni下用ndk-build编译,结果报错如下: Android NDK: android-9 is unsupported. Using minimum supported version android-14. Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 1 in /home/workspace/ncnn/ncnn-master/examples/squeezencnn/AndroidManifest.xml. NDK binaries will not be comptible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information. [armeabi-v7a] SharedLibrary : libsqueezencnn.so /home/Android/android-ndk-r15b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /home/workspace/ncnn/ncnn-master/build/src/libncnn.a(mat.cpp.o): incompatible target /home/Android/android-ndk-r15b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /home/workspace/ncnn/ncnn-master/build/src/libncnn.a(mat_pixel.cpp.o): incompatible target /home/Android/android-ndk-r15b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /home/workspace/ncnn/ncnn-master/# build/src/libncnn.a(net.cpp.o): incompatible target /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:81: error: undefined reference to 'ncnn::Net::load_param(unsigned char const)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:90: error: undefined reference to 'ncnn::Net::load_model(unsigned char const)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:126: error: undefined reference to 'ncnn::Mat::from_pixels(unsigned char const, int, int, int)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:135: error: undefined reference to 'ncnn::Mat::substract_mean_normalize(float const, float const*)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:137: error: undefined reference to 'ncnn::Net::create_extractor() const' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:138: error: undefined reference to 'ncnn::Extractor::set_light_mode(bool)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:139: error: undefined reference to 'ncnn::Extractor::set_num_threads(int)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:141: error: undefined reference to 'ncnn::Extractor::input(int, ncnn::Mat const&)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:144: error: undefined reference to 'ncnn::Extractor::extract(int, ncnn::Mat&)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:51: error: undefined reference to 'ncnn::Net::Net()' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:51: error: undefined reference to 'ncnn::Net::~Net()' collect2: error: ld returned 1 exit status make: *** [/home/workspace/ncnn/ncnn-master/examples/squeezencnn/obj/local/armeabi-v7a/libsqueezencnn.so] Error 1
大神可不可以帮我我看看会是什么问题呢
libncnn.a 是 pc 架构的吧,android 的要用 android.toolchain.cmake 编译这个 libncnn.a https://github.com/Tencent/ncnn/wiki/cmake-%E6%89%93%E5%8C%85-android-sdk
楼主解决了吗?
楼主问题解决了吗?我也遇到了相同的问题,请问怎么解决的呢?谢谢!
Ubuntu下,通过CMake编译成功,在ncnn-master/build/src下生成了libncnn.a,并能够正确运行squeezenet实例。
现在将ncnn-master/example/squeezencnn/jni下android.mk中路径改为我的路径,如下: NCNN_INSTALL_PATH := /home/workspace/ncnn/ncnn-master LOCAL_SRC_FILES := $(NCNN_INSTALL_PATH)/build/src/libncnn.a LOCAL_C_INCLUDES := $(NCNN_INSTALL_PATH)/src 并把ncnn-master/build/src下platform.h复制到ncnn-master/src中。
然后在ncnn-master/example/squeezencnn/jni下用ndk-build编译,结果报错如下: Android NDK: android-9 is unsupported. Using minimum supported version android-14.
Android NDK: WARNING: APP_PLATFORM android-14 is higher than android:minSdkVersion 1 in /home/workspace/ncnn/ncnn-master/examples/squeezencnn/AndroidManifest.xml. NDK binaries will not be comptible with devices older than android-14. See https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md for more information.
[armeabi-v7a] SharedLibrary : libsqueezencnn.so /home/Android/android-ndk-r15b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /home/workspace/ncnn/ncnn-master/build/src/libncnn.a(mat.cpp.o): incompatible target /home/Android/android-ndk-r15b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /home/workspace/ncnn/ncnn-master/build/src/libncnn.a(mat_pixel.cpp.o): incompatible target /home/Android/android-ndk-r15b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: error: /home/workspace/ncnn/ncnn-master/# build/src/libncnn.a(net.cpp.o): incompatible target /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:81: error: undefined reference to 'ncnn::Net::load_param(unsigned char const)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:90: error: undefined reference to 'ncnn::Net::load_model(unsigned char const)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:126: error: undefined reference to 'ncnn::Mat::from_pixels(unsigned char const, int, int, int)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:135: error: undefined reference to 'ncnn::Mat::substract_mean_normalize(float const, float const*)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:137: error: undefined reference to 'ncnn::Net::create_extractor() const' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:138: error: undefined reference to 'ncnn::Extractor::set_light_mode(bool)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:139: error: undefined reference to 'ncnn::Extractor::set_num_threads(int)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:141: error: undefined reference to 'ncnn::Extractor::input(int, ncnn::Mat const&)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:144: error: undefined reference to 'ncnn::Extractor::extract(int, ncnn::Mat&)' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:51: error: undefined reference to 'ncnn::Net::Net()' /home/workspace/ncnn/ncnn-master/examples/squeezencnn/jni/squeezencnn_jni.cpp:51: error: undefined reference to 'ncnn::Net::~Net()' collect2: error: ld returned 1 exit status make: *** [/home/workspace/ncnn/ncnn-master/examples/squeezencnn/obj/local/armeabi-v7a/libsqueezencnn.so] Error 1
大神可不可以帮我我看看会是什么问题呢