0

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.

Community
  • 1
  • 1
sealonging314
  • 185
  • 2
  • 2
  • 9
  • Have you Cmake >= 3.7? cf http://stackoverflow.com/q/42123509/2799037 – usr1234567 Feb 18 '17 at 09:20
  • Yes, I have CMake version 2.8.12.2. Good thought, though. – sealonging314 Feb 18 '17 at 20:10
  • That's the problem! – usr1234567 Feb 18 '17 at 21:50
  • Possible duplicate of [CMake finds Boost but the imported targets not available for Boost version](http://stackoverflow.com/questions/42123509/cmake-finds-boost-but-the-imported-targets-not-available-for-boost-version) – usr1234567 Feb 18 '17 at 21:51
  • Alright, I locally installed CMake 3.8 and used that, but I'm still having the same problem. I've tried this with Boost version 1.60, 1.61 and 1.63 (I've also tried the older version of CMake - 2.8 - with all three of these Boost versions). Each time, I get the same error. – sealonging314 Feb 24 '17 at 18:58

1 Answers1

0

When compiling Caffe using a locally installed Boost 1.63, source code build, with CMake 3.7, I've run into a similar issues. The Caffe 1.0 CMake folder contains Dependencies.cmake and Caffe is looking for Boost 1.45 not Boost 1.62 or Boost 1.63 and Python 3.5.3 Ubuntu 17.04 launchpad distribution files. The locally installed file libboost_python.so or libboost_python.so.1.63.0 in folder /usr/local/lib are differently named from the launchpad distribution files in folder /usr/lib/x86_64-linux-gnu libboost_python-py35.so.

Sildeag
  • 74
  • 9