Caffe: Compile issue about boost and cv

Created on 20 Apr 2017  路  7Comments  路  Source: weiliu89/caffe

hi:
Ubuntu 16.10
opencv 3.1
when i compile ssd,the error is

CXX/LD -o .build_release/tools/upgrade_net_proto_text.bin
.build_release/lib/libcaffe.so: undefined reference to boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)' .build_release/lib/libcaffe.so: undefined reference tocv::VideoCapture::set(int, double)'
.build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::open(int)' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator, std::allocator > >, std::allocator, std::allocator > > > >, boost::regex_traits > >::construct_init(boost::basic_regex > > const&, boost::regex_constants::_match_flags)'
.build_release/lib/libcaffe.so: undefined reference to boost::cpp_regex_traits<char>::toi(char const*&, char const*, int) const' .build_release/lib/libcaffe.so: undefined reference tocv::VideoWriter::write(cv::Mat const&)'
.build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::open(cv::String const&)' .build_release/lib/libcaffe.so: undefined reference tocv::VideoWriter::isOpened() const'
.build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const' .build_release/lib/libcaffe.so: undefined reference tocv::VideoCapture::release()'
.build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::operator>>(cv::Mat&)' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::cpp_regex_traits_implementation::transformabi:cxx11 const'
.build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::raise_runtime_error(std::runtime_error const&)' .build_release/lib/libcaffe.so: undefined reference tocv::VideoWriter::~VideoWriter()'
.build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::~VideoCapture()' .build_release/lib/libcaffe.so: undefined reference tocv::VideoWriter::VideoWriter(cv::String const&, int, double, cv::Size_, bool)'
.build_release/lib/libcaffe.so: undefined reference to boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::get_mem_block()'
.build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::isOpened() const' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::get_default_error_string(boost::regex_constants::error_type)'
.build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::put_mem_block(void*)' .build_release/lib/libcaffe.so: undefined reference tocv::VideoWriter::VideoWriter()'
.build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::get(int) const' .build_release/lib/libcaffe.so: undefined reference tocv::VideoCapture::VideoCapture()'
.build_release/lib/libcaffe.so: undefined reference to `boost::re_detail_106100::verify_options(unsigned int, boost::regex_constants::_match_flags)'
collect2: error: ld returned 1 exit status
Makefile:625: recipe for target '.build_release/tools/upgrade_net_proto_text.bin' failed
make: * [.build_release/tools/upgrade_net_proto_text.bin] Error 1

Most helpful comment

You could add opencv_videoio and boost_regex at the end of LIBARTIES in Makefile.(line 181)

All 7 comments

You could add opencv_videoio and boost_regex at the end of LIBARTIES in Makefile.(line 181)

it work,thanks a lot!

After I add opencv_videoio and boost_regex at the end of LIBARTIES in Makefile ,I make successfully,but when I make test ,similar errors occured as following:
.build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::verify_options(unsigned int, boost::regex_constants::_match_flags)' .build_release/lib/libcaffe.so: undefined reference toboost::match_results<__gnu_cxx::__normal_iterator, std::allocator > >, std::allocator, std::allocator > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator, std::allocator > >, std::allocator, std::allocator > > > > > const&)'
.build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::raise_runtime_error(std::runtime_error const&)' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::get_mem_block()'
.build_release/lib/libcaffe.so: undefined reference to boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::get_default_error_string(boost::regex_constants::error_type)'
.build_release/lib/libcaffe.so: undefined reference to boost::cpp_regex_traits<char>::toi(char const*&, char const*, int) const' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator, std::allocator > >, std::allocator, std::allocator > > > >, boost::regex_traits > >::construct_init(boost::basic_regex > > const&, boost::regex_constants::_match_flags)'
.build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::cpp_regex_traits_implementation<char>::transform_primary[abi:cxx11](char const*, char const*) const' .build_release/lib/libcaffe.so: undefined reference toboost::re_detail_106100::cpp_regex_traits_implementation::transformabi:cxx11 const'
.build_release/lib/libcaffe.so: undefined reference to `boost::re_detail_106100::put_mem_block(void)'
collect2: error: ld returned 1 exit status
Makefile:599: recipe for target '.build_release/test/test_all.testbin' failed
make: *
* [.build_release/test/test_all.testbin] Error 1

Maybe you can try to make clean and build it again

I met the same error, and I solvered it. Here is my step: First, if you are using opencv3.*, you should uncomment it in the Makefile.config. And then install boost from source code.

@Alex287 Could you explain how to install the boost from source code please? I have also meet the same error, thanks a lot

Because there already have a boost in my ubuntu, and when I install boost in the ssd code path again it said that the version is already the latest, so what should I do?

@Jilliansea You can use this link. Make sure that you have gcc version 5 as your default compiler.

Was this page helpful?
0 / 5 - 0 ratings