【问题标题】:Issues with compiling caffe with python, undefined reference to `std::__cxx11::....'使用 python 编译 caffe 的问题,未定义的对 `std::__cxx11::....' 的引用
【发布时间】:2017-03-17 20:40:03
【问题描述】:

我曾经在 Ubuntu 14.04 上使用 WITH_PYTHON_LAYER:=1 成功编译 caffe。然后我切换到 Ubuntu 16.04,使用相同的设置但不同的内置软件,例如 16.04 的 g++ 5.4 而不是 14.04 的 g++ 4.8,我无法用 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

【问题讨论】:

  • 看起来您没有与标准库链接。图书馆的构建系统是什么?
  • 我不确定它是什么构建系统。请您具体说明我需要为您提供哪些信息?
  • 你如何构建它?你是先输入“./configure”然后再输入“make”,还是必须先输入“cmake ..”之类的?
  • 只需按照官方 Caffe 安装说明中的说明进行操作即可。我没有运行 ./configure。首先,我编辑了 Makefile.config,它用于选择您想要的选项并配置 lib 和 include_files 的路径。其次,我运行 make -j8 来编译项目
  • 复制失败的整个 g++ 命令行

标签: python linux c++11 gcc caffe


【解决方案1】:

按照官方安装说明使用 cmake 解决了这个问题。

解决步骤:
1. 在你的 CAFFE/ 目录下运行make clean
2. 关注compile_caffe_with_cmake.

【讨论】:

    猜你喜欢
    • 2016-04-25
    • 1970-01-01
    • 1970-01-01
    • 2016-08-28
    • 2021-07-19
    • 2017-04-04
    • 2015-03-15
    • 1970-01-01
    相关资源
    最近更新 更多