尝试构建 gpuocelot 时,在 OS X Lion 上遇到 boost 链接错误

发布于 2025-01-08 21:48:10 字数 2215 浏览 1 评论 0原文

当我尝试在 OS X 上构建 libocelot.dylib 时,我遇到了针对 boost 的链接器错误。看起来这是构建脚本的最后一步,当它运行命令时:

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

这会给出几个未定义的符号错误,如下所示:

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:

其中,大多数但不是全部似乎来自 boost 库。当我使用nm检查boost dylib文件时,我发现这些符号被标记为U表示未定义:

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

等等。因此,由于某种原因,ocelot 正在寻找的符号并未内置在 boost 中。关于我可能做错了什么或替代方法有什么想法吗?为了增强性能,我遵循了下面链接的说明。

http://www.boost.org/doc/libs /1_48_0/more/getting_started/unix-variants.html

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文