I installed boost 1.55.0 from homebrew on macos mavericks. Getting a linker exception - not finding std::string::c_str() which I don't understand why. Could this be a problem with homebrew? I tried compiling boost 1.55.0 directly from boost and it doesn't even build on macos.
This little bit of code:
#include <iostream>
#include <unordered_map>
#include <vector>
#include <boost/thread/tss.hpp>
typedef std::unordered_map<std::string, std::string> StringMap;
static boost::thread_specific_ptr<std::vector<StringMap*>> rlist;
int main()
{
return 0;
}
compiled with this command line:
g++ -std=c++11 main.cpp -I/usr/local/include -L/usr/local/lib -lboost_thread -lboost_system -lboost_atomic -lboost_log -lstdc++
throws this linker exception:
Undefined symbols for architecture x86_64:
"std::string::c_str() const", referenced from:
boost::system::system_error::what() const in libboost_thread.a(thread.o)
"std::string::empty() const", referenced from:
boost::system::system_error::what() const in libboost_thread.a(thread.o)
"std::allocator<char>::allocator()", referenced from:
boost::system::system_error::system_error(boost::system::error_code, char const*) in libboost_thread.a(thread.o)
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system.a(error_code.o)
"std::allocator<char>::~allocator()", referenced from:
boost::system::system_error::system_error(boost::system::error_code, char const*) in libboost_thread.a(thread.o)
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system.a(error_code.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
boost::system::system_error::system_error(boost::system::error_code, char const*) in libboost_thread.a(thread.o)
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system.a(error_code.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&)", referenced from:
boost::thread_exception::thread_exception(boost::thread_exception const&) in libboost_thread.a(thread.o)
boost::condition_error::condition_error(boost::condition_error const&) in libboost_thread.a(thread.o)
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system.a(error_code.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string()", referenced from:
boost::system::system_error::system_error(boost::system::error_code, char const*) in libboost_thread.a(thread.o)
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system.a(error_code.o)
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()", referenced from:
boost::system::system_error::what() const in libboost_thread.a(thread.o)
boost::system::system_error::~system_error() in libboost_thread.a(thread.o)
boost::system::system_error::~system_error() in libboost_thread.a(thread.o)
boost::thread_exception::~thread_exception() in libboost_thread.a(thread.o)
boost::thread_exception::~thread_exception() in libboost_thread.a(thread.o)
boost::thread_resource_error::~thread_resource_error() in libboost_thread.a(thread.o)
boost::thread_resource_error::~thread_resource_error() in libboost_thread.a(thread.o)
...
"std::string::operator=(char const*)", referenced from:
boost::system::system_error::what() const in libboost_thread.a(thread.o)
boost::system::(anonymous namespace)::generic_error_category::message(int) const in libboost_system.a(error_code.o)
"std::string::operator+=(char const*)", referenced from:
boost::system::system_error::what() const in libboost_thread.a(thread.o)
"std::string::operator+=(std::string const&)", referenced from:
boost::system::system_error::what() const in libboost_thread.a(thread.o)
"std::runtime_error::runtime_error(std::string const&)", referenced from:
boost::system::system_error::system_error(boost::system::error_code, char const*) in libboost_thread.a(thread.o)
"std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from:
std::_Rb_tree<void const*, std::pair<void const* const, boost::detail::tss_data_node>, std::_Select1st<std::pair<void const* const, boost::detail::tss_data_node> >, std::less<void const*>, std::allocator<std::pair<void const* const, boost::detail::tss_data_node> > >::_M_insert_unique(std::pair<void const* const, boost::detail::tss_data_node> const&) in libboost_thread.a(thread.o)
"std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from:
_tls_destructor in libboost_thread.a(thread.o)
std::_Rb_tree<void const*, std::pair<void const* const, boost::detail::tss_data_node>, std::_Select1st<std::pair<void const* const, boost::detail::tss_data_node> >, std::less<void const*>, std::allocator<std::pair<void const* const, boost::detail::tss_data_node> > >::erase(std::_Rb_tree_iterator<std::pair<void const* const, boost::detail::tss_data_node> >, std::_Rb_tree_iterator<std::pair<void const* const, boost::detail::tss_data_node> >) in libboost_thread.a(thread.o)
"std::__throw_length_error(char const*)", referenced from:
std::vector<std::pair<boost::condition_variable*, boost::mutex*>, std::allocator<std::pair<boost::condition_variable*, boost::mutex*> > >::_M_insert_aux(__gnu_cxx::__normal_iterator<std::pair<boost::condition_variable*, boost::mutex*>*, std::vector<std::pair<boost::condition_variable*, boost::mutex*>, std::allocator<std::pair<boost::condition_variable*, boost::mutex*> > > >, std::pair<boost::condition_variable*, boost::mutex*> const&) in libboost_thread.a(thread.o)
"std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
_tls_destructor in libboost_thread.a(thread.o)
std::_Rb_tree<void const*, std::pair<void const* const, boost::detail::tss_data_node>, std::_Select1st<std::pair<void const* const, boost::detail::tss_data_node> >, std::less<void const*>, std::allocator<std::pair<void const* const, boost::detail::tss_data_node> > >::erase(std::_Rb_tree_iterator<std::pair<void const* const, boost::detail::tss_data_node> >, std::_Rb_tree_iterator<std::pair<void const* const, boost::detail::tss_data_node> >) in libboost_thread.a(thread.o)
"std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
std::_Rb_tree<void const*, std::pair<void const* const, boost::detail::tss_data_node>, std::_Select1st<std::pair<void const* const, boost::detail::tss_data_node> >, std::less<void const*>, std::allocator<std::pair<void const* const, boost::detail::tss_data_node> > >::_M_insert_unique(std::pair<void const* const, boost::detail::tss_data_node> const&) in libboost_thread.a(thread.o)
l