In the following environment:
I am trying to run:
install.packages("rJava", type='source')
However, it fails with the following error:
clang -o libjri.jnilib Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o -dynamiclib -framework JavaVM -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/lib -L/usr/local/Cellar/r/4.0.3/lib/R/lib -lR -L/usr/local/Cellar/pcre2/10.35/lib -lpcre2-8 -llzma -lbz2 -lz -licucore -ldl -lm -liconv
ld: framework not found JavaVM
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/usr/local/lib/R/4.0/site-library/rJava’
* restoring previous ‘/usr/local/lib/R/4.0/site-library/rJava’
I found this issue which seems to raise a similar problem, but I do not understand how to resolve it.
I would highly appreciate if you could help me understand why the installation fails.
JRI is currently not supported on Big Sur, because Apple has removed the last traces of Java support - here the JavaVM framework, so you have two options:
use --disable-jri
when installing rJava from sources (e.g. via install.packages("rJava", configure.args="--disable-jri")
)
use rJava from CRAN (i.e., install the binary version of rJava - not source)
The issue tracking this is #248