我尝试使用以下命令安装graphtool:
brew tap homebrew/science
brew install graph-tool
安装成功完成但是当我导入graph_tool时,我看到以下内容'未找到符号'错误:
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import graph_tool
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/graph_tool/__init__.py", line 105, in <module>
dl_import("from . import libgraph_tool_core as libcore")
File "/usr/local/lib/python2.7/site-packages/graph_tool/dl_import.py", line 57, in dl_import
exec(import_expr, local_dict, global_dict)
File "<string>", line 1, in <module>
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so, 8): Symbol not found: __ZNK5boost9re_detail31cpp_regex_traits_implementationIcE17transform_primaryEPKcS4_
Referenced from: /usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
Expected in: /usr/local/opt/boost/lib/libboost_regex.dylib
in /usr/local/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
>>> exit()
在阅读了一下之后,我认为可能存在使用不同编译器来编译boost与graph-tool的问题。我卸载了boost,boost-python和graph-tool并重新安装,从源代码编译。
brew -v install --with-icu4c --build-from-source --with-c++11 boost
brew -v install --with-icu4c --build-from-source --with-c++11 boost-python
brew -v install --build-from-source graph-tool --without-scipy --without-matplotlib --without-numpy
boost和boost-python成功,但是图形工具失败了:
Making install in centrality
CXX graph_centrality_bind.lo
CXX graph_betweenness.lo
CXX graph_closeness.lo
CXX graph_eigentrust.lo
CXX graph_eigenvector.lo
CXX graph_hits.lo
../../../../src/graph/centrality/graph_hits.cc:71:44: error: 'placeholders' is not a class, namespace, or enumeration
(g, std::bind(get_hits_dispatch(), placeholders::_1, g.get_vertex_index(),
^
../../../../src/graph/centrality/graph_hits.cc:71:44: error: reference to 'placeholders' is ambiguous
(g, std::bind(get_hits_dispatch(), placeholders::_1, g.get_vertex_index(),
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:1863:11: note: candidate found by name lookup is 'std::__1::placeholders'
namespace placeholders
^
/usr/local/include/boost/bind/placeholders.hpp:29:11: note: candidate found by name lookup is 'boost::placeholders'
namespace placeholders
^
../../../../src/graph/centrality/graph_hits.cc:72:23: error: 'placeholders' is not a class, namespace, or enumeration
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
../../../../src/graph/centrality/graph_hits.cc:72:23: error: reference to 'placeholders' is ambiguous
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:1863:11: note: candidate found by name lookup is 'std::__1::placeholders'
namespace placeholders
^
/usr/local/include/boost/bind/placeholders.hpp:29:11: note: candidate found by name lookup is 'boost::placeholders'
namespace placeholders
^
../../../../src/graph/centrality/graph_hits.cc:72:42: error: 'placeholders' is not a class, namespace, or enumeration
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
../../../../src/graph/centrality/graph_hits.cc:72:42: error: reference to 'placeholders' is ambiguous
placeholders::_2, placeholders::_3, y, epsilon, max_iter,
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/functional:1863:11: note: candidate found by name lookup is 'std::__1::placeholders'
namespace placeholders
^
/usr/local/include/boost/bind/placeholders.hpp:29:11: note: candidate found by name lookup is 'boost::placeholders'
namespace placeholders
^
6 errors generated.
其他配置信息:
==> Formula
Tap: homebrew/science
Path: /usr/local/Library/Taps/homebrew/homebrew-science/graph-tool.rb
==> Configuration
HOMEBREW_VERSION: 0.9.5
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: 4ddb79413782c82840154f75280ff67a1ded10f4
Last commit: 13 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit broadwell
OS X: 10.10.5-x86_64
Xcode: N/A
CLT: 7.2.0.0.1.1447826929
Clang: 7.0 build 700
X11: N/A
System Ruby: 2.0.0-p481
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: N/A
另外
$ xcode-select -p
/Library/Developer/CommandLineTools
$ gcc --version
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
关于如何从这里开始使图形工具工作的任何想法?
答案 0 :(得分:1)
我几天前就提出了一个问题:https://github.com/Homebrew/homebrew-science/issues/3237
不幸的是,第一次尝试使用解决方案并不适用于我。也许你会有更好的运气?