caffe icon indicating copy to clipboard operation
caffe copied to clipboard

Compile issue about boost and cv

Open stulin opened this issue 9 years ago • 7 comments

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 to cv::VideoCapture::set(int, double)' .build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::open(int)' .build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >, boost::regex_traits<char, boost::cpp_regex_traits > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits > > 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 to cv::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 to cv::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 to cv::VideoCapture::release()' .build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::operator>>(cv::Mat&)' .build_release/lib/libcaffe.so: undefined reference to boost::re_detail_106100::cpp_regex_traits_implementation::transform[abi:cxx11](char const*, char const*) 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 to cv::VideoWriter::~VideoWriter()' .build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::~VideoCapture()' .build_release/lib/libcaffe.so: undefined reference to cv::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 to boost::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 to boost::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 to cv::VideoWriter::VideoWriter()' .build_release/lib/libcaffe.so: undefined reference to cv::VideoCapture::get(int) const' .build_release/lib/libcaffe.so: undefined reference to cv::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

stulin avatar Apr 20 '17 01:04 stulin

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

Anfield-Uncle avatar Apr 20 '17 07:04 Anfield-Uncle

it work,thanks a lot!

stulin avatar Apr 20 '17 14:04 stulin

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 to boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, 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 to boost::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 to boost::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 to boost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > > > >, boost::regex_traits<char, boost::cpp_regex_traits > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits > > 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 to boost::re_detail_106100::cpp_regex_traits_implementation::transform[abi:cxx11](char const*, char const*) 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

stulin avatar Apr 20 '17 15:04 stulin

Maybe you can try to make clean and build it again

weiliu89 avatar Apr 20 '17 15:04 weiliu89

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 avatar May 10 '17 14:05 Alex287

@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 avatar Jul 21 '17 02:07 Jilliansea

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

thhung avatar Jul 26 '17 09:07 thhung