[R] Installing rJava fails on Gentoo (amd64) with Sun JDK - checking JNI data types... error

Helgi Tomasson helgito at hi.is
Mon Sep 6 13:31:31 CEST 2010


Try the following:

as super-user

java-config -L 

java-config -S (put a number pointing to sun-jdk-1.6)

R CMD javareconf

export JAVA_HOME=/usr/lib/jvm/sun-jdk-1.6/jre

export R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server:
${JAVA_HOME}/lib/amd64:
${JAVA_HOME}/../lib/amd64::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib

start R

install.packages("rJava")
install.packages("JGR")

then as a normal user 

C_NUMERIC=C
export LC_NUMERIC

/usr/lib/jvm/sun-jdk-1.6/jre/bin/java -Xmx512m -Djgr.load.pkgs=yes
-Djgr.loader.ver="${JGR_LOADER_VER}" -Djava.library.path=".:
${LD_LIBRARY_PATH}" -classpath "/usr/lib64/R/library/rJava/java/boot"
-Drjava.path="/usr/lib64/R/library/rJava"
-Drjava.class.path="/usr/lib64/R/library/rJava/jri/JRI.jar:/usr/lib64/R/library/iplots/java/iplots.jar:/usr/lib64/R/library/JGR/java/JGR.jar" -Dmain.class=org.rosuda.JGR.JGR RJavaClassLoader $*


library(JGR)
JGR()

This got JGR started on my computer. I still have problems with
dyn.load.

Best regards


Helgi Tomasson





On Fri, 2010-08-13 at 23:31 +0100, Anthony Staines wrote:
> Installing rJava fails consistently, whether installed via
> the command line as below, or through "install.packages(
> 'rJava' )", and whether 0.84 or 0.85 is used, with the
> message :-
> "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."
> 
> I've tried to fix it using suggestions from the r-help list,
> and the Gentoo java documentation, but had no joy so far.
> Other Java stuff works fine on this box.
> 
> # R CMD INSTALL rJava_0.8-5.tar.gz
> * installing to library ‘/usr/lib64/R/library’
> * installing *source* package ‘rJava’ ...
> checking for gcc... x86_64-pc-linux-gnu-gcc -std=gnu99
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether x86_64-pc-linux-gnu-gcc -std=gnu99 accepts
> -g... yes
> checking for x86_64-pc-linux-gnu-gcc -std=gnu99 option to
> accept ISO C89... none needed
> checking how to run the C preprocessor...
> x86_64-pc-linux-gnu-gcc -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 x86_64-pc-linux-gnu-gcc
> -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    :
> '/home/astaines/.gentoo/java-config-2/current-user-vm/bin/javac'
> header prep.: '/usr/bin/javah'
> cpp flags   : '-I/opt/sun-jdk-1.6.0.20/jre/../include
> -I/opt/sun-jdk-1.6.0.20/jre/../include/linux'
> java libs   : '-L/opt/sun-jdk-1.6.0.20/jre/lib/amd64/server
> -L/opt/sun-jdk-1.6.0.20/jre/lib/amd64
> -L/opt/sun-jdk-1.6.0.20/jre/../lib/amd64 -L
> -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib
> -L/usr/lib -ljvm'
> 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 ‘/usr/lib64/R/library/rJava’
> 
> 
> # R --version
> R version 2.11.1 (2010-05-31)
> 
> # java -showversion
> java version "1.6.0_20"
> Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
> Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed  mode)
> 
> The compiler mentioned in the R output :-
> 	/home/astaines/.gentoo/java-config-2/current-user-vm
> is a link pointing to
> 	/usr/lib/jvm/sun-jdk-1.6
> which in turn is a link pointing to
> 	/opt/sun-jdk-1.6.0.20
> however, any of the three will work.
> 
> # R CMD javareconf
> *** JAVA_HOME is not a valid path, ignoring
> Java interpreter : /usr/bin/java
> Java version     : 1.6.0_20
> Java home path   : /opt/sun-jdk-1.6.0.20/jre
> Java compiler    :
> /home/astaines/.gentoo/java-config-2/current-user-vm/bin/javac
> Java headers gen.: /usr/bin/javah
> Java archive tool: /usr/bin/jar
> Java library path:
> $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
> JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server
> -L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L
> -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib
> -L/usr/lib -ljvm
> JNI cpp flags    : -I$(JAVA_HOME)/../include
> -I$(JAVA_HOME)/../include/linux
> 
> Updating Java configuration in /usr/lib64/R
> Done.
> 
> JAVA_HOME is unset by default on my system. As suggested, by
> Godmar Back, on the list I've tried setting it. The Gentoo
> way is to use
> 	JAVA_HOME=$(java-config --jdk-home)
> and this produces what I think is the desired result
> #printenv | grep -i JAVA_HOME
> 	JAVA_HOME=/opt/sun-jdk-1.6.0.20
> 
> BUT
> 
> # env JAVA_HOME=/opt/sun-jdk-1.6.0.20/ R CMD javareconf
> *** JAVA_HOME is not a valid path, ignoring
> Java interpreter : /usr/bin/java
> Java version     : 1.6.0_20
> Java home path   : /opt/sun-jdk-1.6.0.20/jre
> Java compiler    :
> /home/astaines/.gentoo/java-config-2/current-user-vm/bin/javac
> Java headers gen.: /usr/bin/javah
> Java archive tool: /usr/bin/jar
> Java library path:
> $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
> JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server
> -L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L
> -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib
> -L/usr/lib -ljvm
> JNI cpp flags    : -I$(JAVA_HOME)/../include
> -I$(JAVA_HOME)/../include/linux
> 
> Updating Java configuration in /usr/lib64/R
> Done.
> 
> 
> AND
> 
> Kitchen ~ # env JAVA_HOME=/opt/sun-jdk-1.6.0.20/ R CMD
> INSTALL rJava_0.8-5.tar.gz
> * installing to library ‘/usr/lib64/R/library’
> * installing *source* package ‘rJava’ ...
> checking for gcc... x86_64-pc-linux-gnu-gcc -std=gnu99
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> ....
> checking Java support in R... present:
> interpreter : '/usr/bin/java'
> archiver    : '/usr/bin/jar'
> compiler    :
> '/home/astaines/.gentoo/java-config-2/current-user-vm/bin/javac'
> header prep.: '/usr/bin/javah'
> cpp flags   : '-I/opt/sun-jdk-1.6.0.20/jre/../include
> -I/opt/sun-jdk-1.6.0.20/jre/../include/linux'
> java libs   : '-L/opt/sun-jdk-1.6.0.20/jre/lib/amd64/server
> -L/opt/sun-jdk-1.6.0.20/jre/lib/amd64
> -L/opt/sun-jdk-1.6.0.20/jre/../lib/amd64 -L
> -L/usr/java/packages/lib/amd64 -L/usr/lib64 -L/lib64 -L/lib
> -L/usr/lib -ljvm'
> 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 ‘/usr/lib64/R/library/rJava’
> 
> 
> All advice gratefully received



More information about the R-help mailing list