GreenDelta / olca-app

Source code of openLCA
openlca.org
Mozilla Public License 2.0
193 stars 43 forks source link

Loading native libraries fails on macOS Ventura #279

Closed msrocka closed 1 year ago

msrocka commented 1 year ago

openLCA crashes with an UnsatisfiedLinkError on startup because it fails to load the native math libraries. It first looks into the openLCA workspace ~/openLCA-data-1.4/olca-native/0.0.1/x64 and tries to load the libraries from there (this is the folder where the native libraries for fast sparse matrix calculations are installed). If no libraries are installed there, it checks the openLCA.app/Eclipse/olca-native/0.0.1/x64 folder and tries to load the libraries from there. There is a olca-native.json file in these folders that defines the load order of the libraries.

The newest openLCA 2 version was updated so that it shouldn't crash anymore but the native libraries are still not loaded. The reason for the error are macOS & Java internals explained in the JDK bug tracker: https://bugs.openjdk.org/browse/JDK-8275703 However, updating to a newer JDK version does not fixes the error with the current load order. It seems that modifying the load order works (by changing the text of the olca-native.json files), but this needs to be further tested:

Load order for the BLAS module under openLCA.app:

{
  "modules": [
    "blas"
  ],
  "libraries": [
    "libopenblas64_.dylib",
    "libolcar.dylib",
    "libgcc_s.1.dylib",
    "libquadmath.0.dylib",
    "libgfortran.5.dylib"
  ]
}

Load order for the BLAS+UMFPACK module in the openLCA workspace:

{
  "modules": [
    "blas",
    "umfpack"
  ],
  "libraries": [
    "libsuitesparseconfig.5.4.0.dylib",
    "libamd.2.4.6.dylib",
    "libccolamd.2.9.6.dylib",
    "libumfpack.5.7.8.dylib",
    "libgfortran.5.dylib",
    "libopenblas64_.dylib",
    "libcolamd.2.9.6.dylib",
    "libolcar_withumf.dylib",
    "libcamd.2.4.6.dylib",
    "libquadmath.0.dylib",
    "libgcc_s.1.dylib",
    "libcholmod.3.0.13.dylib"
  ]
}

If the native libraries are loaded (after a restart) the following Python script executed in openLCA should print True:

from org.openlca.nativelib import NativeLib

print(NativeLib.isLoaded())