[MacPorts] #41122: py-obspy obspy.taup.taup ImportError: libtaup not linked to libgfortran.a

MacPorts noreply at macports.org
Fri Nov 1 09:04:29 PDT 2013


#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


More information about the macports-tickets mailing list