#38984 closed defect (fixed)
Provide a way to use C++11 with C++ ports
Reported by: | akimd (Akim Demaille) | Owned by: | macports-tickets@… |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.1.3 |
Keywords: | Cc: | jeremyhu (Jeremy Huddleston Sequoia) | |
Port: | boost |
Description
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!
Change History (4)
comment:1 Changed 12 years ago by larryv (Lawrence Velázquez)
Cc: | jeremyhu@… added; adfernandes@… removed |
---|---|
Keywords: | clang removed |
Owner: | changed from macports-tickets@… to adfernandes@… |
comment:2 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)
Owner: | changed from adfernandes@… to macports-tickets@… |
---|
comment:3 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:4 Changed 11 years ago by jeremyhu (Jeremy Huddleston Sequoia)
Summary: | boost.regex: does not work with clang → Provide a way to use C++11 with C++ ports |
---|
Note: See
TracTickets for help on using
tickets.
If you want to use libc++, please try out trunk/base r110519 or later with 'cxx_stdlib libc++' set in ${prefix}/etc/macports/macports.conf