Integrating MACE in Mobile PoseInference project
The problem is when I try to build any MACE repo the log indicates that mace lib is not working right. I get the very same log when I try to run the demo-mace - https://github.com/edvardHua/PoseEstimationForMobile/tree/master/android_demo/demo_mace. What would solve this?
Build command failed. Error while executing process /home/friande/Android/Sdk/cmake/3.6.4111459/bin/cmake with arguments {--build /home/friande/Desktop/demo_mace/macelibrary/.externalNativeBuild/cmake/debug/armeabi-v7a --target mace_mobile_jni} [1/2] Building CXX object CMakeFiles/mace_mobile_jni.dir/src/main/cpp/spe.cc.o [2/2] Linking CXX shared library ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libmace_mobile_jni.so FAILED: : && /home/friande/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi21 --gcc-toolchain=/home/friande/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/friande/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -fno-addrsig -march=armv7-a -mthumb -Wa,--noexecstack -Wformat -Werror=format-security -std=c++11 -fopenmp -O0 -fno-limit-debug-info -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libatomic.a -static-libstdc++ -Wl,--build-id -Wl,--warn-shared-textrel -Wl,--fatal-warnings -Wl,--exclude-libs,libunwind.a -Wl,--no-undefined -Qunused-arguments -Wl,-z,noexecstack -shared -Wl,-soname,libmace_mobile_jni.so -o ../../../../build/intermediates/cmake/debug/obj/armeabi-v7a/libmace_mobile_jni.so CMakeFiles/mace_mobile_jni.dir/src/main/cpp/spe.cc.o ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a ../../../../src/main/cpp/lib/armeabi-v7a/cpm.a /home/friande/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/21/liblog.so -latomic -lm && : ../../../../src/main/cpp/include/mace/public/mace_engine_factory.h:66: error: undefined reference to 'mace::MaceEngine::Init(mace::NetDef const*, std::__ndk1::vector<std::__ndk1::basic_string<char, std::__ndk1::char_traits
, std::__ndk1::allocator >, std::__ndk1::allocator<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator > > > const&, std::__ndk1::vector<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator >, std::__ndk1::allocator<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator > > > const&, unsigned char const*)' /home/friande/Desktop/demo_mace/macelibrary/src/main/cpp/spe.cc:104: error: undefined reference to 'mace::FileStorageFactory::FileStorageFactory(std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator > const&)' /home/friande/Desktop/demo_mace/macelibrary/src/main/cpp/spe.cc:105: error: undefined reference to 'mace::SetKVStorageFactory(std::__ndk1::shared_ptrmace::KVStorageFactory)' /home/friande/Desktop/demo_mace/macelibrary/src/main/cpp/spe.cc:201: error: undefined reference to 'mace::MaceTensor::MaceTensor(std::__ndk1::vector<long long, std::__ndk1::allocator > const&, std::__ndk1::shared_ptr )' /home/friande/Desktop/demo_mace/macelibrary/src/main/cpp/spe.cc:206: error: undefined reference to 'mace::MaceTensor::MaceTensor(std::__ndk1::vector<long long, std::__ndk1::allocator > const&, std::__ndk1::shared_ptr )' /home/friande/Desktop/demo_mace/macelibrary/src/main/cpp/spe.cc:209: error: undefined reference to 'mace::MaceEngine::Run(std::__ndk1::map<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator >, mace::MaceTensor, std::__ndk1::less<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator > >, std::__ndk1::allocator<std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator > const, mace::MaceTensor> > > const&, std::__ndk1::map<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator >, mace::MaceTensor, std::__ndk1::less<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator > >, std::__ndk1::allocator<std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits , std::__ndk1::allocator > const, mace::MaceTensor> > >)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o)(.text._ZN4mace18FileStorageFactory4ImplC2ERKSs+0x0): error: undefined reference to 'std::basic_string<char, std::char_traits , std::allocator , unsigned int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::append(std::string const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator>::basic_string(std::string const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::basic_string<char, std::char_traits , std::allocator >::basic_string(std::string const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::append(char const const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_M_destroy(std::allocator const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::Impl::CreateStorage(std::string const&): error: undefined reference to 'std::string::_Rep::_S_empty_rep_storage' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::FileStorageFactory::FileStorageFactory(std::string const&): error: undefined reference to 'std::basic_string<char, std::char_traits , std::allocator >::basic_string(std::string const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetKVStorageFactory(std::shared_ptrmace::KVStorageFactory): error: undefined reference to 'std::basic_ostream<char, std::char_traits >& std::__ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const*, int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetOpenCLParameterPath(std::string const&): error: undefined reference to 'std::string::assign(std::string const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetGPUHints(mace::GPUPerfHint, mace::GPUPriorityHint): error: undefined reference to 'std::basic_ostream<char, std::char_traits >& std::__ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const*, int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetGPUHints(mace::GPUPerfHint, mace::GPUPriorityHint): error: undefined reference to 'std::ostream::operator<<(int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetGPUHints(mace::GPUPerfHint, mace::GPUPriorityHint): error: undefined reference to 'std::basic_ostream<char, std::char_traits >& std::__ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const*, int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetGPUHints(mace::GPUPerfHint, mace::GPUPriorityHint): error: undefined reference to 'std::ostream::operator<<(int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetOpenMPThreadPolicy(int, mace::CPUAffinityPolicy): error: undefined reference to 'std::basic_ostream<char, std::char_traits >& std::__ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const*, int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetOpenMPThreadPolicy(int, mace::CPUAffinityPolicy): error: undefined reference to 'std::ostream::operator<<(int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace_runtime.o):mace/libmace/mace_runtime.cc:function mace::SetOpenMPThreadPolicy(int, mace::CPUAffinityPolicy): error: undefined reference to 'std::ostream::operator<<(int)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function float*&& mace::logging::CheckNotNull<float*>(char const*, int, char const*, float*&&): error: undefined reference to 'std::basic_string<char, std::char_traits , std::allocator >::basic_string(char const*, std::allocator const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function mace::MaceEngine::Impl::Impl(mace::DeviceType): error: undefined reference to 'std::basic_ios<char, std::char_traits >::clear(std::_Ios_Iostate)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function mace::MaceEngine::Impl::Init(mace::NetDef const*, std::vector<std::string, std::allocatorstd::string > const&, std::vector<std::string, std::allocatorstd::string > const&, unsigned char const*): error: undefined reference to 'std::basic_string<char, std::char_traits , std::allocator >::basic_string(char const*, std::allocator const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function mace::MaceEngine::Impl::Init(mace::NetDef const*, std::vector<std::string, std::allocatorstd::string > const&, std::vector<std::string, std::allocatorstd::string > const&, unsigned char const*): error: undefined reference to 'std::basic_string<char, std::char_traits , std::allocator >::basic_string(std::string const&)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function std::vector<std::string, std::allocatorstd::string > mace::MapKeysmace::InputInfo(std::map<std::string, mace::InputInfo, std::lessstd::string, std::allocator<std::pair<std::string const, mace::InputInfo> > > const&): error: undefined reference to 'std::_Rb_tree_increment(std::_Rb_tree_node_base const*)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function std::string mace::MakeString<char [17], std::string>(char const (&) [17], std::string const&): error: undefined reference to 'std::basic_stringstream<char, std::char_traits , std::allocator >::basic_stringstream(std::_Ios_Openmode)' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function std::string mace::MakeString<char [17], std::string>(char const (&) [17], std::string const&): error: undefined reference to 'std::basic_stringbuf<char, std::char_traits , std::allocator >::str() const' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function std::string mace::MakeString<char [17], std::string>(char const (&) [17], std::string const&): error: undefined reference to 'std::locale::~locale()' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function std::string mace::MakeString<char [17], std::string>(char const (&) [17], std::string const&): error: undefined reference to 'std::ios_base::~ios_base()' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function std::string mace::MakeString<char [17], std::string>(char const (&) [17], std::string const&): error: undefined reference to 'std::locale::~locale()' ../../../../src/main/cpp/lib/armeabi-v7a/libmace.a(mace.o):mace/libmace/mace.cc:function std::string mace::MakeString<char [17], std::string>(char const (&) [17], std::string const&): error: undefined reference to 'std::ios_base::~ios_base()'
......
I met this issue too. I solved it by setting the NDK in the setting of Android Studio. Remember that you have installed an NDK whose name is like "r15b"? Find the download location and fill it into the NDK path
I encountered this too, as well as others in issue #22
I followed the advices in that issue and modified the build.gradle(app) and build.gradle(macelibrary) files as such:
build.gradle(app)
externalNativeBuild {
cmake {
arguments '-DANDROID_STL=gnustl_static'
}
}
build.gradle(macelibrary)
externalNativeBuild {
cmake {
cppFlags "-std=c++11 -fopenmp"
abiFilters "armeabi-v7a"
arguments '-DANDROID_STL=gnustl_static'
}
}