[MacPorts] #41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a ----------------------------+-------------------------------- Reporter: andy.nowacki@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Keywords: | Port: py-obspy ----------------------------+-------------------------------- When trying to use py-obspy on OS X 10.8.5, one cannot load the obspy.taup module: {{{ $ sudo port install py27-obspy @gcc46 --- snip --- $ /opt/local/bin/python2.7 Python 2.7.5 (default, Aug 1 2013, 01:01:17) [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.
from obspy.taup import taup Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/obspy/taup/taup.py", line 8, in <module> from obspy.taup.util import flibtaup as lib File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/obspy/taup/util.py", line 34, in <module> raise ImportError(msg) ImportError: Could not load shared library for obspy.taup.
dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/obspy/taup/../lib/libtaup.so, 6): Symbol not found: __gfortran_compare_string Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/obspy/taup/../lib/libtaup.so Expected in: flat namespace in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7 /site-packages/obspy/taup/../lib/libtaup.so
}}}
This occurs because the Patch file for the port source:trunk/dports/python /py-obspy/files/patch-setup.py.diff contains the line: {{{ @@ -621,7 +620,6 @@ taupargs = [] lib = MyExtension(lib_name, - libraries=['gfortran'], extra_link_args=extra_link_args, sources=[src + 'emdlv.f', src + 'libtau.f', src + 'ttimes_subrout.f']) }}} Hence, during the final link stage, {{{/usr/bin/clang}}} does not link to libgfortran, hence the missing reference to {{{__gfortran_compare_string}}}. Removing removing this part of the diff does not help. This time, {{{/usr/bin/clang}}} cannot link to {{{-lgfortran}}} because it can't be found in the usual MacPorts location of {{{${prefix}/lib}}}: it is acutally in {{{${prefix}/lib/gcc${ver_no_dot}}}} (e.g., /opt/local/lib/gcc46 in may case). I'm afraid I know very little about portfiles and how MacPorts works in general, but I tried a number of things without success: 1. {{{$ sudo LIBRARY_PATH=/opt/local/lib/gcc46 install py27-obspy +gcc46}}} The rationale is that {{{setup.py}}} searches {{{LIBRARY_PATH}}} for directories to add in the final link stage. However, I could never get this to be picked up. 2. Editing the source:trunk/dports/python/py-obspy/Portfile to add {{{configure.env-append ${prefix}/lib/gcc${ver_no_dot}}}} 3. Adding {{{extra_env LIBRARY_PATH}}} to {{{$prefix/etc/macports/macports.conf}}}. In the end, I replaced the source:trunk/dports/python/py-obspy/files /patch-setup.py.diff with the attached file (pertinent bit below). {{{ @@ -621,7 +620,7 @@ taupargs = [] lib = MyExtension(lib_name, libraries=['gfortran'], - extra_link_args=extra_link_args, + extra_link_args=['-L/opt/local/lib/gcc46'], sources=[src + 'emdlv.f', src + 'libtau.f', src + 'ttimes_subrout.f']) }}} This is obviously not a satisfactory fix at all, but like I say, I don't know how to do this more generally. I hope this helps the maintainers or someone else more conversant with MacPorts to get obspy working 'out of the box' from here on. -- Ticket URL: <https://trac.macports.org/ticket/41122> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: py-obspy | -----------------------------+----------------------------- Changes (by ryandesign@…): * owner: macports-tickets@… => Peter.Danecek@… * cc: peter.danecek@… (removed) Comment: Replying to [ticket:41122 andy.nowacki@…]:
{{{ $ sudo port install py27-obspy @gcc46 }}}
If you're trying to activate the gcc46 variant, the correct syntax is `sudo port install py27-obspy +gcc46`
1. {{{$ sudo LIBRARY_PATH=/opt/local/lib/gcc46 install py27-obspy +gcc46}}}
The rationale is that {{{setup.py}}} searches {{{LIBRARY_PATH}}} for directories to add in the final link stage. However, I could never get this to be picked up.
MacPorts intentionally ignores your shell environment so that it will not adversely affect a build.
3. Adding {{{extra_env LIBRARY_PATH}}} to {{{$prefix/etc/macports/macports.conf}}}.
You should not set LIBRARY_PATH nor should you list it in extra_env. -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: py-obspy | -----------------------------+----------------------------- Comment (by andy.nowacki@…): Replying to [comment:1 ryandesign@…]:
If you're trying to activate the gcc46 variant, the correct syntax is `sudo port install py27-obspy +gcc46`
That would be a typo--thanks for spotting it in case it threw anyone else off.
MacPorts intentionally ignores your shell environment so that it will not adversely affect a build. You should not set LIBRARY_PATH nor should you list it in extra_env.
As I mentioned, this was just a dirty hack attempt--if I knew how to add linker options to setup.py in a MacPorts build in a portable and general way, you'd have a patch for the portfile and patch file by now! I'll leave it to Peter to work his magic then, I guess. -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: py-obspy | -----------------------------+----------------------------- Comment (by Peter.Danecek@…): Thanks for spotting this! The `setup.py` of ObsPy is definitively problematic. Actually, it was already substituted but was not backported to 0.8.4. I assume the point here is that when I created and tested the port we still were using the same version of `gcc` and `gfortran`. That way linking was done by the "correct" gcc version and know about the correct location of the lib. Now, we use gcc only for fortran and link with a different C compiler. I will try to fix this soon. However, I am travelling and cannot do this immediately. -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:3> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: py-obspy | -----------------------------+----------------------------- Comment (by Peter.Danecek@…): I was looking at different options to solve this, but at the end I am inclined to just use the corresponding Macports gcc compiler also for compiling the C extensions **and for linking**. This would revert this port to the behavior it had before transitioning to the //GFortran Recipe//. In the end it should have little effect on the C extensions and using `gcc-mp-*` solves the problem with finding `libgfortran` without having to deal with `build.env` etc. too much. Are there any contraindications for this? -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:4> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: py-obspy | -----------------------------+----------------------------- Comment (by Peter.Danecek@…): Here the proposed fix for this ticket. Along with the fix I introduced some further minor changes to the Portfile: - `long_description` reformatted to fit 80 column width; - update `master_sites` to avoid redirect; - add `livecheck` to this port; The fix is implemented by: - adding `configure.cc ${prefix}/bin/gcc-mp-${ver}` to avoid fuss with `libgfortran` while linking; - modifying the patch to `setup.py`; Note: The `setup.py` script is going to become obsolete with release of 0.9.x, so this fix can be considered temporary. To the commiter: Please ignore most of the attached files and apply only `patch.py- obspy.diff`. Sorry for the confusion, but I guess there in no way to cancel attached files again. -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: py-obspy | -----------------------------+----------------------------- Comment (by Peter.Danecek@…): STOP: One moment please! I am just testing with python 2.6 and the fix above seems not to work for Python 2.6. Here **always** clang is used for linking. So just setting the C compiler does not help here. Need to approach this in a different way. -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: | Keywords: Port: py-obspy | -----------------------------+----------------------------- Comment (by Peter.Danecek@…): Here a fix which works for both `py26` and `py27`. The fix includes some changes to the `Portfile`, as specified above. To the committer: Apply only patch.py-obspy.diff! The other files are irrelevant. -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: fixed | Keywords: Port: py-obspy | -----------------------------+----------------------------- Changes (by mojca@…): * status: new => closed * resolution: => fixed Comment: r114089, r114091 -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a -----------------------------+----------------------------- Reporter: andy.nowacki@… | Owner: Peter.Danecek@… Type: defect | Status: closed Priority: Normal | Milestone: Component: ports | Version: 2.2.1 Resolution: fixed | Keywords: Port: py-obspy | -----------------------------+----------------------------- Comment (by andy.nowacki@…): Thanks Peter--works fine for me. -- Ticket URL: <https://trac.macports.org/ticket/41122#comment:9> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts