[R-sig-Debian] R Java compile problem

Peter Muhlberger pmuhl1848 at gmail.com
Fri Jun 4 07:23:30 CEST 2010


Ok, flag me for the annoying category of people who start to answer
their own questions (though still no solution).

I just noticed that while JAVA_HOME is pointing to the Sun version of
Java, the variables javareconf fills in are for openjdk, the open
source version of Java that I believe is auto-installed with Ubuntu.
(Does anyone know for sure?)

I also noticed that while the jre for openjdk is installed in my
system, the jdk, which presumably has the compiler info, is not
installed.  I installed it, ran javareconf again and, eureka!, my cpp
flags according to javareconf seem to be good.  I see:

##
cpp flags   : '-I/usr/lib/jvm/java-6-openjdk/jre/../include'
##

Triumphantly, I rerun the package update in R, but now get this error
(and something nearly identical for JGR itself):

##
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’
##

I'm guessing that rJava was compiled w/ Sun's Java and is balking at
openjdk.  From where I sit, it looks like there's a possible problem
with javareconf because it doesn't take JAVA_HOME, which points to
Sun's Java.

So, I'm guessing I need to get javareconf to use Sun's Java.  I used
this to reset my default Java:

##
sudo update-alternatives --config java
##

On resetting to Sun's Java, it still shows openjdk as 'auto', but the
Sun Java gets starred.  I run javareconf, which now points the Java
home path to:  /usr/lib/jvm/java-6-sun-1.6.0.20/jre.  However, it
continues to tell me that JAVA_HOME is not a valid path even though
JAVA_HOME continues to reference Sun's jvm directory.  (cpp flags also
now correctly point to Sun's Java, according to the compiler.)

When I run package update, compiling seems to work for JavaGD at
least, but after the compile I get:

##
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared library
'/usr/local/lib/R/site-library/JavaGD/libs/JavaGD.so':
  libjvm.so: cannot open shared object file: No such file or directory
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/JavaGD’
* restoring previous ‘/usr/local/lib/R/site-library/JavaGD’
##

JavaGD.so appears to be in the proper directory, but I'm looking at
the restored version.  And, yes, I'm running everything as root.

In the same run, when it gets to rJava, I have the same error as for
rJava running with openjdk: JNI types differ from the native type.

So, now I'm really stumped.  Again, perhaps this needs to be mentioned
to the tech people who put javareconf or perhaps Ubuntu's handling of
Java together, but I'm not sure where to do so.



More information about the R-SIG-Debian mailing list