I have a problem with installing the newest version of R, an error "fatal error: jni.h: No such file or directory" that I don't understand appeared. Here is what I did before getting an error in the installation of R :
#download tar.gz file #install because we need it for execution of "make" sudo apt-get install libx11-dev sudo apt-get install xorg-dev sudo apt-get install libcurl4-openssl-dev # decompile # on terminal ./configure make What appeared to me at the end of the installation after installing libraries was this (can't paste everything because it is too long):
installing to /home/fafnyr/R/R-3.5.2/library/mgcv/libs ** R ** data ** inst ** byte-compile and prepare package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded * DONE (mgcv) make[2]: Leaving directory '/home/fafnyr/R/R-3.5.2/src/library/Recommended' make[1]: Leaving directory '/home/fafnyr/R/R-3.5.2/src/library/Recommended' make[1]: Entering directory '/home/fafnyr/R/R-3.5.2/src/library' building/updating vignettes for package 'grid' ... building/updating vignettes for package 'parallel' ... building/updating vignettes for package 'utils' ... make[1]: Leaving directory '/home/fafnyr/R/R-3.5.2/src/library' make[1]: Entering directory '/home/fafnyr/R/R-3.5.2' configuring Java ... Java interpreter : /usr/bin/java Java version : 10.0.2 Java home path : /usr/lib/jvm/java-11-openjdk-amd64 Java compiler : not present Java headers gen.: Java archive tool: trying to compile and link a JNI program detected JNI cpp flags : detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm make[2]: Entering directory '/tmp/Rjavareconf.VwU72a' gcc -I"/home/fafnyr/R/R-3.5.2/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -c conftest.c -o conftest.o conftest.c:1:10: fatal error: jni.h: No such file or directory #include <jni.h> ^~~~~~~ compilation terminated. /home/fafnyr/R/R-3.5.2/etc/Makeconf:162: recipe for target 'conftest.o' failed make[2]: *** [conftest.o] Error 1 make[2]: Leaving directory '/tmp/Rjavareconf.VwU72a' Unable to compile a JNI program JAVA_HOME : /usr/lib/jvm/java-11-openjdk-amd64 Java library path: JNI cpp flags : JNI linker flags : Updating Java configuration in /home/fafnyr/R/R-3.5.2 Done. make[1]: Leaving directory '/home/fafnyr/R/R-3.5.2' 11 Answer
For this problem, I found the solution:
sudo apt install default-jdk For the makefile, I also had some problem so I installed this:
sudo apt-get install libx11-dev sudo apt-get install xorg-dev sudo apt-get install libcurl4-openssl-dev Moreover for the installation of 3.5.2, I followed those instructions:
Install the packages necessary to add a new repository over HTTPS:
sudo apt install apt-transport-https software-properties-commonEnable the CRAN repository and add the CRAN GPG key to your system using the following commands:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 sudo add-apt-repository 'deb bionic-cran35/'Now that the repository is added, update the packages list and install the R package by typing:
sudo apt update sudo apt install r-baseTo verify that the installation was successful run the following command which will print the R version:
R --version # or # sudo -i R