[MacPorts] #62578: py-scipy/py-numpy: opportunistic linking to py-mkl breaks both of these ports

MacPorts noreply at macports.org
Fri Dec 10 20:41:41 UTC 2021


#62578: py-scipy/py-numpy: opportunistic linking to py-mkl breaks both of these
ports
--------------------------------+------------------------
  Reporter:  essandess          |      Owner:  reneeotten
      Type:  defect             |     Status:  accepted
  Priority:  Normal             |  Milestone:
 Component:  ports              |    Version:  2.7.1
Resolution:                     |   Keywords:  rpath
      Port:  py-scipy py-numpy  |
--------------------------------+------------------------
Changes (by reneeotten):

 * cc: michaelld, kencu (added)


Comment:

 okay, so I've update the {{{py-numpy}}} Portfile and added a {{{mkl}}}
 variant, making sure the MKL library isn't found when this variant is not
 selected - this will avoid the opportunistic linking.

 So, the library name is {{{libmkl_rt.1.dylib}}} so I do a {{{reinplace}}}
 to change the library name from {{{mkl_rt}}} to {{{mkl_rt.1}}} in
 {{{numpy/distutils/system_info.py}}}. I *think* that works as intended as
 the MKL library is found and linked to when installing {{{py-numpy}}} with
 the {{{mkl}}} variant.

 However when importing the package it fails with:
 {{{
 Original error was:
 dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10
 /site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so, 2):
 Library not loaded: @rpath/libmkl_rt.1.dylib
   Referenced from:
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10
 /site-packages/numpy/core/_multiarray_umath.cpython-310-darwin.so
   Reason: image not found
 }}}


 and looking with {{{otool}}} gives:
 {{{
 % otool -L
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/libmkl_rt.1.dylib
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/libmkl_rt.1.dylib:
         @rpath/libmkl_rt.1.dylib (compatibility version 0.0.0, current
 version 0.0.0)
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
 version 1281.100.1)
 }}}

 {{{
 % otool -l
 /opt/local/Library/Frameworks/Python.framework/Versions/3.10/lib/libmkl_rt.1.dylib
 | grep path
          name @rpath/libmkl_rt.1.dylib (offset 24)
          path /opt/local/lib (offset 12)
          path /opt/local/lib/libomp (offset 12)
 }}}

 Now there is some {{{install_name_tool -add_rpath}}} stuff happening in
 the {{{py-mkl}}} port, but I cannot figure out whether that is the issue
 or not. I've tried a variety of (random) things with
 {{{install_name_tool}}}, but cannot get it to work. Can anyone educate me
 here on what the problem is and whether this should be fixed in the {{{py-
 mkl}}} port or if it's a NumPy issue?

-- 
Ticket URL: <https://trac.macports.org/ticket/62578#comment:43>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list