[MacPorts] #38984: boost.regex: does not work with clang
MacPorts
noreply at macports.org
Thu May 2 09:11:11 PDT 2013
#38984: boost.regex: does not work with clang
-----------------------------+--------------------------------
Reporter: akim.demaille@… | Owner: macports-tickets@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.1.3
Keywords: clang | Port: boost
-----------------------------+--------------------------------
The following simple piece of code works as expected with GCC, however it
fails with clang, whatever the version I tried (MP's 3.1, 3.2 and 3.3).
{{{
#include <sstream>
#include <iostream>
#include <boost/regex.hpp>
int main (int argc, const char* argv[])
{
boost::regex exp("*");
boost::regex_match("foo", exp);
}
}}}
clang++ 3.3
{{{
$ clang++-mp-3.3 -std=c++11 -stdlib=libc++ -I/opt/local/include
-L/opt/local/lib -lboost_regex-mt foo.cc
Undefined symbols for architecture x86_64:
"boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
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)", referenced from:
boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
boost::regex_traits<char, boost::cpp_regex_traits<char> >
>::perl_matcher(char const*, char const*, boost::match_results<char
const*, std::__1::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags, char const*) in foo-abEP0S.o
"boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()",
referenced from:
bool boost::regex_match<char const*,
std::__1::allocator<boost::sub_match<char const*> >, char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*,
char const*, boost::match_results<char const*,
std::__1::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags) in foo-abEP0S.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
}}}
GCC
{{{
$ g++-mp-4.8 -std=c++11 -I/opt/local/include -L/opt/local/lib
-lboost_regex-mt foo.cc
$
}}}
Clang 3.2 and 3.1
{{{
$ clang++-mp-3.2 -std=c++11 -stdlib=libc++ -I/opt/local/include
-L/opt/local/lib -lboost_regex-mt foo.cc
Undefined symbols for architecture x86_64:
"boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
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)", referenced from:
boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
boost::regex_traits<char, boost::cpp_regex_traits<char> >
>::perl_matcher(char const*, char const*, boost::match_results<char
const*, std::__1::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags, char const*) in foo-vigR70.o
"boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()",
referenced from:
bool boost::regex_match<char const*,
std::__1::allocator<boost::sub_match<char const*> >, char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*,
char const*, boost::match_results<char const*,
std::__1::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags) in foo-vigR70.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
$ clang++-mp-3.1 -std=c++11 -stdlib=libc++ -I/opt/local/include
-L/opt/local/lib -lboost_regex-mt foo.cc
Undefined symbols for architecture x86_64:
"boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
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)", referenced from:
boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
boost::regex_traits<char, boost::cpp_regex_traits<char> >
>::perl_matcher(char const*, char const*, boost::match_results<char
const*, std::__1::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags, char const*) in foo-MudWDP.o
"boost::re_detail::perl_matcher<char const*,
std::__1::allocator<boost::sub_match<char const*> >,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >::match()",
referenced from:
bool boost::regex_match<char const*,
std::__1::allocator<boost::sub_match<char const*> >, char,
boost::regex_traits<char, boost::cpp_regex_traits<char> > >(char const*,
char const*, boost::match_results<char const*,
std::__1::allocator<boost::sub_match<char const*> > >&,
boost::basic_regex<char, boost::regex_traits<char,
boost::cpp_regex_traits<char> > > const&,
boost::regex_constants::_match_flags) in foo-MudWDP.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
}}}
Note that the error at linking is the same that you'd get if you don't
pass -lboost_regex-mt at all, so probably something is going wrong when
trying to use this library.
Cheers!
--
Ticket URL: <https://trac.macports.org/ticket/38984>
MacPorts <http://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list