quant
quant

Reputation: 23172

undefined reference to boost::filesystem::path_traits::convert

I am trying to compile a program using cmake, and am seeing the following linker error:

/home/quant/bin/boost_1_61_0/stage/lib/libboost_log_setup.so: undefined reference to boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)' /home/quant/bin/boost_1_61_0/stage/lib/libboost_log.so: undefined reference to boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::__cxx11::basic_string, std::allocator >&)'

The linker command that ninja generated looks like this:

g++ -pthread -DBOOST_ALL_DYN_LINK
utility/test/CMakeFiles/utilityTest.dir/loadCSVTests.cpp.o utility/test/CMakeFiles/utilityTest.dir/main.cpp.o utility/test/CMakeFiles/utilityTest.dir/randomDeviceTests.cpp.o -o utility/test/utilityTest -rdynamic /home/quant/bin/boost_1_61_0/stage/lib/libboost_thread.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_program_options.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_serialization.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_unit_test_framework.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_system.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log_setup.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_filesystem.so utility/lib/libutilityLib.a utility/testLib/libutilityTestLib.a utility/lib/libutilityLib.a /home/quant/bin/boost_1_61_0/stage/lib/libboost_thread.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_program_options.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_serialization.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_unit_test_framework.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_system.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_log_setup.so /home/quant/bin/boost_1_61_0/stage/lib/libboost_filesystem.so -Wl,-rpath,/home/quant/bin/boost_1_61_0/stage/lib

As you can see, I am linking against boost_filesystem and boost_system, so it's not the same problem as referenced on this SO post (and the many others like it).

I am using boost 1.61, which I compiled with gcc 5.3 (the same compiler as the one I'm compiling my program with).

What am I doing wrong?

Upvotes: 2

Views: 5353

Answers (1)

I had a similar issue, this could be because of a new ABI which is introduced from gcc 5.1.

https://github.com/openframeworks/openFrameworks/issues/4203

I fixed mine by adding "add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0)" to CMakeLists.txt

Upvotes: 3

Related Questions