Hello list,
I know you're not the support group for graph_tool but I've been
trying to build it with homebrewed python and I'm stuck with what
looks like a problem unrelated to graph_tool.
I hope this will make sense to somebody with more experience on
building unix tools on MacOSX.
graph_tool depends on python, cgal, numpy, scipy, boost and graphviz.
I've homebrewed all of these (except numpy and scipy which I
/usr/local/share/python/pip-ed).
I'm running boost 1.47 as graph_tool has problems with 1.48.
graph_tool builds successfully but it segfaults at runtime. Talking
with graph_tool's developer we think it might be because of a linking
mismatch, as boost and all the rest are linked to homebrewed python
while graph_tool ends up linking to Xcode's python:
$ otool -L libboost_python-mt.dylib
libboost_python-mt.dylib:
libboost_python-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.0)
while:
$ otool -L libgraph_tool_core.so
libgraph_tool_core.so:
/System/Library/Frameworks/Python.framework/Versions/2.7/Python
(compatibility version 2.7.0, current version 2.7.1)
[...]
This is quite weird, because that's how I build graph_tool:
PYTHON_VERSION=2.7 PYTHON=/usr/local/bin/python2.7
CXXFLAGS="-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7
-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7"
CFLAGS="-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7
-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7"
./configure --prefix=/usr/local/ LDFLAGS="-ldl -framework
CoreFoundation -lpython2.7" --with-boost="/usr/local/lib/"
--with-numpy="/usr/local/lib/python2.7/site-packages/numpy/"
--with-scipy="/usr/local/lib/python2.7/site-packages/scipy/"
--disable-debug
which is confirmed at configure time:
checking for python2.7... /usr/local/bin/python2.7
checking for a version of Python >= '2.1.0'... yes
checking for a version of Python 2.5... yes
checking for the distutils Python package... yes
checking for Python include path...
-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7
checking for Python library path...
-L/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7
-lpython2.7
checking for Python site-packages path...
/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
checking python extra libraries... -ldl -framework CoreFoundation
checking python extra linking flags... -u _PyMac_Error
Python.framework/Versions/2.7/Python
checking consistency of all components of python development environment... yes
checking for python build information...
checking for python2.7... python2.7
checking for main in -lpython2.7... yes
checking python2.7/Python.h usability... yes
checking python2.7/Python.h presence... yes
checking for python2.7/Python.h... yes
results of the Python check:
Binary: python2.7
Library: python2.7
Include Dir:
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
checking whether python2.7 version >= 2.5... yes
checking for python2.7 version... 2.7
checking for python2.7 platform... darwin
checking for python2.7 script directory... ${prefix}/lib/python2.7/site-packages
checking for python2.7 extension module directory...
${exec_prefix}/lib/python2.7/site-packages
Except for that python check finding the /Developer/ python (why does
it find python in two different locations?). Still, looking at
config.h everything looks fine:
#define PYTHON_DIR
"/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages"
/* c++ preprocessor compilation options */
#define CPPFLAGS "
-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7
-I/usr/local/lib//include
-I/usr/local/lib/python2.7/site-packages/numpy//core/include/numpy
-I/usr/local/lib/python2.7/site-packages/scipy/"
/* c++ compilation options */
#define CXXFLAGS
"-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7
-I/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/include/python2.7
-Wall -ftemplate-depth-150 -Wno-deprecated -Wno-unknown-pragmas -O99
-fvisibility=default -fvisibility-inlines-hidden -Wno-unknown-pragmas"
/* linker options */
#define LDFLAGS "-ldl -framework CoreFoundation -lpython2.7
-L/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7
-lpython2.7"
So, the question is: why is it linked to Xcode python and how to
prevent it? What would you do?
Thanks!
--
Claudio Martella
claudio.martella@gmail.com
On 5 Jan 2012, at 15:05, Claudio Martella wrote: > So, the question is: why is it linked to Xcode python and how to > prevent it? What would you do? Try manually moving/deleting it temporarily and see if that's the problem. Try running it under gdb so you get a backtrace. -- Mike McQuaid http://mikemcquaid.com
Hi Mike,
thanks for the feedback. I tried to move the XCode lib and that's the result:
from graph_tool.all import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File
"/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py",
line 92, in <module>
dl_import("import libgraph_tool_core as libcore")
File
"/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/dl_import.py",
line 52, in dl_import
exec import_expr in local_dict, global_dict
File "<string>", line 1, in <module>
ImportError:
dlopen(/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so,
8): Library not loaded:
/System/Library/Frameworks/Python.framework/Versions/2.7/Python
Referenced from:
/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so
Reason: image not found
So apparently this does make the difference. But my questions really
is: how do I compile the lib to get it linked to homebrewed /usr/local
python instead of Xcode?
On Thu, Jan 5, 2012 at 11:10 PM, Mike McQuaid <mike@mikemcquaid.com> wrote:
>
> On 5 Jan 2012, at 15:05, Claudio Martella wrote:
>
>> So, the question is: why is it linked to Xcode python and how to
>> prevent it? What would you do?
>
> Try manually moving/deleting it temporarily and see if that's the
problem. Try running it under gdb so you get a backtrace.
>
> --
> Mike McQuaid
> http://mikemcquaid.com
>
--
Claudio Martella
claudio.martella@gmail.com
On 5 Jan 2012, at 23:08, Claudio Martella wrote: > So apparently this does make the difference. But my questions really > is: how do I compile the lib to get it linked to homebrewed /usr/local > python instead of Xcode? Not sure, it's probably build system specific. -- Mike McQuaid http://mikemcquaid.com