Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to install rJava in centos R

Tags:

java

bash

r

hdfs

rjava

Iam unable to install rJava in centos R, its the base to install rhdfs. Please help and look at the output i got while installing rJava.

> install.packages( c("rJava"))
Installing package into ‘/home/training/R/x86_64-redhat-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://ftp.iitm.ac.in/cran/src/contrib/rJava_0.9-6.tar.gz'
Content type 'application/x-gzip' length 567515 bytes (554 Kb)
opened URL
==================================================
downloaded 554 Kb

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -m64 -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -m64 -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : '-I/usr/java/jdk1.6.0_31/jre/../include -I/usr/java/jdk1.6.0_31/jre/../include/linux'
java libs   : '-L/usr/java/jdk1.6.0_31/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... yes
checking whether -Xrs is supported... yes
checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types differ from the corresponding native type. You may need to use non-standard compiler flags or a different compiler in order to fix this.
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/training/R/x86_64-redhat-linux-gnu-library/3.1/rJava’

The downloaded source packages are in
    ‘/tmp/Rtmp1RKjkQ/downloaded_packages’
Warning message:
In install.packages(c("rJava")) :
  installation of package ‘rJava’ had non-zero exit status

Please find below what I got from R CMD javareconf -ed, its showing the correct path i have given on the bash.profile file. please let me know what about i do to install rJava and then rhdfs..

$ R CMD javareconf -ed
Java interpreter : /etc/alternatives/java_sdk_openjdk/jre/bin/java
Java version     : 1.6.0_30
Java home path   : /etc/alternatives/java_sdk_openjdk
Java compiler    : /etc/alternatives/java_sdk_openjdk/bin/javac
Java headers gen.: /etc/alternatives/java_sdk_openjdk/bin/javah
Java archive tool: /etc/alternatives/java_sdk_openjdk/bin/jar

trying to compile and link a JNI progam 
detected JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/etc/alternatives/java_sdk_openjdk/include -I/etc/alternatives/java_sdk_openjdk/include/linux -I/usr/local/include    -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic  -c conftest.c -o conftest.o
gcc -m64 -std=gnu99 -shared -L/usr/local/lib64 -o conftest.so conftest.o -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm -L/usr/lib64/R/lib -lR


JAVA_HOME        : /etc/alternatives/java_sdk_openjdk
Java library path: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server
JNI cpp flags    : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm
Updating Java configuration in /usr/lib64/R
/usr/lib64/R/bin/javareconf: line 405: /usr/lib64/R/etc/Makeconf.new: Permission denied
*** cannot create /usr/lib64/R/etc/Makeconf.new
*** Please run as root if required.

I have uninstalled and reinstalled R again to do this, still iam getting same error, please help how to get this done..

like image 700
harry Avatar asked Jul 08 '14 05:07

harry


1 Answers

This got resolved with below instruction:

$export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.55.x86_64/jre
$export PATH=$PATH:$JAVA_HOME/bin
$sudo /usr/bin/R CMD javareconf
$R

This worked fine and i was able to install rhdfs, after this on centos.

like image 198
harry Avatar answered Sep 28 '22 12:09

harry