I have a custom compiled R installation. I had to custom compile it in order to use MKL.
In my build.sbt I have the following line
javaOptions += "-Djava.library.path=/Users/me/R-3.3.2/lib:/Users/taylor/Library/R/3.3/library/rJava/jri
and also:
fork := true so javaOptions works right.
To test this I fire up sbt and attempt to load jri with System.loadLibrary("jri"). I get the following error:
java.lang.UnsatisifiedLinkError: /Users/me/R/3.3/library/rJava/jri/libjri.jnilib: dlopen(/Users/me/Library/R/3.3/library/rJava/jri/libjri.jnilib, 1): Library not loaded libR.dylib
So I went to see with otool what it expects -
otool -L libjri.jnilib in /Users/me/Library/R/3.3/library/rJava/jri has the following in it: (remainder omitted)
libjri.jnilib
libjri.jnilib (compatibility version 0.0.0, current version 0.0.0)
...
libR.dylib (compatibility version 3.3.0, current version 3.3.2)
...
I thought this looked funny, so I copied libR.dylib from /Users/me/R-3.3.2/libinto /Users/me/Library/R/3.3/library/rJava/jri to see if it was just looking around locally.
Unfortunately I still get the same error.
I'm at a complete loss on what I need to do to make this work, and it has ground my entire project to a halt. Has anyone experienced this and fixed it?
First, note that you shouldn't need to re-compile R in order to use MKL, because the CRAN OS X binaries are intentionally shipped such that you can point
libRblas.dylibto any compatible BLAS implementation - consider reading the R documentation.As for the error, it seems that you have compiled R without framework support and/or have not installed it, hence
libRdoesn't contain the full path. Also you have likely not used the recommended way to start your Java application useR CMD. You can either useto fix your
libRmanually (where<libR>is the full path to yourlibR.dylib), or you can useto force
libjrito pick up you location oflibR. There are other ways as well, such as settingDYLD_...env vars before you start Java or usingR CMD.