title: regex_search.hpp:56: undefined reference to `boost::re_detail_106100::perl_matcher
body: <p>After updateting from boost 1.58 to 1.61, linking fails with the following error:</p>
  
  <pre><code>In function `bool boost::regex_search&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, std::allocator&lt;boost::sub_match&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt; &gt; &gt;, char, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt;(__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, __gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, boost::match_results&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, std::allocator&lt;boost::sub_match&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt; &gt; &gt; &gt;&amp;, boost::basic_regex&lt;char, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt; const&amp;, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;)':
  /usr/include/boost/regex/v4/regex_search.hpp:56: undefined reference to `boost::re_detail_106100::perl_matcher&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, std::allocator&lt;boost::sub_match&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt; &gt; &gt;, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt;::find()'
  CMakeFiles/havoc.dir/src/helpers.cpp.o: In function `boost::re_detail_106100::perl_matcher&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, std::allocator&lt;boost::sub_match&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt; &gt; &gt;, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt;::perl_matcher(__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, __gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, boost::match_results&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, std::allocator&lt;boost::sub_match&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt; &gt; &gt; &gt;&amp;, boost::basic_regex&lt;char, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt; const&amp;, boost::regex_constants::_match_flags, __gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;)':
  /usr/include/boost/regex/v4/perl_matcher.hpp:382: undefined reference to `boost::re_detail_106100::perl_matcher&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt;, std::allocator&lt;boost::sub_match&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::string&gt; &gt; &gt;, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt;::construct_init(boost::basic_regex&lt;char, boost::regex_traits&lt;char, boost::cpp_regex_traits&lt;char&gt; &gt; &gt; const&amp;, boost::regex_constants::_match_flags)'
  </code></pre>
  
  <p>I use cmake to link against boost like this:</p>
  
  <pre><code>find_package(Boost COMPONENTS chrono system filesystem thread regex random REQUIRED)    
  target_link_libraries (myprog
        ${Boost_REGEX_LIBRARY}
  )
  </code></pre>
  
  <p>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.</p>
  
  <p>Is libboost-regex1.61.0 broken or did the linking change somehow?</p>
  
  <p><strong>Update: 14.11.2016:</strong>
  The Changelog of Boost shows that the namespace was renamed from "re_detail" to "BOOST_REGEX_DETAIL_NS".</p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <ol>
  <li>My system has an old boost_regex lib somewhere an cmake uses it to link despite the fact that cmake announces using 1.62</li>
  <li>The boost_regex lib in Kali is outdated while the header are updated.</li>
  </ol>
  
  <p>I have checked my libraries and they seem to look good:</p>
  
  <pre><code>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 -&gt; libboost_regex.so.1.62.0
      -rw-r--r--   1 root   root    1107284 Nov 12 19:46 libboost_regex.so.1.62.0
  </code></pre>
  
  <p><strong>Update: 09.12.2016:</strong>
  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.</p>
  
  <pre><code>/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
  </code></pre>
  
  <p>Opened a Bug in the Kali Linux Bug Tracker:
  <a href="https://bugs.kali.org/view.php?id=3765" rel="nofollow noreferrer">https://bugs.kali.org/view.php?id=3765</a></p>