Hello I am installing caffe in ubuntu and anaconda 3 from this link https://yangcha.github.io/Caffe-Conda3/ However I got this error.
[ 82%] Linking CXX shared library ../../lib/libcaffe.so
[ 82%] Built target caffe
Scanning dependencies of target upgrade_solver_proto_text
[ 82%] Building CXX object tools/CMakeFiles/upgrade_solver_proto_text.dir/upgrade_solver_proto_text.cpp.o
[ 83%] Linking CXX executable upgrade_solver_proto_text
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyClass_Type'
../lib/libcaffe.so.1.0.0: undefined reference to `leveldb::Status::ToString[abi:cxx11]() const'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyFile_AsFile'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_Size'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromStringAndSize'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `Py_InitModule4_64'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_InternFromString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_Type'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_FromLong'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_AsWideChar'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyInt_AsLong'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyFile_FromString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_Divide'
../lib/libcaffe.so.1.0.0: undefined reference to `leveldb::DB::Open(leveldb::Options const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, leveldb::DB**)'
../lib/libcaffe.so.1.0.0: undefined reference to `google::base::CheckOpMessageBuilder::NewString[abi:cxx11]()'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_Type'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_AsString'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyString_FromFormat'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyUnicodeUCS4_FromEncodedObject'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `PyNumber_InPlaceDivide'
collect2: error: ld returned 1 exit status
tools/CMakeFiles/upgrade_solver_proto_text.dir/build.make:129: recipe for target 'tools/upgrade_solver_proto_text' failed
make[2]: *** [tools/upgrade_solver_proto_text] Error 1
CMakeFiles/Makefile2:467: recipe for target 'tools/CMakeFiles/upgrade_solver_proto_text.dir/all' failed
make[1]: *** [tools/CMakeFiles/upgrade_solver_proto_text.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
mspl@mspl-All-Series:~/caffe_anaconda/caffe/build$
Anny suggestion how to fix this?
-Thank you-
Please do not post usage, installation, or modeling questions, or other requests for help to Issues. Use the caffe-users list instead. This helps developers maintain a clear, uncluttered, and efficient view of the state of Caffe. Please read the guidelines for contributing before submitting an issue or a pull request.
One can find several related compilation problems elsewhere in the internet, for example this one. Please research some of the existing solutions and if you decide to post on the caffe-users list, please mention which ones have you tried and to which effect.
@herleeyandi I have the same problem. Can you tell me your solution?
@herleeyandi I have the same problem. Can you tell me your solution?
No solution to this problem yet ... neither on StackOverflow nor on the caffe-users list.
Any updates on this question?
had to re-install Boost for my platform and make sure that this .so file was reachable in the LIB directories (e.g. /usr/local/lib or something else depending on the machine) specified in the Makefile.config.
Hello friends especially @hologerry and @Yiman-GO I am so sorry for late reply. To be honest I don't have a solution for this problem. I don't use caffe anymore because the installation is too complicated and when we facing the error no one reply your question and give solution, even close it because its not followed their guideline. I am so sorry I can't help you all. I hope caffe can make PyPI installation and works well so the beginner user like me, no need to install from scratch.
Looks like you're trying to build caffe with python3, and boost.python is built with python2. Please check this post: https://stackoverflow.com/questions/25188861/libboost-python3-so-1-56-0-undefined-symbol-pyclass-type
I've gotten the same problem now, here is my solution:
:~$ cd /usr/lib/x86_64-linux-gnu/
:/usr/lib/x86_64-linux-gnu$ sudo unlink libboost_python.so
:/usr/lib/x86_64-linux-gnu$ sudo ln -s /usr/lib/x86_64-linux-gnu/libboost_python-py35.so /usr/lib/x86_64-linux-gnu/libboost_python.so
Thanks, @Xin-BroadData. I had both libbooost version 27 and 35.
$ cd /usr/lib/x86_64-linux-gnu
Output:
lrwxrwxrwx 1 root root 22 Jun 14 2016 libboost_python.a -> libboost_python-py27.a
-rw-r--r-- 1 root root 673046 Jun 14 2016 libboost_python-py27.a
lrwxrwxrwx 1 root root 30 Jun 14 2016 libboost_python-py27.so -> libboost_python-py27.so.1.58.0
-rw-r--r-- 1 root root 310128 Jun 14 2016 libboost_python-py27.so.1.58.0
-rw-r--r-- 1 root root 664980 Jun 14 2016 libboost_python-py35.a
lrwxrwxrwx 1 root root 30 Jun 14 2016 libboost_python-py35.so -> libboost_python-py35.so.1.58.0
-rw-r--r-- 1 root root 306000 Jun 14 2016 libboost_python-py35.so.1.58.0
lrwxrwxrwx 1 root root 23 Jun 14 2016 libboost_python.so -> libboost_python-py27.so
And, Change the soft links worked for me, Could be a compatibility issue,
$ sudo unlink libboost_python.so
$ sudo unlink libboost_python.a
$ sudo ln -s libboost_python-py35.so libboost_python.so
$ sudo ln -s libboost_python-py35.a libboost_python.a
Chiming in to say that for general applications, if you are linking against lpython*.so and libboost_python*.so, it seems that, generally, the versions need to match, ie. -lpython3.8 -lboost_python38
Most helpful comment
Hello friends especially @hologerry and @Yiman-GO I am so sorry for late reply. To be honest I don't have a solution for this problem. I don't use caffe anymore because the installation is too complicated and when we facing the error no one reply your question and give solution, even close it because its not followed their guideline. I am so sorry I can't help you all. I hope caffe can make PyPI installation and works well so the beginner user like me, no need to install from scratch.