次のコマンドを使用して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 は成功しましたが、graph-tool は失敗します。
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
ここからグラフツールを機能させる方法についてのアイデアはありますか?