简体   繁体   中英

Cannot install rJava on Big Sur

In the following environment:

  • Mac OS: Big Sur
  • R: version 4.0.3
  • Java: java version "1.8.0_271"

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:

  1. use --disable-jri when installing rJava from sources (eg via install.packages("rJava", configure.args="--disable-jri") )

  2. use rJava from CRAN (ie, install the binary version of rJava - not source)

The issue tracking this is #248

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM