问题
When I try to build libocelot.dylib on OS X, I run into linker errors against boost. It looks like this is on the final step of the build script, when it runs the command:
g++ -o .release_build/libocelot.dylib -lstdc++ -dynamiclib [...many *.os files referenced here ...] -L/usr/lib -L.release_build -L. -lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt -lGLEW -ldl
This gives several undefined symbol errors that look like this:
Undefined symbols for architecture x86_64:
"std::__detail::_List_node_base::_M_hook(std::__detail::_List_node_base*)", referenced from:
"std::__detail::_List_node_base::swap(std::__detail::_List_node_base&, std::__detail::_List_node_base&)", referenced from:
"std::__detail::_List_node_base::_M_unhook()", referenced from:
"std::__detail::_List_node_base::_M_transfer(std::__detail::_List_node_base*, std::__detail::_List_node_base*)", referenced from:
"std::__detail::__prime_list", referenced from:
"std::_Hash_bytes(void const*, unsigned long, unsigned long)", referenced from:
"std::ctype<char>::_M_widen_init() const", referenced from:
"_glGetError", referenced from:
Of these, most but not all appear to be from boost libraries. When I use nm
to inspect to boost dylib files, I find that these symbols are marked with U
for undefined:
lib$ nm *.dylib | grep _M_hook
U __ZNSt8__detail15_List_node_base7_M_hookEPS0_
U __ZNSt8__detail15_List_node_base7_M_hookEPS0_
U __ZNSt8__detail15_List_node_base7_M_hookEPS0_
U __ZNSt8__detail15_List_node_base7_M_hookEPS0_
U __ZNSt8__detail15_List_node_base7_M_hookEPS0_
U __ZNSt8__detail15_List_node_base7_M_hookEPS0_
lib$ nm *.dylib | grep _M_unhook
U __ZNSt8__detail15_List_node_base9_M_unhookEv
U __ZNSt8__detail15_List_node_base9_M_unhookEv
U __ZNSt8__detail15_List_node_base9_M_unhookEv
U __ZNSt8__detail15_List_node_base9_M_unhookEv
And so on. So, for some reason, the symbols that ocelot is looking for are not being built in boost. Any ideas on what I might be doing wrong, or an alternate approach? For building boost, I followed the instructions linked below.
http://www.boost.org/doc/libs/1_48_0/more/getting_started/unix-variants.html
来源:https://stackoverflow.com/questions/9423096/when-trying-to-build-gpuocelot-running-into-boost-link-errors-on-os-x-lion