OSVR / OSVR-Core

The core libraries, applications, and plugins of the OSVR software platform.
Apache License 2.0
329 stars 124 forks source link

OSVR Boost undefined reference #597

Closed mattandria closed 5 years ago

mattandria commented 5 years ago

Hello, I'm facing a problem while compiling OSVR on Ubuntu 16.04.11, with a 5.4.0 gcc version.

CMakeFiles/osvr_json_to_c.dir/osvr_json_to_c.cpp.o : Dans la fonction « boost::program_options::typed_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, char>::xparse(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) const » :
/usr/local/include/boost/program_options/detail/value_semantic.hpp:184 : référence indéfinie vers « boost::program_options::validate(boost::any&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, int) »

I think its from an undefined reference of Boost. Although, I already installed Boost with sudo apt-get install libboost1.58-dev. And by doing cmake, I have:

-- Found Boost 1.70.0 at /usr/local/lib/cmake/Boost-1.70.0
--   Requested configuration: QUIET REQUIRED COMPONENTS thread;system;date_time;chrono;program_options;filesystem
-- Found boost_headers 1.70.0 at /usr/local/lib/cmake/boost_headers-1.70.0
-- Found boost_thread 1.70.0 at /usr/local/lib/cmake/boost_thread-1.70.0
--   libboost_thread.so.1.70.0
-- Adding boost_thread dependencies: headers
-- Found boost_system 1.70.0 at /usr/local/lib/cmake/boost_system-1.70.0
--   libboost_system.so.1.70.0
-- Adding boost_system dependencies: headers
-- Found boost_date_time 1.70.0 at /usr/local/lib/cmake/boost_date_time-1.70.0
--   libboost_date_time.so.1.70.0
-- Adding boost_date_time dependencies: headers
-- Found boost_chrono 1.70.0 at /usr/local/lib/cmake/boost_chrono-1.70.0
--   libboost_chrono.so.1.70.0
-- Adding boost_chrono dependencies: headers
-- Found boost_program_options 1.70.0 at /usr/local/lib/cmake/boost_program_options-1.70.0
--   libboost_program_options.so.1.70.0
-- Adding boost_program_options dependencies: headers
-- Found boost_filesystem 1.70.0 at /usr/local/lib/cmake/boost_filesystem-1.70.0
--   libboost_filesystem.so.1.70.0
-- Adding boost_filesystem dependencies: headers
Boost 1.44 found.
Found Boost components:
   thread;system;date_time;chrono;program_options;filesystem

So libboost is found by the program. Why isn't it still working?

Thank you for your help!

godbyk commented 5 years ago

It looks like it's mixing and matching two different versions of the Boost libraries. It says it's found Boost 1.70 libraries but is using Boost 1.44 headers. And you mentioned installing Boost 1.58 packages.

I would suggest removing any unnecessary installations of the Boost libraries. Also, you can try to direct CMake toward the Boost libraries you prefer it to use using the BOOST_ROOT variable. See the documentation at the top of the FindBoost.cmake module for more information.

mattandria commented 5 years ago

Thank you @godbyk !!! Effectively, the fact I installed Boost 1.70 and 1.58 caused conflict of version. So, I've uninstalled both by removing all corresponding headers and library files. Then, I re-installed Boost (1.61 this time ^^), and now it works.

Thanks again

godbyk commented 5 years ago

Glad we got it sorted out!