【问题标题】:Linker trouble with MacPorts installation of graph-toolMacPorts 安装图形工具的链接器问题
【发布时间】:2014-04-08 20:32:22
【问题描述】:

我已经通过 Mac Ports 安装了图形工具。前几天,我跑了

$ sudo port selfupdate
$ sudo port upgrade outdated

Graph-tool 被重新编译(大约需要 30 小时(!))现在,当我想在 python 中包含 graph-tool 时,我收到以下错误:

Python 2.7.6 (default, Nov 22 2013, 13:39:24) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import graph_tool
dyld: lazy symbol binding failed: Symbol not found: __ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFNSt3__14pairIPvS2_EES5_E
  Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
  Expected in: flat namespace

dyld: Symbol not found: __ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFNSt3__14pairIPvS2_EES5_E
  Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
  Expected in: flat namespace

Trace/BPT trap: 5

我用“port installed | grep boost”测试了boost包的版本和变种:结果:

  boost @1.49.0_0+python27
  boost @1.53.0_1+no_single+no_static+python27
  boost @1.53.0_2+no_single+no_static+python27
  boost @1.54.0_0+no_single+no_static+python27
  boost @1.55.0_1+no_single+no_static+python27
  boost @1.55.0_2+no_single+no_static+python27 (active)

对于graph-tool本身,“port installed | grep graph-tool”的结果是:

  py27-graph-tool @2.2.25_0
  py27-graph-tool @2.2.29_0
  py27-graph-tool @2.2.29.1_0 (active)

这是当我检查错误消息中出现的库链接到哪些库时的结果:

$ otool -L /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so:
    /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)
    /opt/local/lib/libboost_iostreams-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/local/lib/libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/local/lib/libboost_regex-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
    /opt/local/lib/libCGAL.10.dylib (compatibility version 10.0.0, current version 10.0.2)
    /opt/local/lib/libexpat.1.dylib (compatibility version 8.0.0, current version 8.0.0)
    /opt/local/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.6)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
    /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)

有人有想法吗?

谢谢,

托马斯

【问题讨论】:

  • 在这个post,建议做$ otool -L /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
  • 结果是:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.19.0)
  • 您的设置中默认的编译器是什么?您是否可能升级了操作系统,并且没有重新安装 Xcode 和开发人员工具?这是使用 MacPorts 时的一个主要警告,我在 otool 输出中看到共享对象与系统的 C++ 标准库链接。
  • Macports 使用的编译器应该是 clang。我从未更改过 Macports 的设置。我现在正在更新 Xcode,并将重新编译 python 和 boost。
  • 重新编译 python、boost 和 graph-tool 没有帮助。我仍然得到同样的错误。通过调用nm -a /opt/local/lib/libboost_python-mt.dylib,我发现符号__ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFNSt3__14pairIPvS2_EES5_E 确实不包含在那里。然而,有一个非常相似的符号:__ZN5boost6python7objects23register_dynamic_id_auxENS0_9type_infoEPFSt4pairIPvS2_ES4_E,如果这意味着什么。

标签: python macos boost macports graph-tool


【解决方案1】:

问题已解决。 最新版本的图形工具假设 Mavericks (10.9.) 并使用导致 麻烦是因为在 MountainLion 中标准版本的 MacPorts 链接到 libstdc++。结果符号混淆了。

我安装了 Mavericks,重新安装了所有端口,现在它可以工作了!

久违了

托马斯

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-28
    相关资源
    最近更新 更多