[MacPorts] #43650: boost::regex link error
#43650: boost::regex link error ----------------------+-------------------------------- Reporter: casmyu@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Keywords: | Port: ----------------------+-------------------------------- Hi there, I installed boost with MacPorts, most library works perfectly except boost::regex. Here is the informations from my dev environment: $ uname -a Darwin Kernel Version 13.1.0: Wed Apr 2 23:52:02 PDT 2014; root:xnu-2422.92.1~2/RELEASE_X86_64 x86_64 $ sudo port installed | grep boost boost @1.55.0_2+no_single+no_static+python27 (active) here is the source code, quite simple: $ cat test.cpp #include <sstream> #include <iostream> #include <boost/regex.hpp> int main (int argc, const char* argv[]) { boost::regex exp("*"); boost::regex_match("foo", exp); } $ g++ --version g++ (MacPorts gcc48 4.8.2_0) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. $ g++ -std=c++11 -o test -I/opt/local/include -L/opt/local/lib -lboost_regex-mt test.cpp Undefined symbols for architecture x86_64: "boost::re_detail::perl_matcher<char const*, std::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::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::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 ccRUN4it.o "boost::re_detail::perl_matcher<char const*, std::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::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::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 ccRUN4it.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status Would you please help to check this problem? If you need any more information, please let me know. Thank you! -- Ticket URL: <https://trac.macports.org/ticket/43650> MacPorts <http://www.macports.org/> Ports system for OS X
#43650: boost::regex link error -----------------------+-------------------------------- Reporter: casmyu@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: | -----------------------+-------------------------------- Description changed by ryandesign@…: Old description:
Hi there,
I installed boost with MacPorts, most library works perfectly except boost::regex. Here is the informations from my dev environment:
$ uname -a
Darwin Kernel Version 13.1.0: Wed Apr 2 23:52:02 PDT 2014; root:xnu-2422.92.1~2/RELEASE_X86_64 x86_64
$ sudo port installed | grep boost
boost @1.55.0_2+no_single+no_static+python27 (active)
here is the source code, quite simple:
$ cat test.cpp
#include <sstream> #include <iostream>
#include <boost/regex.hpp>
int main (int argc, const char* argv[]) { boost::regex exp("*"); boost::regex_match("foo", exp); }
$ g++ --version
g++ (MacPorts gcc48 4.8.2_0) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc.
$ g++ -std=c++11 -o test -I/opt/local/include -L/opt/local/lib -lboost_regex-mt test.cpp
Undefined symbols for architecture x86_64: "boost::re_detail::perl_matcher<char const*, std::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::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::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 ccRUN4it.o "boost::re_detail::perl_matcher<char const*, std::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::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::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 ccRUN4it.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status
Would you please help to check this problem? If you need any more information, please let me know.
Thank you!
New description: Hi there, I installed boost with MacPorts, most library works perfectly except boost::regex. Here is the informations from my dev environment: {{{ $ uname -a Darwin Kernel Version 13.1.0: Wed Apr 2 23:52:02 PDT 2014; root:xnu-2422.92.1~2/RELEASE_X86_64 x86_64 $ sudo port installed | grep boost boost @1.55.0_2+no_single+no_static+python27 (active) }}} here is the source code, quite simple: {{{ $ cat test.cpp #include <sstream> #include <iostream> #include <boost/regex.hpp> int main (int argc, const char* argv[]) { boost::regex exp("*"); boost::regex_match("foo", exp); } }}} {{{ $ g++ --version g++ (MacPorts gcc48 4.8.2_0) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. $ g++ -std=c++11 -o test -I/opt/local/include -L/opt/local/lib -lboost_regex-mt test.cpp Undefined symbols for architecture x86_64: "boost::re_detail::perl_matcher<char const*, std::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::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::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 ccRUN4it.o "boost::re_detail::perl_matcher<char const*, std::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::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::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 ccRUN4it.o ld: symbol(s) not found for architecture x86_64 collect2: error: ld returned 1 exit status }}} Would you please help to check this problem? If you need any more information, please let me know. Thank you! -- -- Ticket URL: <https://trac.macports.org/ticket/43650#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#43650: boost::regex link error -----------------------+-------------------------------- Reporter: casmyu@… | Owner: macports-tickets@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: invalid | Keywords: Port: | -----------------------+-------------------------------- Changes (by ryandesign@…): * cc: ryandesign@… (added) * status: new => closed * resolution: => invalid Comment: Remember to use WikiFormatting when writing in Trac. You cannot mix C++ runtimes. On OS X 10.9 Mavericks and later, the system runtime is libc++, and that is what boost and most other MacPorts ports are using as well. gcc uses libstdc++. They are not compatible. Compile your code with clang instead of gcc. See wiki:FAQ#libcpp. -- Ticket URL: <https://trac.macports.org/ticket/43650#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts