After updateting from boost 1.58 to 1.61, linking fails with the following error:
In function `bool boost::regex_search<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::string>)':
/usr/include/boost/regex/v4/regex_search.hpp:56: undefined reference to `boost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()'
CMakeFiles/havoc.dir/src/helpers.cpp.o: In function `boost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__normal_iterator<char const*, std::string>, __gnu_cxx::__normal_iterator<char const*, std::string>, boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator<char const*, std::string>)':
/usr/include/boost/regex/v4/perl_matcher.hpp:382: undefined reference to `boost::re_detail_106100::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::string>, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::string> > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'
I use cmake to link against boost like this:
find_package(Boost COMPONENTS chrono system filesystem thread regex random REQUIRED)
target_link_libraries (myprog
${Boost_REGEX_LIBRARY}
)
I searched the changelog of boost but could not find anything specific that might cause the cmake linking to fail. Like I said: it works perfectly with 1.58.
Is libboost-regex1.61.0 broken or did the linking change somehow?
Update: 14.11.2016: The Changelog of Boost shows that the namespace was renamed from "re_detail" to "BOOST_REGEX_DETAIL_NS".
I use Kali Rolloing release and it seems to me that the installedboost lib 1.61 does not match the boost 1.61 source. I will try to install the lib manually and check if this solves the problem.
I updated to 1.61 and afterwards to 1.62. To problem remains. I checked my linker command and ensured that "-lboost_regex" is present at the end of the line. I can only think of two problems:
- My system has an old boost_regex lib somewhere an cmake uses it to link despite the fact that cmake announces using 1.62
- The boost_regex lib in Kali is outdated while the header are updated.
I have checked my libraries and they seem to look good:
newgen@kali:/usr/lib/i386-linux-gnu$ ls -al | grep boost | grep regex
-rw-r--r-- 1 root root 2390702 Nov 12 19:46 libboost_regex.a
lrwxrwxrwx 1 root root 24 Nov 12 19:46 libboost_regex.so -> libboost_regex.so.1.62.0
-rw-r--r-- 1 root root 1107284 Nov 12 19:46 libboost_regex.so.1.62.0
Update: 09.12.2016: I am no export on shared objects but a hint from the boost developers points to a mess up in the packaging. I tried to look into the current library and I would guess that the lib is v1.58 while the headers are v1.62.
/usr/lib/i386-linux-gnu$ nm --dynamic libboost_regex.so.1.62.0 | grep regex_search
0005d4e0 W _ZN5boost12regex_searchINS_16re_detail_10620016mapfile_iteratorESaINS_9sub_matchIS2_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SA_RNS_13match_resultsISA_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsE
Opened a Bug in the Kali Linux Bug Tracker: https://bugs.kali.org/view.php?id=3765
sudo find / -name libboost_regex.*
- I had a mix of 1.58 and 1.61 and when I renamed the 1.58 ones linking was OK