conda-forge / mumps-feedstock

A conda-smithy repository for mumps.
BSD 3-Clause "New" or "Revised" License
5 stars 23 forks source link

incorrect install name in osx mumps libraries #103

Closed jcapriot closed 10 months ago

jcapriot commented 10 months ago

Solution to issue cannot be found in the documentation.

Issue

I've been attempting to build a package that dynamically links against the sequential library and running into several issues. The first is related to #102, which looks to already have a PR open.

For context, I'm running on an OSX arm processor.

After a temporary workaround of removing that import, successfully compiling and linking together the package, I now run into issues at runtime. It is unable to find the library at runtime. Using otool -L libdmumps_seq.dylib(on this installed libraries from conda-forge) reveals the following:

    ../lib/libdmumps_seq.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libmetis.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libmpiseq_seq.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/liblapack.3.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libblas.3.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libmumps_common_seq.dylib (compatibility version 0.0.0, current version 0.0.0)
    @rpath/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)

It would appear that the rpath is not set for the first entry of the library (the other libraries smumps_seq, cmumps_seq, zmumps_seq have this same issue). However libesmumps.dylib and libmumps_common_seq.dylib do not have this issue.

Installed packages

anyio                     4.2.0              pyhd8ed1ab_0    conda-forge
appnope                   0.1.3              pyhd8ed1ab_0    conda-forge
argon2-cffi               23.1.0             pyhd8ed1ab_0    conda-forge
argon2-cffi-bindings      21.2.0          py311heffc1b2_4    conda-forge
arrow                     1.3.0              pyhd8ed1ab_0    conda-forge
asttokens                 2.4.1              pyhd8ed1ab_0    conda-forge
async-lru                 2.0.4              pyhd8ed1ab_0    conda-forge
attrs                     23.1.0             pyh71513ae_1    conda-forge
babel                     2.14.0             pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.12.2             pyha770c72_0    conda-forge
bleach                    6.1.0              pyhd8ed1ab_0    conda-forge
brotli                    1.1.0                hb547adb_1    conda-forge
brotli-bin                1.1.0                hb547adb_1    conda-forge
brotli-python             1.1.0           py311ha891d26_1    conda-forge
bzip2                     1.0.8                h93a5062_5    conda-forge
ca-certificates           2023.11.17           hf0a4a13_0    conda-forge
cached-property           1.5.2                hd8ed1ab_1    conda-forge
cached_property           1.5.2              pyha770c72_1    conda-forge
certifi                   2023.11.17         pyhd8ed1ab_0    conda-forge
cffi                      1.16.0          py311h4a08483_0    conda-forge
charset-normalizer        3.3.2              pyhd8ed1ab_0    conda-forge
colorama                  0.4.6              pyhd8ed1ab_0    conda-forge
comm                      0.1.4              pyhd8ed1ab_0    conda-forge
contourpy                 1.2.0           py311hd03642b_0    conda-forge
cycler                    0.12.1             pyhd8ed1ab_0    conda-forge
cython                    3.0.7           py311h92babd0_0    conda-forge
debugpy                   1.8.0           py311ha891d26_1    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
defusedxml                0.7.1              pyhd8ed1ab_0    conda-forge
discretize                0.10.0          py311hc00d0f6_1    conda-forge
entrypoints               0.4                pyhd8ed1ab_0    conda-forge
exceptiongroup            1.2.0              pyhd8ed1ab_0    conda-forge
executing                 2.0.1              pyhd8ed1ab_0    conda-forge
fonttools                 4.47.0          py311h05b510d_0    conda-forge
fqdn                      1.5.1              pyhd8ed1ab_0    conda-forge
freetype                  2.12.1               hadb7bae_2    conda-forge
gettext                   0.21.1               h0186832_0    conda-forge
idna                      3.6                pyhd8ed1ab_0    conda-forge
importlib-metadata        7.0.0              pyha770c72_0    conda-forge
importlib_metadata        7.0.0                hd8ed1ab_0    conda-forge
importlib_resources       6.1.1              pyhd8ed1ab_0    conda-forge
ipykernel                 6.26.0             pyh3cd1d5f_0    conda-forge
ipython                   8.18.1             pyh707e725_3    conda-forge
ipywidgets                8.1.1              pyhd8ed1ab_0    conda-forge
isoduration               20.11.0            pyhd8ed1ab_0    conda-forge
jedi                      0.19.1             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
json5                     0.9.14             pyhd8ed1ab_0    conda-forge
jsonpointer               2.4             py311h267d04e_3    conda-forge
jsonschema                4.20.0             pyhd8ed1ab_0    conda-forge
jsonschema-specifications 2023.11.2          pyhd8ed1ab_0    conda-forge
jsonschema-with-format-nongpl 4.20.0             pyhd8ed1ab_0    conda-forge
jupyter                   1.0.0             pyhd8ed1ab_10    conda-forge
jupyter-lsp               2.2.1              pyhd8ed1ab_0    conda-forge
jupyter_client            8.6.0              pyhd8ed1ab_0    conda-forge
jupyter_console           6.6.3              pyhd8ed1ab_0    conda-forge
jupyter_core              5.5.1           py311h267d04e_0    conda-forge
jupyter_events            0.9.0              pyhd8ed1ab_0    conda-forge
jupyter_server            2.12.1             pyhd8ed1ab_0    conda-forge
jupyter_server_terminals  0.5.0              pyhd8ed1ab_0    conda-forge
jupyterlab                4.0.9              pyhd8ed1ab_0    conda-forge
jupyterlab_pygments       0.3.0              pyhd8ed1ab_0    conda-forge
jupyterlab_server         2.25.2             pyhd8ed1ab_0    conda-forge
jupyterlab_widgets        3.0.9              pyhd8ed1ab_0    conda-forge
kiwisolver                1.4.5           py311he4fd1f5_1    conda-forge
lcms2                     2.16                 ha0e7c42_0    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libblas                   3.9.0           20_osxarm64_accelerate    conda-forge
libbrotlicommon           1.1.0                hb547adb_1    conda-forge
libbrotlidec              1.1.0                hb547adb_1    conda-forge
libbrotlienc              1.1.0                hb547adb_1    conda-forge
libcblas                  3.9.0           20_osxarm64_accelerate    conda-forge
libcxx                    16.0.6               h4653b0c_0    conda-forge
libdeflate                1.19                 hb547adb_0    conda-forge
libexpat                  2.5.0                hb7217d7_1    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgfortran               5.0.0           13_2_0_hd922786_1    conda-forge
libgfortran5              13.2.0               hf226fd6_1    conda-forge
libglib                   2.78.3               hb438215_0    conda-forge
libiconv                  1.17                 h0d3ecfb_2    conda-forge
libjpeg-turbo             3.0.0                hb547adb_1    conda-forge
liblapack                 3.9.0           20_osxarm64_accelerate    conda-forge
libpng                    1.6.39               h76d750c_0    conda-forge
libscotch                 7.0.4                hc938e73_1    conda-forge
libsodium                 1.0.18               h27ca646_1    conda-forge
libsqlite                 3.44.2               h091b4b1_0    conda-forge
libtiff                   4.6.0                ha8a6c65_2    conda-forge
libwebp-base              1.3.2                hb547adb_0    conda-forge
libxcb                    1.15                 hf346824_0    conda-forge
libzlib                   1.2.13               h53f4e23_5    conda-forge
llvm-openmp               17.0.6               hcd81f8e_0    conda-forge
markupsafe                2.1.3           py311heffc1b2_1    conda-forge
matplotlib                3.8.2           py311ha1ab1f8_0    conda-forge
matplotlib-base           3.8.2           py311hfdba5f6_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
meson                     1.3.0              pyhd8ed1ab_0    conda-forge
meson-python              0.15.0             pyh0c530f3_0    conda-forge
metis                     5.1.1                h965bd2d_2    conda-forge
mistune                   3.0.2              pyhd8ed1ab_0    conda-forge
mumps-include             5.6.2                hce30654_0    conda-forge
mumps-seq                 5.6.2                hfe4d18a_0    conda-forge
mumpys                    0.0.1                    pypi_0    pypi
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
nbclient                  0.8.0              pyhd8ed1ab_0    conda-forge
nbconvert                 7.13.0             pyhd8ed1ab_0    conda-forge
nbconvert-core            7.13.0             pyhd8ed1ab_0    conda-forge
nbconvert-pandoc          7.13.0             pyhd8ed1ab_0    conda-forge
nbformat                  5.9.2              pyhd8ed1ab_0    conda-forge
ncurses                   6.4                  h463b476_2    conda-forge
nest-asyncio              1.5.8              pyhd8ed1ab_0    conda-forge
ninja                     1.11.1               hffc8910_0    conda-forge
notebook                  7.0.6              pyhd8ed1ab_0    conda-forge
notebook-shim             0.2.3              pyhd8ed1ab_0    conda-forge
numpy                     1.26.2          py311h6d074dd_0    conda-forge
openjpeg                  2.5.0                h4c1507b_3    conda-forge
openssl                   3.2.0                h0d3ecfb_1    conda-forge
overrides                 7.4.0              pyhd8ed1ab_0    conda-forge
packaging                 23.2               pyhd8ed1ab_0    conda-forge
pandoc                    3.1.3                hce30654_0    conda-forge
pandocfilters             1.5.0              pyhd8ed1ab_0    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pcre2                     10.42                h26f9a81_0    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.1.0          py311hb9c5795_0    conda-forge
pip                       23.3.2             pyhd8ed1ab_0    conda-forge
pkg-config                0.29.2            hab62308_1008    conda-forge
pkgutil-resolve-name      1.3.10             pyhd8ed1ab_1    conda-forge
platformdirs              4.1.0              pyhd8ed1ab_0    conda-forge
prometheus_client         0.19.0             pyhd8ed1ab_0    conda-forge
prompt-toolkit            3.0.42             pyha770c72_0    conda-forge
prompt_toolkit            3.0.42               hd8ed1ab_0    conda-forge
psutil                    5.9.7           py311h05b510d_0    conda-forge
pthread-stubs             0.4               h27ca646_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pyaccel                   0.0.1                    pypi_0    pypi
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pygments                  2.17.2             pyhd8ed1ab_0    conda-forge
pyobjc-core               10.1            py311h665608e_0    conda-forge
pyobjc-framework-cocoa    10.1            py311h665608e_0    conda-forge
pyparsing                 3.1.1              pyhd8ed1ab_0    conda-forge
pyproject-metadata        0.7.1              pyhd8ed1ab_0    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.7          hdf0ec26_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python-fastjsonschema     2.19.0             pyhd8ed1ab_0    conda-forge
python-json-logger        2.0.7              pyhd8ed1ab_0    conda-forge
python_abi                3.11                    4_cp311    conda-forge
pytz                      2023.3.post1       pyhd8ed1ab_0    conda-forge
pyyaml                    6.0.1           py311heffc1b2_1    conda-forge
pyzmq                     25.1.2          py311h6727e71_0    conda-forge
qtconsole-base            5.5.1              pyha770c72_0    conda-forge
qtpy                      2.4.1              pyhd8ed1ab_0    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
referencing               0.32.0             pyhd8ed1ab_0    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
rfc3339-validator         0.1.4              pyhd8ed1ab_0    conda-forge
rfc3986-validator         0.1.1              pyh9f0ad1d_0    conda-forge
rpds-py                   0.15.2          py311h94f323b_0    conda-forge
scipy                     1.11.4          py311h2b215a9_0    conda-forge
scotch                    7.0.4                heaa5b5c_1    conda-forge
send2trash                1.8.2              pyhd1c38e8_0    conda-forge
setuptools                68.2.2             pyhd8ed1ab_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sniffio                   1.3.0              pyhd8ed1ab_0    conda-forge
soupsieve                 2.5                pyhd8ed1ab_1    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
terminado                 0.18.0             pyh31c8845_0    conda-forge
tinycss2                  1.2.1              pyhd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tomli                     2.0.1              pyhd8ed1ab_0    conda-forge
tornado                   6.3.3           py311heffc1b2_1    conda-forge
traitlets                 5.14.0             pyhd8ed1ab_0    conda-forge
types-python-dateutil     2.8.19.14          pyhd8ed1ab_0    conda-forge
typing-extensions         4.9.0                hd8ed1ab_0    conda-forge
typing_extensions         4.9.0              pyha770c72_0    conda-forge
typing_utils              0.1.0              pyhd8ed1ab_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
uri-template              1.3.0              pyhd8ed1ab_0    conda-forge
urllib3                   2.1.0              pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.12             pyhd8ed1ab_0    conda-forge
webcolors                 1.13               pyhd8ed1ab_0    conda-forge
webencodings              0.5.1              pyhd8ed1ab_2    conda-forge
websocket-client          1.7.0              pyhd8ed1ab_0    conda-forge
wheel                     0.42.0             pyhd8ed1ab_0    conda-forge
widgetsnbextension        4.0.9              pyhd8ed1ab_0    conda-forge
xorg-libxau               1.0.11               hb547adb_0    conda-forge
xorg-libxdmcp             1.1.3                h27ca646_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
zeromq                    4.3.5                h965bd2d_0    conda-forge
zipp                      3.17.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               h53f4e23_5    conda-forge
zstd                      1.5.5                h4f39d0f_0    conda-forge

Environment info

active environment : simulation
    active env location : /Users/jcapriot/miniforge3/envs/simulation
            shell level : 4
       user config file : /Users/jcapriot/.condarc
 populated config files : /Users/jcapriot/miniforge3/.condarc
          conda version : 23.3.1
    conda-build version : not installed
         python version : 3.10.12.final.0
       virtual packages : __archspec=1=arm64
                          __osx=14.1=0
                          __unix=0=0
       base environment : /Users/jcapriot/miniforge3  (writable)
      conda av data dir : /Users/jcapriot/miniforge3/etc/conda
  conda av metadata url : None
           channel URLs : https://conda.anaconda.org/conda-forge/osx-arm64
                          https://conda.anaconda.org/conda-forge/noarch
          package cache : /Users/jcapriot/miniforge3/pkgs
                          /Users/jcapriot/.conda/pkgs
       envs directories : /Users/jcapriot/miniforge3/envs
                          /Users/jcapriot/.conda/envs
               platform : osx-arm64
             user-agent : conda/23.3.1 requests/2.31.0 CPython/3.10.12 Darwin/23.1.0 OSX/14.1
                UID:GID : 502:20
             netrc file : None
           offline mode : False
jcapriot commented 10 months ago

I would add that running in a directory such that ../lib/libdmumps.dylib exists (I just put a symlink to lib in a directory above my cwd) successfully executes.

jcapriot commented 10 months ago

I was able to get this to work with a bit of hacking, hopefully the steps I took will help to identify where to fix it.

I first had to use install_name_tool to change the shared library identification name.

install_name_tool -id "@rpath/libdmumps_seq.dylib" libdmumps_seq.dylib

Then I had to forcefully re-sign the signature for it to run (something apparently only necessary on osx-arm64):

codesign --force -s - libdmumps_seq.dylib

jcapriot commented 10 months ago

Comparing to the makefile command to create libmumps_common.dylib it would appear that line 224 needs to be patched to include:

-Wl,$(SONAME),lib$(ARITH)mumps$(PLAT)$(LIBEXT_SHARED)