使用python编译caffe的问题,未定义引用`std :: __ cxx11 :: ....'

时间:2016-11-04 04:46:31

标签: python linux c++11 gcc caffe

我曾经在Ubuntu 14.04上用WITH_PYTHON_LAYER:= 1成功编译了caffe。然后我切换到Ubuntu 16.04,使用相同的设置,但不同的内置软件,如g ++ 5.4 for 16.04而不是g ++ 4.8 for 14.04,我无法用python编译caffe。你能就这个问题给我一些建议吗?以下是我收到的错误消息

的一部分
.build_release/lib/libcaffe.so: undefined reference to `std::overflow_error::overflow_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::find(char, unsigned long) const'
.build_release/lib/libcaffe.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct(unsigned long, char)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libboost_python.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_construct(unsigned long, wchar_t)@GLIBCXX_3.4.21'
//usr/lib/x86_64-linux-gnu/libtbb.so.2: undefined reference to `std::out_of_range::out_of_range(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libgflags.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCXX_3.4.21'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libglog.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21'
.build_release/lib/libcaffe.so: undefined reference to `std::out_of_range::out_of_range(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
Makefile:619: recipe for target '.build_release/tools/caffe.bin' failed
make: *** [.build_release/tools/caffe.bin] Error 1

1 个答案:

答案 0 :(得分:0)

遵循cmake的官方安装说明解决了这个问题。

解决方案的步骤:
1.在您的CAFFE /目录中运行make clean
2. compile_caffe_with_cmake的后续指示。