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

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

Open
liujinglin opened this issue Jul 17, 2018 · 3 comments
Open

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

liujinglin opened this issue Jul 17, 2018 · 3 comments

Comments

@liujinglin
Copy link

liujinglin commented Jul 17, 2018

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 -D__ANDROID_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::allocatorncnn::layer_registry_entry >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::layer_registry_entry*, std::vector<ncnn::layer_registry_entry, std::allocatorncnn::layer_registry_entry > >, 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::allocatorncnn::Layer* >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::Layer**, std::vector<ncnn::Layer*, std::allocatorncnn::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::allocatorncnn::Blob >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::Blob*, std::vector<ncnn::Blob, std::allocatorncnn::Blob > >, 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::allocatorncnn::Blob >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::Blob*, std::vector<ncnn::Blob, std::allocatorncnn::Blob > >, 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::allocatorncnn::Blob >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::Blob*, std::vector<ncnn::Blob, std::allocatorncnn::Blob > >, 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::allocatorncnn::Blob >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::Blob*, std::vector<ncnn::Blob, std::allocatorncnn::Blob > >, 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::allocatorncnn::Blob >::_M_fill_insert(__gnu_cxx::__normal_iterator<ncnn::Blob*, std::vector<ncnn::Blob, std::allocatorncnn::Blob > >, 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
Copy link

请问这个问题解决了吗?

@moli232777144
Copy link
Owner

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

@zhangsn828
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants