|
Boost Users : |
Subject: Re: [Boost-users] boost_regex compiler error
From: John Maddock (jz.maddock_at_[hidden])
Date: 2016-12-05 14:40:29
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<char, std::char_traits<char>,
> std::allocator<char> > >,
> std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, 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<char, std::char_traits<char>,
> std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*,
> std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,
> boost::match_results<__gnu_cxx::__normal_iterator<char const*,
> std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,
> std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, 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__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISB_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_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_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_matcher<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,
> std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, 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<char, std::char_traits<char>,
> std::allocator<char> > >,
> std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > > > >, boost::regex_traits<char,
> boost::cpp_regex_traits<char> >
> >::perl_matcher(__gnu_cxx::__normal_iterator<char const*,
> std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >, __gnu_cxx::__normal_iterator<char const*,
> std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,
> boost::match_results<__gnu_cxx::__normal_iterator<char const*,
> std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,
> std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, 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<char const*,
> std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >)':
> main.cpp:(.text._ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEC2ESC_SC_RNS_13match_resultsISC_SF_EERKNS_11basic_regexIcSJ_EENS_15regex_constants12_match_flagsESC_[_ZN5boost9re_detail12perl_matcherIN9__gnu_cxx17__normal_iteratorIPKcNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEESaINS_9sub_matchISC_EEENS_12regex_traitsIcNS_16cpp_regex_traitsIcEEEEEC5ESC_SC_RNS_13match_resultsISC_SF_EERKNS_11basic_regexIcSJ_EENS_15regex_constants12_match_flagsESC_]+0xf8):
> undefined reference to
> `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, std::char_traits<char>,
> std::allocator<char> > >,
> std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char
> const*, std::__cxx11::basic_string<char, 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net