libboost_regex not compiling












0















I'm trying to compile some regex inside my c++ code.



I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so
So that it is linked properly.



The command I'm running is: g++-4.9 -std=c++11 -O2 -Wall -I/usr/local/include/boost load_and_search.cpp -o bkSearch -L/usr/local/lib/ /usr/local/lib/libboost_serialization.a -lboost_regex



I'm getting the following errors:



/tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::unwind_extra_block(bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb]+0x2c): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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_imp()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x8): undefined reference to `boost::re_detail_106700::get_mem_block()' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x142): undefined reference to `boost::re_detail_106700::verify_options(unsigned int, boost::regex_constants::_match_flags)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x183): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x409): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: 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>)': load_and_search.cpp:(.text._ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_[_ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_]+0x10f): undefined reference to `boost::re_detail_106700::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)' /tmp/ccrHjY7S.o: In function `__gnu_cxx::__normal_iterator<char const*, std::string> boost::re_detail_106700::re_is_set_member<__gnu_cxx::__normal_iterator<char const*, std::string>, char, boost::regex_traits<char, boost::cpp_regex_traits<char> >, unsigned int>(__gnu_cxx::__normal_iterator<char const*, std::string>,
__gnu_cxx::__normal_iterator<char const*, std::string>, boost::re_detail_106700::re_set_long<unsigned int> const*, boost::re_detail_106700::regex_data<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x17e): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const' load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x2ee): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const' /tmp/ccrHjY7S.o: In function `void boost::re_detail_106700::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > >
>(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0x8d): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xc0): undefined reference to `boost::re_detail_106700::raise_runtime_error(std::runtime_error const&)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xdb): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::extend_stack()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv]+0x18): undefined reference to `boost::re_detail_106700::get_mem_block()' collect2: error: ld returned 1 exit status make: *** [tools] Error 1


I believe this still means that the compiler is having issues with the libboost_regex files



This is the code sample I'm trying to run:



#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <fstream>
#include <sstream>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <iostream>
#include <boost/regex.hpp>
#include <regex>
#include "BKTree.h"
#include <algorithm>
#include <locale>

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>

using namespace std::chrono;

void prematch(std::vector<std::vector<std::string> > &parsedCsv, int &i, boost::regex &digitReg, boost::regex &flatNumReg)
{
boost::regex digitReg ("^[^\d]*(\d+)");
boost::regex flatNumReg ("(?<=\bflat\s|\bfl\s|\bapartment\s)([a-z0-9]{1,})");
std::string add1 (parsedCsv[i][0]);
boost::smatch digitMatch;
boost::smatch typeMatch;
boost::regex_search (add1,digitMatch,digitReg);
std::string add1String = boost::lexical_cast<std::string>(parsedCsv[i][0]);
boost::regex_search (add1,typeMatch,flatNumReg);
}


Could someone point out to me where I'm going wrong?
I'm only trying to use the boost lib so that I'll be able to use positive lookbacks.



Thanks,
Daniel










share|improve this question

























  • No need to run in verbose mode, it's mostly noise. The other message you show seems to be cut in the middle. Please post a Minimal, Complete, and Verifiable example. This includes source code and a full copy of compiler messages.

    – n.m.
    Nov 21 '18 at 11:44













  • @n.m. Changed it, hope this is better

    – Daniel Lawton
    Nov 21 '18 at 12:02











  • The first thing you've done wrong is hitting your system with a sledhehammer, a.k.a. sudo. Try gently restoring it to its original state, then ask stackowerflow about the problem you tried to solve by installing stuff in /usr/local.

    – n.m.
    Nov 21 '18 at 14:14


















0















I'm trying to compile some regex inside my c++ code.



I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so
So that it is linked properly.



The command I'm running is: g++-4.9 -std=c++11 -O2 -Wall -I/usr/local/include/boost load_and_search.cpp -o bkSearch -L/usr/local/lib/ /usr/local/lib/libboost_serialization.a -lboost_regex



I'm getting the following errors:



/tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::unwind_extra_block(bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb]+0x2c): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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_imp()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x8): undefined reference to `boost::re_detail_106700::get_mem_block()' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x142): undefined reference to `boost::re_detail_106700::verify_options(unsigned int, boost::regex_constants::_match_flags)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x183): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x409): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: 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>)': load_and_search.cpp:(.text._ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_[_ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_]+0x10f): undefined reference to `boost::re_detail_106700::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)' /tmp/ccrHjY7S.o: In function `__gnu_cxx::__normal_iterator<char const*, std::string> boost::re_detail_106700::re_is_set_member<__gnu_cxx::__normal_iterator<char const*, std::string>, char, boost::regex_traits<char, boost::cpp_regex_traits<char> >, unsigned int>(__gnu_cxx::__normal_iterator<char const*, std::string>,
__gnu_cxx::__normal_iterator<char const*, std::string>, boost::re_detail_106700::re_set_long<unsigned int> const*, boost::re_detail_106700::regex_data<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x17e): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const' load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x2ee): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const' /tmp/ccrHjY7S.o: In function `void boost::re_detail_106700::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > >
>(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0x8d): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xc0): undefined reference to `boost::re_detail_106700::raise_runtime_error(std::runtime_error const&)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xdb): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::extend_stack()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv]+0x18): undefined reference to `boost::re_detail_106700::get_mem_block()' collect2: error: ld returned 1 exit status make: *** [tools] Error 1


I believe this still means that the compiler is having issues with the libboost_regex files



This is the code sample I'm trying to run:



#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <fstream>
#include <sstream>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <iostream>
#include <boost/regex.hpp>
#include <regex>
#include "BKTree.h"
#include <algorithm>
#include <locale>

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>

using namespace std::chrono;

void prematch(std::vector<std::vector<std::string> > &parsedCsv, int &i, boost::regex &digitReg, boost::regex &flatNumReg)
{
boost::regex digitReg ("^[^\d]*(\d+)");
boost::regex flatNumReg ("(?<=\bflat\s|\bfl\s|\bapartment\s)([a-z0-9]{1,})");
std::string add1 (parsedCsv[i][0]);
boost::smatch digitMatch;
boost::smatch typeMatch;
boost::regex_search (add1,digitMatch,digitReg);
std::string add1String = boost::lexical_cast<std::string>(parsedCsv[i][0]);
boost::regex_search (add1,typeMatch,flatNumReg);
}


Could someone point out to me where I'm going wrong?
I'm only trying to use the boost lib so that I'll be able to use positive lookbacks.



Thanks,
Daniel










share|improve this question

























  • No need to run in verbose mode, it's mostly noise. The other message you show seems to be cut in the middle. Please post a Minimal, Complete, and Verifiable example. This includes source code and a full copy of compiler messages.

    – n.m.
    Nov 21 '18 at 11:44













  • @n.m. Changed it, hope this is better

    – Daniel Lawton
    Nov 21 '18 at 12:02











  • The first thing you've done wrong is hitting your system with a sledhehammer, a.k.a. sudo. Try gently restoring it to its original state, then ask stackowerflow about the problem you tried to solve by installing stuff in /usr/local.

    – n.m.
    Nov 21 '18 at 14:14
















0












0








0








I'm trying to compile some regex inside my c++ code.



I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so
So that it is linked properly.



The command I'm running is: g++-4.9 -std=c++11 -O2 -Wall -I/usr/local/include/boost load_and_search.cpp -o bkSearch -L/usr/local/lib/ /usr/local/lib/libboost_serialization.a -lboost_regex



I'm getting the following errors:



/tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::unwind_extra_block(bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb]+0x2c): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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_imp()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x8): undefined reference to `boost::re_detail_106700::get_mem_block()' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x142): undefined reference to `boost::re_detail_106700::verify_options(unsigned int, boost::regex_constants::_match_flags)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x183): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x409): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: 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>)': load_and_search.cpp:(.text._ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_[_ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_]+0x10f): undefined reference to `boost::re_detail_106700::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)' /tmp/ccrHjY7S.o: In function `__gnu_cxx::__normal_iterator<char const*, std::string> boost::re_detail_106700::re_is_set_member<__gnu_cxx::__normal_iterator<char const*, std::string>, char, boost::regex_traits<char, boost::cpp_regex_traits<char> >, unsigned int>(__gnu_cxx::__normal_iterator<char const*, std::string>,
__gnu_cxx::__normal_iterator<char const*, std::string>, boost::re_detail_106700::re_set_long<unsigned int> const*, boost::re_detail_106700::regex_data<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x17e): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const' load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x2ee): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const' /tmp/ccrHjY7S.o: In function `void boost::re_detail_106700::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > >
>(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0x8d): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xc0): undefined reference to `boost::re_detail_106700::raise_runtime_error(std::runtime_error const&)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xdb): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::extend_stack()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv]+0x18): undefined reference to `boost::re_detail_106700::get_mem_block()' collect2: error: ld returned 1 exit status make: *** [tools] Error 1


I believe this still means that the compiler is having issues with the libboost_regex files



This is the code sample I'm trying to run:



#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <fstream>
#include <sstream>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <iostream>
#include <boost/regex.hpp>
#include <regex>
#include "BKTree.h"
#include <algorithm>
#include <locale>

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>

using namespace std::chrono;

void prematch(std::vector<std::vector<std::string> > &parsedCsv, int &i, boost::regex &digitReg, boost::regex &flatNumReg)
{
boost::regex digitReg ("^[^\d]*(\d+)");
boost::regex flatNumReg ("(?<=\bflat\s|\bfl\s|\bapartment\s)([a-z0-9]{1,})");
std::string add1 (parsedCsv[i][0]);
boost::smatch digitMatch;
boost::smatch typeMatch;
boost::regex_search (add1,digitMatch,digitReg);
std::string add1String = boost::lexical_cast<std::string>(parsedCsv[i][0]);
boost::regex_search (add1,typeMatch,flatNumReg);
}


Could someone point out to me where I'm going wrong?
I'm only trying to use the boost lib so that I'll be able to use positive lookbacks.



Thanks,
Daniel










share|improve this question
















I'm trying to compile some regex inside my c++ code.



I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so
So that it is linked properly.



The command I'm running is: g++-4.9 -std=c++11 -O2 -Wall -I/usr/local/include/boost load_and_search.cpp -o bkSearch -L/usr/local/lib/ /usr/local/lib/libboost_serialization.a -lboost_regex



I'm getting the following errors:



/tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::unwind_extra_block(bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE18unwind_extra_blockEb]+0x2c): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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_imp()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x8): undefined reference to `boost::re_detail_106700::get_mem_block()' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x142): undefined reference to `boost::re_detail_106700::verify_options(unsigned int, boost::regex_constants::_match_flags)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x183): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE8find_impEv]+0x409): undefined reference to `boost::re_detail_106700::put_mem_block(void*)' /tmp/ccrHjY7S.o: 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>)': load_and_search.cpp:(.text._ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_[_ZN5boost12regex_searchIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS5_EEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEbT_SD_RNS_13match_resultsISD_T0_EERKNS_11basic_regexIT1_T2_EENS_15regex_constants12_match_flagsESD_]+0x10f): undefined reference to `boost::re_detail_106700::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)' /tmp/ccrHjY7S.o: In function `__gnu_cxx::__normal_iterator<char const*, std::string> boost::re_detail_106700::re_is_set_member<__gnu_cxx::__normal_iterator<char const*, std::string>, char, boost::regex_traits<char, boost::cpp_regex_traits<char> >, unsigned int>(__gnu_cxx::__normal_iterator<char const*, std::string>,
__gnu_cxx::__normal_iterator<char const*, std::string>, boost::re_detail_106700::re_set_long<unsigned int> const*, boost::re_detail_106700::regex_data<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, bool)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x17e): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const' load_and_search.cpp:(.text._ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb[_ZN5boost16re_detail_10670016re_is_set_memberIN9__gnu_cxx17__normal_iteratorIPKcSsEEcNS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEjEET_SB_SB_PKNS0_11re_set_longIT2_EERKNS0_10regex_dataIT0_T1_EEb]+0x2ee): undefined reference to `boost::re_detail_106700::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const' /tmp/ccrHjY7S.o: In function `void boost::re_detail_106700::raise_error<boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > >
>(boost::regex_traits_wrapper<boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::error_type)': load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0x8d): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xc0): undefined reference to `boost::re_detail_106700::raise_runtime_error(std::runtime_error const&)' load_and_search.cpp:(.text._ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE[_ZN5boost16re_detail_10670011raise_errorINS_20regex_traits_wrapperINS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEEEEvRKT_NS_15regex_constants10error_typeE]+0xdb): undefined reference to `boost::re_detail_106700::get_default_error_string(boost::regex_constants::error_type)' /tmp/ccrHjY7S.o: In function `boost::re_detail_106700::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> > >::extend_stack()': load_and_search.cpp:(.text._ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv[_ZN5boost16re_detail_10670012perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcSsEESaINS_9sub_matchIS6_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEE12extend_stackEv]+0x18): undefined reference to `boost::re_detail_106700::get_mem_block()' collect2: error: ld returned 1 exit status make: *** [tools] Error 1


I believe this still means that the compiler is having issues with the libboost_regex files



This is the code sample I'm trying to run:



#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <fstream>
#include <sstream>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <chrono>
#include <iostream>
#include <boost/regex.hpp>
#include <regex>
#include "BKTree.h"
#include <algorithm>
#include <locale>

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>

using namespace std::chrono;

void prematch(std::vector<std::vector<std::string> > &parsedCsv, int &i, boost::regex &digitReg, boost::regex &flatNumReg)
{
boost::regex digitReg ("^[^\d]*(\d+)");
boost::regex flatNumReg ("(?<=\bflat\s|\bfl\s|\bapartment\s)([a-z0-9]{1,})");
std::string add1 (parsedCsv[i][0]);
boost::smatch digitMatch;
boost::smatch typeMatch;
boost::regex_search (add1,digitMatch,digitReg);
std::string add1String = boost::lexical_cast<std::string>(parsedCsv[i][0]);
boost::regex_search (add1,typeMatch,flatNumReg);
}


Could someone point out to me where I'm going wrong?
I'm only trying to use the boost lib so that I'll be able to use positive lookbacks.



Thanks,
Daniel







c++ linux boost






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 12:15









Maxim Egorushkin

87.5k11102186




87.5k11102186










asked Nov 21 '18 at 11:32









Daniel LawtonDaniel Lawton

2719




2719













  • No need to run in verbose mode, it's mostly noise. The other message you show seems to be cut in the middle. Please post a Minimal, Complete, and Verifiable example. This includes source code and a full copy of compiler messages.

    – n.m.
    Nov 21 '18 at 11:44













  • @n.m. Changed it, hope this is better

    – Daniel Lawton
    Nov 21 '18 at 12:02











  • The first thing you've done wrong is hitting your system with a sledhehammer, a.k.a. sudo. Try gently restoring it to its original state, then ask stackowerflow about the problem you tried to solve by installing stuff in /usr/local.

    – n.m.
    Nov 21 '18 at 14:14





















  • No need to run in verbose mode, it's mostly noise. The other message you show seems to be cut in the middle. Please post a Minimal, Complete, and Verifiable example. This includes source code and a full copy of compiler messages.

    – n.m.
    Nov 21 '18 at 11:44













  • @n.m. Changed it, hope this is better

    – Daniel Lawton
    Nov 21 '18 at 12:02











  • The first thing you've done wrong is hitting your system with a sledhehammer, a.k.a. sudo. Try gently restoring it to its original state, then ask stackowerflow about the problem you tried to solve by installing stuff in /usr/local.

    – n.m.
    Nov 21 '18 at 14:14



















No need to run in verbose mode, it's mostly noise. The other message you show seems to be cut in the middle. Please post a Minimal, Complete, and Verifiable example. This includes source code and a full copy of compiler messages.

– n.m.
Nov 21 '18 at 11:44







No need to run in verbose mode, it's mostly noise. The other message you show seems to be cut in the middle. Please post a Minimal, Complete, and Verifiable example. This includes source code and a full copy of compiler messages.

– n.m.
Nov 21 '18 at 11:44















@n.m. Changed it, hope this is better

– Daniel Lawton
Nov 21 '18 at 12:02





@n.m. Changed it, hope this is better

– Daniel Lawton
Nov 21 '18 at 12:02













The first thing you've done wrong is hitting your system with a sledhehammer, a.k.a. sudo. Try gently restoring it to its original state, then ask stackowerflow about the problem you tried to solve by installing stuff in /usr/local.

– n.m.
Nov 21 '18 at 14:14







The first thing you've done wrong is hitting your system with a sledhehammer, a.k.a. sudo. Try gently restoring it to its original state, then ask stackowerflow about the problem you tried to solve by installing stuff in /usr/local.

– n.m.
Nov 21 '18 at 14:14














1 Answer
1






active

oldest

votes


















0














It looks like you compile and link against two different versions of boost:




  1. One from /usr/include/boost and /usr/lib64/.

  2. Another from /usr/local/include/boost and /usr/local/lib.


That may be the reason why you get linker errors.






I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so So that it is linked properly.




/usr directories are managed by your system package manager, manually managing files there leads to troubles. Do not do that.



What probably happened is that you did not install boost-devel or libboost-all-dev or whatever boost development package is called in your system. That package provides headers and the libraries to link against. (That link you created manually may prevent the package from installing.)






share|improve this answer
























  • Alright thanks for the help so far. I've now done yum install boost-devel however it hasn't changed anything unfortunately. I'll look into undoing what I did with the ln -s command

    – Daniel Lawton
    Nov 21 '18 at 12:24













  • @DanielLawton Remove those -L/usr/local/... and -I/usr/local/... options. Link -lboost_serialization -lboost_regex.

    – Maxim Egorushkin
    Nov 21 '18 at 12:28













  • Command is now g++-4.9 -std=c++11 -O2 -Wall load_and_search.cpp -o bkSearch -lboost_serialization -lboost_regex .. Still no luck unfortunately, same errors

    – Daniel Lawton
    Nov 21 '18 at 12:31











  • @DanielLawton That builds it for me. You probably messed up your /usr and/or /usr/local directories.

    – Maxim Egorushkin
    Nov 21 '18 at 12:36











  • Could you provide any more detail as to what I could've done to my /usr or /usr/local directories?

    – Daniel Lawton
    Nov 21 '18 at 12:56











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411176%2flibboost-regex-not-compiling%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














It looks like you compile and link against two different versions of boost:




  1. One from /usr/include/boost and /usr/lib64/.

  2. Another from /usr/local/include/boost and /usr/local/lib.


That may be the reason why you get linker errors.






I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so So that it is linked properly.




/usr directories are managed by your system package manager, manually managing files there leads to troubles. Do not do that.



What probably happened is that you did not install boost-devel or libboost-all-dev or whatever boost development package is called in your system. That package provides headers and the libraries to link against. (That link you created manually may prevent the package from installing.)






share|improve this answer
























  • Alright thanks for the help so far. I've now done yum install boost-devel however it hasn't changed anything unfortunately. I'll look into undoing what I did with the ln -s command

    – Daniel Lawton
    Nov 21 '18 at 12:24













  • @DanielLawton Remove those -L/usr/local/... and -I/usr/local/... options. Link -lboost_serialization -lboost_regex.

    – Maxim Egorushkin
    Nov 21 '18 at 12:28













  • Command is now g++-4.9 -std=c++11 -O2 -Wall load_and_search.cpp -o bkSearch -lboost_serialization -lboost_regex .. Still no luck unfortunately, same errors

    – Daniel Lawton
    Nov 21 '18 at 12:31











  • @DanielLawton That builds it for me. You probably messed up your /usr and/or /usr/local directories.

    – Maxim Egorushkin
    Nov 21 '18 at 12:36











  • Could you provide any more detail as to what I could've done to my /usr or /usr/local directories?

    – Daniel Lawton
    Nov 21 '18 at 12:56
















0














It looks like you compile and link against two different versions of boost:




  1. One from /usr/include/boost and /usr/lib64/.

  2. Another from /usr/local/include/boost and /usr/local/lib.


That may be the reason why you get linker errors.






I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so So that it is linked properly.




/usr directories are managed by your system package manager, manually managing files there leads to troubles. Do not do that.



What probably happened is that you did not install boost-devel or libboost-all-dev or whatever boost development package is called in your system. That package provides headers and the libraries to link against. (That link you created manually may prevent the package from installing.)






share|improve this answer
























  • Alright thanks for the help so far. I've now done yum install boost-devel however it hasn't changed anything unfortunately. I'll look into undoing what I did with the ln -s command

    – Daniel Lawton
    Nov 21 '18 at 12:24













  • @DanielLawton Remove those -L/usr/local/... and -I/usr/local/... options. Link -lboost_serialization -lboost_regex.

    – Maxim Egorushkin
    Nov 21 '18 at 12:28













  • Command is now g++-4.9 -std=c++11 -O2 -Wall load_and_search.cpp -o bkSearch -lboost_serialization -lboost_regex .. Still no luck unfortunately, same errors

    – Daniel Lawton
    Nov 21 '18 at 12:31











  • @DanielLawton That builds it for me. You probably messed up your /usr and/or /usr/local directories.

    – Maxim Egorushkin
    Nov 21 '18 at 12:36











  • Could you provide any more detail as to what I could've done to my /usr or /usr/local directories?

    – Daniel Lawton
    Nov 21 '18 at 12:56














0












0








0







It looks like you compile and link against two different versions of boost:




  1. One from /usr/include/boost and /usr/lib64/.

  2. Another from /usr/local/include/boost and /usr/local/lib.


That may be the reason why you get linker errors.






I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so So that it is linked properly.




/usr directories are managed by your system package manager, manually managing files there leads to troubles. Do not do that.



What probably happened is that you did not install boost-devel or libboost-all-dev or whatever boost development package is called in your system. That package provides headers and the libraries to link against. (That link you created manually may prevent the package from installing.)






share|improve this answer













It looks like you compile and link against two different versions of boost:




  1. One from /usr/include/boost and /usr/lib64/.

  2. Another from /usr/local/include/boost and /usr/local/lib.


That may be the reason why you get linker errors.






I've run ln -s /usr/lib64/libboost_regex.so.1.53.0 /usr/lib/libboost_regex.so So that it is linked properly.




/usr directories are managed by your system package manager, manually managing files there leads to troubles. Do not do that.



What probably happened is that you did not install boost-devel or libboost-all-dev or whatever boost development package is called in your system. That package provides headers and the libraries to link against. (That link you created manually may prevent the package from installing.)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 '18 at 12:10









Maxim EgorushkinMaxim Egorushkin

87.5k11102186




87.5k11102186













  • Alright thanks for the help so far. I've now done yum install boost-devel however it hasn't changed anything unfortunately. I'll look into undoing what I did with the ln -s command

    – Daniel Lawton
    Nov 21 '18 at 12:24













  • @DanielLawton Remove those -L/usr/local/... and -I/usr/local/... options. Link -lboost_serialization -lboost_regex.

    – Maxim Egorushkin
    Nov 21 '18 at 12:28













  • Command is now g++-4.9 -std=c++11 -O2 -Wall load_and_search.cpp -o bkSearch -lboost_serialization -lboost_regex .. Still no luck unfortunately, same errors

    – Daniel Lawton
    Nov 21 '18 at 12:31











  • @DanielLawton That builds it for me. You probably messed up your /usr and/or /usr/local directories.

    – Maxim Egorushkin
    Nov 21 '18 at 12:36











  • Could you provide any more detail as to what I could've done to my /usr or /usr/local directories?

    – Daniel Lawton
    Nov 21 '18 at 12:56



















  • Alright thanks for the help so far. I've now done yum install boost-devel however it hasn't changed anything unfortunately. I'll look into undoing what I did with the ln -s command

    – Daniel Lawton
    Nov 21 '18 at 12:24













  • @DanielLawton Remove those -L/usr/local/... and -I/usr/local/... options. Link -lboost_serialization -lboost_regex.

    – Maxim Egorushkin
    Nov 21 '18 at 12:28













  • Command is now g++-4.9 -std=c++11 -O2 -Wall load_and_search.cpp -o bkSearch -lboost_serialization -lboost_regex .. Still no luck unfortunately, same errors

    – Daniel Lawton
    Nov 21 '18 at 12:31











  • @DanielLawton That builds it for me. You probably messed up your /usr and/or /usr/local directories.

    – Maxim Egorushkin
    Nov 21 '18 at 12:36











  • Could you provide any more detail as to what I could've done to my /usr or /usr/local directories?

    – Daniel Lawton
    Nov 21 '18 at 12:56

















Alright thanks for the help so far. I've now done yum install boost-devel however it hasn't changed anything unfortunately. I'll look into undoing what I did with the ln -s command

– Daniel Lawton
Nov 21 '18 at 12:24







Alright thanks for the help so far. I've now done yum install boost-devel however it hasn't changed anything unfortunately. I'll look into undoing what I did with the ln -s command

– Daniel Lawton
Nov 21 '18 at 12:24















@DanielLawton Remove those -L/usr/local/... and -I/usr/local/... options. Link -lboost_serialization -lboost_regex.

– Maxim Egorushkin
Nov 21 '18 at 12:28







@DanielLawton Remove those -L/usr/local/... and -I/usr/local/... options. Link -lboost_serialization -lboost_regex.

– Maxim Egorushkin
Nov 21 '18 at 12:28















Command is now g++-4.9 -std=c++11 -O2 -Wall load_and_search.cpp -o bkSearch -lboost_serialization -lboost_regex .. Still no luck unfortunately, same errors

– Daniel Lawton
Nov 21 '18 at 12:31





Command is now g++-4.9 -std=c++11 -O2 -Wall load_and_search.cpp -o bkSearch -lboost_serialization -lboost_regex .. Still no luck unfortunately, same errors

– Daniel Lawton
Nov 21 '18 at 12:31













@DanielLawton That builds it for me. You probably messed up your /usr and/or /usr/local directories.

– Maxim Egorushkin
Nov 21 '18 at 12:36





@DanielLawton That builds it for me. You probably messed up your /usr and/or /usr/local directories.

– Maxim Egorushkin
Nov 21 '18 at 12:36













Could you provide any more detail as to what I could've done to my /usr or /usr/local directories?

– Daniel Lawton
Nov 21 '18 at 12:56





Could you provide any more detail as to what I could've done to my /usr or /usr/local directories?

– Daniel Lawton
Nov 21 '18 at 12:56




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411176%2flibboost-regex-not-compiling%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

A Topological Invariant for $pi_3(U(n))$