0

I got scip optsuite from http://scip.zib.de/#scipoptsuite . It works fine as a standalone program and with the python interface, but I faced the following JNI error when I ran the example.

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jscip-0.1.darwin.x86_64.gnu.opt.spx in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1865)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at de.zib.jscip.nativ.jni.JniScipLibraryLoader.loadLibrary(JniScipLibraryLoader.java:7)
at JniKnapsack.main(JniKnapsack.java:34)

The OS is OS X 10.10.5. I compiled JNI with

make soplex GMP=false
make scip GMP=false ZIMPLE=false

The lib directory for JNI (path-to-scipoptsuite/scip-3.2.0/interfaces/jni/lib) contains the followings, and is referenced by LD_LIBRARY_PATH:

jniinc@ -> /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/include
libjscip-0.1.darwin.x86_64.gnu.opt.spx.so*
libjscip.darwin.x86_64.gnu.opt.so@ -> libjscip-0.1.darwin.x86_64.gnu.opt.spx.so
libjscip.so@ -> libjscip-0.1.darwin.x86_64.gnu.opt.spx.so
liblpispx.darwin.x86_64.gnu.opt.so
libnlpi.cppad.darwin.x86_64.gnu.opt.so
libscip.darwin.x86_64.gnu.opt.so
libsoplex.darwin.x86_64.gnu.opt.so
scip@ -> ../../..
scip.jar
soplex@ -> ../../../../soplex-2.2.0

I would be happy if you could give me a suggestion.


Accordiong to mueldgog's advice, I changed the extension to jnilib. Then another error occurred:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /.../scipoptsuite-3.2.0/scip-3.2.0/interfaces/jni/lib/libjscip-0.1.darwin.x86_64.gnu.opt.spx.jnilib: dlopen(/.../scipoptsuite-3.2.0/scip-3.2.0/interfaces/jni/lib/libjscip-0.1.darwin.x86_64.gnu.opt.spx.jnilib, 1): Library not loaded: lib/liblpispx-3.2.0.darwin.x86_64.gnu.opt.so
Referenced from: /.../scipoptsuite-3.2.0/scip-3.2.0/interfaces/jni/lib/libjscip-0.1.darwin.x86_64.gnu.opt.spx.jnilib
Reason: image not found

otools says:

Load command 11
      cmd LC_LOAD_DYLIB
  cmdsize 72
     name lib/liblpispx-3.2.0.darwin.x86_64.gnu.opt.so (offset 24)

In a Linux environment, where I successfully run the same command, lld says

liblpispx.linux.x86_64.gnu.opt.so => /.../scipoptsuite-3.2.0/scip-3.2.0/lib/liblpispx.linux.x86_64.gnu.opt.so (0x00002b66b3d35000)

So I think I should fix the reference to the absolute path on OS X, but don't know how to fix it. Could you give any advice for this?

mtnk
  • 1
  • 2
  • http://mrjoelkemp.com/2012/01/getting-started-with-jni-and-c-on-osx-lion/ Here they state that on an OS X system you need a shared library with the extension jnilib. – mueldgog Jan 19 '16 at 08:36
  • Thank you for your advice. I changed the extension to jnilib. Then another error occurred shown above. Could you give me a suggestion again? – mtnk Jan 20 '16 at 02:22
  • I don't think that it is sufficient to just change the file extension. You need to generate a shared library for your OS X system. It could be that you need to modify some compiling flags, like replacing -shared with -dynamiclib). Maybe this helps: https://developer.apple.com/library/mac/documentation/Java/Conceptual/Java14Development/05-CoreJavaAPIs/CoreJavaAPIs.html – mueldgog Jan 22 '16 at 10:07

0 Answers0