|Anonymous | Login||2017-11-23 00:52 EST|
|Main | My View | View Issues | Change Log | Roadmap | My Account|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0002486||graphviz||Build/Install||public||2014-09-09 18:32||2014-09-10 15:56|
|Platform||darwin||OS||OS X||OS Version||10.9|
|Summary||0002486: graphviz always links against system python|
|Description||When building the python bindings against e.g. python 2.7, -lpython2.7 is added to the linker command line but the linker's default search path is not modified. When users try to build against Homebrew's python, Homebrew's libpython2.7 is not in the default linker search path so it is not found and the module is linked against the system python framework instead, which causes a segfault on "import gv" from the Homebrew python.|
This can be resolved a few different ways, probably in ascending order of correctness:
1. add -L$PYTHON_PREFIX/lib to the linker path
2. discover python build flags with e.g. python2.7-config --ldflags
3. link modules with -undefined dynamic_lookup so that Python symbols are resolved at import time and not at link time, which has the pleasant effect that modules built for one interpreter can be used with another without segfaults
I've provided a patch for option 1.
|Steps To Reproduce||1. Install Python from python.org, Homebrew, Enthought, or some other vendor so that "python" invokes the new non-system python interpreter.|
2. Install graphviz from source.
3. Run python -c "import gv" and observe that the interpreter segfaults.
|Additional Information||Originally reported to Homebrew as https://github.com/Homebrew/homebrew/issues/32180. [^]|
|Tags||No tags attached.|
|FIX-COMMENT||changed to use suggested: "-undefined dynamic_lookup"|
|Attached Files||0001-explicitly-add-Python-lib-dir-to-linker-search-path.patch (Attachment missing)|
|To clarify, for option 3, "-undefined dynamic_lookup" replaces e.g. "-lpython2.7" since the interpreter provides the symbols at runtime.|
I haven't tried this, but you should be able to use ./configure --with-extralibdir=<path_to_your_python's_libs>
My preference is to use pkg-config, but python didn't support that for a long time (still doesn't on RHEL5 or 6).
I'll work on converting configure.ac to use pkg-config for python (with some fall back). So, when this is done, if you want to use a different python it will be your reponsibility to ensure that your python.pc is first in PKG_CONFIG_PATH.
Just as a note, neither OS X system Python or Homebrew Python installs .pc files in a global path so pkg-config will typically fail to find python on OS X; the system .pc files are in /System/Library/Frameworks/Python.framework/Versions/Current/lib/pkgconfig.
Homebrew promises that bindings will be built against the first Python in PATH (which may not be Homebrew python, even if it's installed), so it would be convenient for Homebrew if the fallback behavior helped us meet that promise. :)
Just tried "-undefined dynamic_lookup" on fedora-20, seems to work great. I assume it says "expect the undefined symbols to be already loaded into memory" ?
Perhaps I should be using this for all the language extensions...
Still testing that it works on antiquated systems like RHEL5.
I was going to try adding: -L$PYTHON_PREFIX/lib$LIBPOSTFIX
but I've no way of knowing if $LIBPOSTFIX is needed.
OK, I'm good with "-undefined dynamic_lookup"
Its in GIT now, and should be in all our builds tomorrow.
|2014-09-09 18:32||tdsmith||New Issue|
|2014-09-09 18:32||tdsmith||File Added: 0001-explicitly-add-Python-lib-dir-to-linker-search-path.patch|
|2014-09-09 18:43||tdsmith||Note Added: 0000810|
|2014-09-10 10:12||ellson||Note Added: 0000811|
|2014-09-10 13:18||tdsmith||Note Added: 0000812|
|2014-09-10 14:56||ellson||Note Added: 0000813|
|2014-09-10 15:52||ellson||Note Added: 0000814|
|2014-09-10 15:56||ellson||FIX-COMMENT||=> changed to use suggested: "-undefined dynamic_lookup"|
|2014-09-10 15:56||ellson||Status||new => resolved|
|2014-09-10 15:56||ellson||Resolution||open => fixed|
|2014-09-10 15:56||ellson||Assigned To||=> ellson|
|MantisBT 1.2.5[^] Copyright © 2000 - 2011 MantisBT Group|