moli232777144 / mtcnn_ncnn

基于ncnn框架搭建win及android端的MTCNN人脸检测工程
527 stars 177 forks source link

android studio上编译错误,已安装lldb,cmake,ndk #17

Open liujinglin opened 6 years ago

liujinglin commented 6 years ago

Build command failed. Error while executing '/Users/bitmain/Library/Android/sdk/cmake/3.6.4111459/bin/cmake' with arguments {--build /Users/bitmain/Work/openLib/mtcnn_ncnn/mtcnn_AS/app/.externalNativeBuild/cmake/debug/armeabi-v7a --target mtcnn} [1/3] Building CXX object CMakeFiles/mtcnn.dir/src/main/cpp/mtcnn.cpp.o [2/3] Building CXX object CMakeFiles/mtcnn.dir/src/main/cpp/mtcnn_jni.cpp.o [3/3] Linking CXX shared library ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libmtcnn.so FAILED: : && /Users/bitmain/Library/Android/sdk/ndk-bundle/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=armv7-none-linux-androideabi --gcc-toolchain=/Users/bitmain/Library/Android/sdk/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64 --sysroot=/Users/bitmain/Library/Android/sdk/ndk-bundle/sysroot -fPIC -isystem /Users/bitmain/Library/Android/sdk/ndk-bundle/sysroot/usr/include/arm-linux-androideabi -DANDROID_API=17 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -fopenmp -O2 -fvisibility=hidden -fvisibility-inlines-hidden -fomit-frame-pointer -fstrict-aliasing -ffunction-sections -fdata-sections -ffast-math -std=c++11 -frtti -fexceptions -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -nostdlib++ --sysroot /Users/bitmain/Library/Android/sdk/ndk-bundle/platforms/android-17/arch-arm -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--fix-cortex-a8 -Wl,--exclude-libs,libunwind.a -L/Users/bitmain/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a -Wl,--no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libmtcnn.so -o ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libmtcnn.so CMakeFiles/mtcnn.dir/src/main/cpp/mtcnn.cpp.o CMakeFiles/mtcnn.dir/src/main/cpp/mtcnn_jni.cpp.o ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a -ljnigraphics -lz -llog -latomic -lm "/Users/bitmain/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_static.a" "/Users/bitmain/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++abi.a" "/Users/bitmain/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libandroid_support.a" "/Users/bitmain/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libunwind.a" "-ldl" && : ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::~Net(): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::~Net(): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::~Net(): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::~Net(): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::clear(): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::clear(): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(sFILE): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(__sFILE): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const, std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(__sFILE): error: undefined reference to 'std::string::assign(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(sFILE): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const, std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(sFILE): error: undefined reference to 'std::string::assign(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(__sFILE): error: undefined reference to 'std::string::compare(char const*) const' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(sFILE): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const, std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(sFILE): error: undefined reference to 'std::string::assign(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(__sFILE): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const, std::allocator const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(__sFILE): error: undefined reference to 'std::string::assign(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::load_param(sFILE): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::find_blob_index_by_name(char const) const: error: undefined reference to 'std::string::compare(char const) const' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Net::find_layer_index_by_name(char const) const: error: undefined reference to 'std::string::compare(char const) const' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function ncnn::Extractor::input(char const, ncnn::Mat const&): error: undefined reference to 'std::string::compare(char const) const' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<ncnn::layer_registry_entry, std::allocator >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::layer_registry_entry, std::vector<ncnn::layer_registry_entry, std::allocator > >, unsigned int, ncnn::layer_registry_entry const&): error: undefined reference to 'std::throw_length_error(char const)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<ncnn::Layer, std::allocator<ncnn::Layer*> >::_M_fill_insert(__gnu_cxx::normal_iterator<ncnn::Layer*, std::vector<ncnn::Layer, std::allocator<ncnn::Layer> > >, unsigned int, ncnn::Layer const&): error: undefined reference to 'std::throw_length_error(char const*)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<ncnn::Blob, std::allocator >::_M_fill_insert(__gnu_cxx::normal_iterator<ncnn::Blob, std::vector<ncnn::Blob, std::allocator > >, unsigned int, ncnn::Blob const&): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<ncnn::Blob, std::allocator >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::Blob, std::vector<ncnn::Blob, std::allocator > >, unsigned int, ncnn::Blob const&): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<ncnn::Blob, std::allocator >::_M_fill_insert(gnu_cxx::__normal_iterator<ncnn::Blob*, std::vector<ncnn::Blob, std::allocator > >, unsigned int, ncnn::Blob const&): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<ncnn::Blob, std::allocator >::_M_fill_insert(gnu_cxx::normal_iterator<ncnn::Blob*, std::vector<ncnn::Blob, std::allocator > >, unsigned int, ncnn::Blob const&): error: undefined reference to 'std::basic_string<char, std::char_traits, std::allocator >::basic_string(std::string const&)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<ncnn::Blob, std::allocator >::_M_fill_insert(__gnu_cxx::normal_iterator<ncnn::Blob, std::vector<ncnn::Blob, std::allocator > >, unsigned int, ncnn::Blob const&): error: undefined reference to 'std::__throw_length_error(char const)' ../../../../src/main/jniLibs/armeabi-v7a/libncnn.a(net.cpp.o):/home/nihui/osd/ncnn/src/net.cpp:function std::vector<int, std::allocator >::_M_fill_insert(gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator > >, unsigned int, int const&): error: undefined reference to 'std::throw_length_error(char const*)' clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.

急需帮助,谢谢

zhangsn828 commented 6 years ago

请问这个问题解决了吗?

moli232777144 commented 6 years ago

你们这些环境问题,基本都出在链接libncnn的库,可以自己按教程AS搭一遍,或者用自己版本NDK编译的libncnn.a,不然作者relase提供的,ndk只能换15和16编译是正常。

zhangsn828 commented 6 years ago

非常感谢,的确是ndk版本不一致,换成16的就好了