I'm trying to link against a 3rd party library that uses Boost. I've linked against the correct boost library (libboost_program_options.a), but still not finding it.
The error msg (formatted a bit for clarity):
undefined reference to `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)'
nm --demangle libboost_program_options.a | grep validate
boost::program_options::validate(boost::any&, std::vector<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&,
bool*,
int)
boost::program_options::validate(boost::any&,
std::vector<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&,
std::string*,
int)
boost::program_options::validate(boost::any&,
std::vector<std::string, std::allocator<std::string> > const&,
bool*,
int)
boost::program_options::validate(boost::any&,
std::vector<std::string, std::allocator<std::string> > const&,
std::string*,
int)
The second record looks similar, but apparently not close enough. Any idea how I can compile Boost to get a signature that matches what's in the library? I have a request out to the library owner to see what version of Boost they're using and such, but haven't heard back yet.
This is on a CentOS 7 box, which uses g++ version 4.8.5. But the library I'm tryng to link against uses C++11 heavily and was compiled with g++ v 6.1, so I installed devtoolset-6 which gives me a g++ 6 environment (g++ version 6.3.1)
I downloaded and built Boost from scratch (v1.65.1) so that it's built with the same compiler, rather then the system version.
Edit... I think John Zwinck is on the right track, but I can't get the boost library to compile to the new ABI.
The validate() functions are found in value_semantic.cpp
Stripping the build down to the basics, and adding the flags discussed:
g++ -std=c++11 -D_GLIBCXX_USE_CXX11_ABI -c -o test.o libs/program_options/src/value_semantic.cpp
nm --demangle test.o | grep validate
00000000000008b6 T boost::program_options::validate(boost::any&, std::vector<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, bool*, int)
0000000000000c02 T boost::program_options::validate(boost::any&, std::vector<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::allocator<std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const&, std::string*, int)
00000000000005f2 T boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, bool*, int)
0000000000000b9a T boost::program_options::validate(boost::any&, std::vector<std::string, std::allocator<std::string> > const&, std::string*, int)
Does the _GLIBCXX_USE_CXX11_ABI macro only work with gcc 5.1?