On 05/12/2016 17:47, Chris Padwick wrote:
Hi - I am stuck on a linker error with the boost_regex library. My platform is ubuntu 16.04 LTS, arm64, NVIDIA TX1. I downloaded and built boost 1.62.0 with the following parameters:
It looks to me like the headers you are including are from a different Boost version to the library you are linking against - all recent Boost.Regex versions mangle the namespace of their functions with the Boost version number, but as these missing symbols aren't mangled, I'm guessing you're picking up headers from an older version than 1.62.
HTH, John.
./bootstrap.sh --prefix=/usr/local
sudo ./b2 -d2 architecture=arm address-model=64 install
I compiled a simple program using this command line:
g++ main.cpp -I/usr/local/include -L/usr/local/lib -lboost_regex
Here is the program:
#include <boost/regex.hpp>
#include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
static const boost::regex rxInt("[0-9]+");
string word = "foobar";
if(boost::regex_match(word, rxInt)) {
cout << "Integer" << endl;
} else {
cout << "Not integer" << endl;
}
return 0;
}
Here are the linker errors:
|
/tmp/ccuOD7Zj.o: In function `bool boost::regex_match<__gnu_cxx::__normal_iterator<char const*, std::__cxx11::basic_string<cha ______________________________r, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_matc h<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > > > >, char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >(__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<c har const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx ::__normal_iterator<char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_matc h<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match _flags)':
main.cpp:(.text._ZN5boost11regex_matchIN9__gnu_cxx17__ normal_iteratorIPKcNSt7__cxx11 12basic_stringIcSt11char_trait sIcESaIcEEEEESaINS_9sub_matchI SB_EEEcNS_12regex_traitsIcNS_ 16cpp_regex_traitsIcEEEEEEbT_ SJ_RNS_13match_resultsISJ_T0_ EERKNS_11basic_regexIT1_T2_ EENS_15regex_constants12_ match_flagsE[_ZN5boost11regex_ matchIN9__gnu_cxx17__normal_it eratorIPKcNSt7__cxx1112basic_ stringIcSt11char_traitsIcESaIc EEEEESaINS_9sub_matchISB_ EEEcNS_12regex_traitsIcNS_ 16cpp_regex_traitsIcEEEEEEbT_ SJ_RNS_13match_resultsISJ_T0_ EERKNS_11basic_regexIT1_T2_ EENS_15regex_constants12_ match_flagsE]+0x58): undefined reference to `boost::re_detail::perl_matche r<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_matc h<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()'
/tmp/ccuOD7Zj.o: In function `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_matc h<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::perl_matcher(__gnu_cxx::__n ormal_iterator<char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, __gnu_cxx::__normal_iterator<c har const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, boost::match_results<__gnu_cxx ::__normal_iterator<char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_matc h<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > > > > >&, boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match _flags, __gnu_cxx::__normal_iterator<c har const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >)':
main.cpp:(.text._ZN5boost9re_detail12perl_matcherIN9__gnu_cx x17__normal_iteratorIPKcNSt7__ cxx1112basic_stringIcSt11char_ traitsIcESaIcEEEEESaINS_9sub_m atchISC_EEENS_12regex_traitsIc NS_16cpp_regex_traitsIcEEEEEC2 ESC_SC_RNS_13match_resultsISC_ SF_EERKNS_11basic_regexIcSJ_ EENS_15regex_constants12_ match_flagsESC_[_ZN5boost9re_d etail12perl_matcherIN9__gnu_cx x17__normal_iteratorIPKcNSt7__ cxx1112basic_stringIcSt11char_ traitsIcESaIcEEEEESaINS_9sub_m atchISC_EEENS_12regex_traitsIc NS_16cpp_regex_traitsIcEEEEEC5 ESC_SC_RNS_13match_resultsISC_ SF_EERKNS_11basic_regexIcSJ_ EENS_15regex_constants12_ match_flagsESC_]+0xf8): undefined reference to `boost::re_detail::perl_matche r<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_matc h<__gnu_cxx::__normal_iterator <char const*, std::__cxx11::basic_string<cha r, std::char_traits<char>, std::allocator<char> > > > >, 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)'
collect2: error: ld returned 1 exit status
Any hints would be appreciated. Should I try to use an earlier version of boost?
thank you!
|
|
|
_________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users