Java App Using CP-SAT works on Windows, but not macOS

62 Views Asked by At

I am working on an application which integrates the CP-SAT functionality from Google OR-Tools. It runs perfectly on my Windows machine, but running the exact same code in IntelliJ on my MacBook leads to this error:

Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: 
Can't load library: /var/folders/fh/p53vbgc50gq9h80kn950pvnh0000gn/T/ortools-java17235137568310781234/darwin/libjniortools.dylib

I am a beginner, so I don't understand what this means, and cannot find any solution.

I tried changing the library importing code from OrToolsHelper.loadLibrary(); to Loader.loadNativeLibraries();. This helps. The code gets further along, but it still shows another Unsatisfied Link Error:

Exception in thread "Thread-1" java.lang.UnsatisfiedLinkError: 
byte[] com.google.ortools.sat.mainJNI.SatHelper_solveWithParameters(byte[], byte[])
1

There are 1 best solutions below

0
Laurent Perron On

Have a look at this issue on the OR-Tools github.

Most likely the issue is that you need to force the jna dependency in the maven configuration file to use the latest version.