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

compile libcaffe-jni.so issue #56

Open
lei9wang opened this issue Aug 7, 2018 · 1 comment
Open

compile libcaffe-jni.so issue #56

lei9wang opened this issue Aug 7, 2018 · 1 comment

Comments

@lei9wang
Copy link

lei9wang commented Aug 7, 2018

i replace caffe with myself caffe, then ./tools/build_android.sh
There is link error like this:
canning dependencies of target caffe
[ 57%] Linking CXX shared library ../../lib/libcaffe.so
[ 57%] Built target caffe
Scanning dependencies of target caffe-jni
[ 71%] Building CXX object src/jni/CMakeFiles/caffe-jni.dir/caffe_jni.cpp.o
[ 85%] Building CXX object src/jni/CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o
[100%] Linking CXX shared library ../../lib/libcaffe-jni.so
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::CPUTimer::CPUTimer()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::CPUTimer::Start()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::Blob::mutable_cpu_data()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::Timer::~Timer()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::Net::Forward(float*)'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::CPUTimer::Stop()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'vtable for caffe::CPUTimer'
/home/linux/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function (see go/missingkeymethod)
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::CPUTimer::MilliSeconds()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::Blob::cpu_data() const'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'caffe::Timer::~Timer()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::predictImage(unsigned char const*, int, std::vector<float, std::allocator > const&, std::vector<float, std::allocator >&): error: undefined reference to 'vtable for caffe::CPUTimer'
/home/linux/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function (see go/missingkeymethod)
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::Caffe::Get()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::CPUTimer::CPUTimer()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::CPUTimer::Start()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::Net::Net(std::string const&, caffe::Phase, int, std::vector<std::string, std::allocatorstd::string > const*)'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::Net::CopyTrainedLayersFrom(std::string)'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::CPUTimer::Stop()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::CPUTimer::MilliSeconds()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::Timer::~Timer()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'vtable for caffe::CPUTimer'
/home/linux/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function (see go/missingkeymethod)
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'caffe::Timer::~Timer()'
CMakeFiles/caffe-jni.dir/caffe_mobile.cpp.o:caffe_mobile.cpp:function caffe::CaffeMobile::CaffeMobile(std::string const&, std::string const&): error: undefined reference to 'vtable for caffe::CPUTimer'
/home/linux/android-ndk-r15c/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.9.x/../../../../arm-linux-androideabi/bin/ld: the vtable symbol may be undefined because the class is missing its key function (see go/missingkeymethod)
collect2: error: ld returned 1 exit status
src/jni/CMakeFiles/caffe-jni.dir/build.make:124: recipe for target 'lib/libcaffe-jni.so' failed
make[2]: *** [lib/libcaffe-jni.so] Error 1
CMakeFiles/Makefile2:212: recipe for target 'src/jni/CMakeFiles/caffe-jni.dir/all' failed
make[1]: *** [src/jni/CMakeFiles/caffe-jni.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

if compile static library libcaffe-jni, it is okay.
@solrex , could you give guide about this issue?

@solrex
Copy link
Owner

solrex commented Aug 8, 2018

@lei9wang Sorry, you cannot do that. The caffe source code in this project is modified, a lot. You can only add some self-defined layers, and fix the compiling errors yourself.

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

2 participants