I have installed Boost 1.63.0 locally, as well as Caffe (version rc3). I am currently trying to compile some Caffe code using CMake, but I get the following linker error:
/home/local/boost_1_63_0/boost/thread/pthread/once_atomic.hpp:145:
undefined reference to `boost::thread_detail::enter_once_region(boost::once_flag&)'
/home/local/boost_1_63_0/boost/thread/pthread/once_atomic.hpp:157:
undefined reference to `boost::thread_detail::commit_once_region(boost::once_flag&)'
/home/local/boost_1_63_0/boost/thread/pthread/once_atomic.hpp:153:
undefined reference to `boost::thread_detail::rollback_once_region(boost::once_flag&)'
libcpp_stuff_library.a(Log.cpp.o): In function `logging::get_log()':
/home/local/boost_1_63_0/boost/thread/pthread/once_atomic.hpp:145:
undefined reference to `boost::thread_detail::enter_once_region(boost::once_flag&)'
/home/local/boost_1_63_0/boost/thread/pthread/once_atomic.hpp:157:
undefined reference to `boost::thread_detail::commit_once_region(boost::once_flag&)'
/home/local/boost_1_63_0/boost/thread/pthread/once_atomic.hpp:153:
undefined reference to `boost::thread_detail::rollback_once_region(boost::once_flag&)'
collect2: error: ld returned 1 exit status
My first thought is that I'm somehow linking to Boost the wrong way in my CMake file. Right now, in CMakeLists.txt, I have:
set(BOOST_ROOT "/home/local/boost_1_63_0")
find_package( Boost 1.6.3 REQUIRED COMPONENTS filesystem system thread )
My second thought was that this had something to do with pthreads, so I linked to pthreads in my CMakeLists.txt using this StackOverflow answer: cmake and libpthread. However, I still get the same error after doing this.
Does anyone have other suggestions about what might be the problem here? Thank you.