Closed kevin-delmas closed 7 months ago
To whoever has a clue (or wants to find one), the error is:
java.lang.UnsatisfiedLinkError: Native Library /.../pml-analyzer/target/task-temp-directory/sbt_ee22509e/libmonosat.so already loaded in another classloader
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2476)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2705)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2648)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1886)
at monosat.MonosatJNI.<clinit>(MonosatJNI.java:34)
at monosat.Solver.<init>(Solver.java:292)
at monosat.Solver.<init>(Solver.java:273)
at monosat.Solver.<init>(Solver.java:248)
at monosat.Solver.<init>(Solver.java:129)
at onera.pmlanalyzer.views.interference.model.formalisation.Problem$.onera$pmlanalyzer$views$interference$model$formalisation$Problem$$$getNewSolver(ProblemElement.scala:253)
I am not sure whether the error is more on the Java, Monosat, or PML side.
Found a solution [1], we need to add the following to the build.sbt
fork := true
It seems to work. The sbt documentation does mention it may be a solution to class loading issues, but it is unclear if this is only in the context of serialization [2]. This might have to do pending a better fix, e.g. preventing monosat (java) from being loaded multiple times.
[1] https://www.garysieling.com/blog/fixing-sbt-error-java-lang-unsatisfiedlinkerror-native-library-cusersgary-javacppcachend4j-native-0-9-1-windows-x86_64-jarorgnd4jnativeblaswindows-x86_64jnind4jcpu-dll-already-loaded-another-cla/ [2] https://www.scala-sbt.org/1.x/docs/Running-Project-Code.html
Awesome!! we should add some tests to ensure that we can now launch parallel instances of MONOSAT solving. The code has been designed to implement it easily.
A dynamic librairy already loaded error occurs when trying to execute severail main from sbt shell. We should find a way to detect if the dynamic library is already loaded and call monosat lib accordingly (bypass internal library loading in monosat.jar?)