vincular con clang ++ en OS X genera muchos errores de símbolos no encontrados

Estoy intentando comstackr algún código de C ++ (incluidas las características de C ++ 11) en OS X 10.8 utilizando el comstackdor de clang ++. Tengo un archivo MAKE que genera los archivos del objeto OK, luego en el comando:

clang++ -o Analysis.so -shared DataFile.o CR39DataFile.o 

Me llegan toneladas de errores sobre los símbolos que no se encuentran para la architecture x86_64. El código funciona bien en un sistema * nix usando g ++ y cambiando los indicadores del comstackdor de manera adecuada para compatibilidad con C ++ 11. Para comstackr el * .o lo estoy haciendo como:

 clang++ -c -Wall -std=c++11 -stdlib=libc++ -I../src ../src/DataFile.cc 

Editar: la salida del comando de enlace es:

 clang++ -o Analysis.so -shared DataFile.o CR39DataFile.o Undefined symbols for architecture x86_64: "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::find(char const*, unsigned long, unsigned long) const", referenced from: CR39DataFile::read_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::find(char, unsigned long) const", referenced from: CR39DataFile::trim(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::compare(char const*) const", referenced from: CR39DataFile::read_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::__vector_base_common::__throw_length_error() const", referenced from: std::__1::vector<frame*, std::__1::allocator >::__append(unsigned long) in CR39DataFile.o std::__1::vector<std::__1::vector<frame*, std::__1::allocator >*, std::__1::allocator<std::__1::vector<frame*, std::__1::allocator >*> >::__append(unsigned long) in CR39DataFile.o "std::__1::__vector_base_common::__throw_out_of_range() const", referenced from: std::__1::vector<std::__1::vector<frame*, std::__1::allocator >*, std::__1::allocator<std::__1::vector<frame*, std::__1::allocator >*> >::at(unsigned long) in CR39DataFile.o std::__1::vector<frame*, std::__1::allocator >::at(unsigned long) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::erase(unsigned long, unsigned long)", referenced from: CR39DataFile::trim(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::assign(char const*)", referenced from: CR39DataFile::CR39DataFile() in CR39DataFile.o CR39DataFile::clear() in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::insert(unsigned long, unsigned long, char)", referenced from: CR39DataFile::read_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::resize(unsigned long, char)", referenced from: CR39DataFile::read_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::reserve(unsigned long)", referenced from: CR39DataFile::read_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_string(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)", referenced from: DataFile::read(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) in DataFile.o DataFile::write(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) in DataFile.o std::__1::thread::thread<bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >), DataFile*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, void>(bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)&&, DataFile*&&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&&&) in DataFile.o CR39DataFile::read_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o CR39DataFile::write_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o CR39DataFile::write_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, float, float, float, float, float, float, float, float, float, float) in CR39DataFile.o CR39DataFile::write_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, float, float, float, float, float, float) in CR39DataFile.o ... "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::basic_string(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, unsigned long, unsigned long, std::__1::allocator const&)", referenced from: CR39DataFile::read_thread(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::~basic_string()", referenced from: DataFile::~DataFile() in DataFile.o DataFile::read(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) in DataFile.o DataFile::write(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) in DataFile.o std::__1::thread::thread<bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >), DataFile*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, void>(bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)&&, DataFile*&&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&&&) in DataFile.o void* std::__1::__thread_proxy<std::__1::tuple<bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >), DataFile*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >(void*) in DataFile.o std::__1::__tuple_leaf<2ul, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, false>::~__tuple_leaf() in DataFile.o CR39DataFile::CR39DataFile() in CR39DataFile.o ... "std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >::operator=(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&)", referenced from: CR39DataFile::set_file_path(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o CR39DataFile::set_file_auxpath(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) in CR39DataFile.o "std::__1::__thread_struct::__thread_struct()", referenced from: void* std::__1::__thread_proxy<std::__1::tuple<bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >), DataFile*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >(void*) in DataFile.o "std::__1::__thread_struct::~__thread_struct()", referenced from: std::__1::__thread_specific_ptr::reset(std::__1::__thread_struct*) in DataFile.o "std::__1::__thread_local_data()", referenced from: void* std::__1::__thread_proxy<std::__1::tuple<bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >), DataFile*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > >(void*) in DataFile.o "std::__1::__throw_system_error(int, char const*)", referenced from: std::__1::thread::thread<bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >), DataFile*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, void>(bool (DataFile::*)(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >)&&, DataFile*&&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&&&) in DataFile.o "std::__1::thread::~thread()", referenced from: DataFile::cleanup_file_io() in DataFile.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Analysis.so] Error 1 

Sospecho que este problema se debe a las dos bibliotecas de tiempo de ejecución de C ++ disponibles bajo OS X. Use lo siguiente para vincular la biblioteca dinámica:

 clang++ -stdlib=libc++ -o Analysis.dylib -shared DataFile.o CR39DataFile.o 

(el -stdlib=libc++ es la diferencia clave). Creo que el tiempo de ejecución predeterminado de C ++ es la implementación de GNU que confunde al enlazador mientras compiló con la implementación de libc ++.