交叉编译caffe时,遇见boost函数undefined reference to `boost::xxxxxx

交叉编译caffe时,遇见boost函数undefined reference to `boost::xxxxxx

修改makefile文件,将需要的boost::xxxxxx库,加到LIBRARIES后面

例如

.build_release/lib/libcaffe.so: undefined reference to `boost::cpp_regex_traits::toi(char const*&, char const*, int) const'
.build_release/lib/libcaffe.so: undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'
.build_release/lib/libcaffe.so: undefined reference to `boost::re_detail::cpp_regex_traits_implementation::transform(char const*, char const*) const'
.build_release/lib/libcaffe.so: undefined reference to `boost::re_detail::put_mem_block(void*)'
.build_release/lib/libcaffe.so: undefined reference to `boost::basic_regex > >::do_assign(char const*, char const*, unsigned int)'
.build_release/lib/libcaffe.so: undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'

上面错误是 undefined reference没有将regex填入LIBRARIES 中

修改LIBRARIES ,将boost_regex加入进去

# We will also explicitly add stdc++ to the link target.
LIBRARIES +=  boost_regex boost_atomic boost_thread stdc++

你可能感兴趣的:(交叉编译)