安装rJava-“配置:错误:一种或多种JNI类型不同于相应的本机类型" [英] install rJava - "configure: error: One or more JNI types differ from the corresponding native type"

查看:73
本文介绍了安装rJava-“配置:错误:一种或多种JNI类型不同于相应的本机类型"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在R3.0.1上安装rJava时遇到了这个问题: 配置:错误:一种或多种JNI类型与相应的本机类型不同"

I have came across this problem while installing rJava on R3.0.1: "configure: error: One or more JNI types differ from the corresponding native type"

详细信息附在下面. 我搜索了类似的问题,但是我的问题有点棘手,许多提议的解决方案要么无效,要么无法尝试,因为我在服务器上工作,而该服务器没有对系统库的写访问权.

The detailed message is attached below. I searched for similar problems but my issue is a little trickier and many proposed solutions either didnt work or I could not try, because I am working on a server which I do not have write access to system libraries.

OS :Linux 2.6.18-348.6.1.el5#1 SMP Tue May 21 15:44:27 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux(输入"uname -a 对不起,我不太了解此信息)

OS: Linux 2.6.18-348.6.1.el5 #1 SMP Tue May 21 15:44:27 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux (info given by typing "uname -a" sorry I couldn't quite understand this info)

R :R3.0.1,我下载了源代码,并将其放在主目录中,并从源代码构建了R.

R: R3.0.1, I downloaded the source, put in my home directory, and built R from source.

rJava :我运行了'install.packages("rJava")',在安装过程中我得到了:

rJava: I ran 'install.packages("rJava")', during installation I got:

========================= 正在检查R中的Java支持...目前:
解释器:'/usr/bin/java'
archiver:"/usr/bin/jar"
编译器:'/usr/bin/javac'
标头准备:'/usr/bin/javah'
cpp标志:'-I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include-
I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include/linux'
java库:'-L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/se
rver -ljvm'
检查是否可以编译JNI程序...是 正在检查JNI数据类型...配置:错误:一种或多种JNI类型与相应的本机类型不同.您可能需要使用非标准的编译器标志或
为了解决此问题,使用了其他编译​​器.
错误:包"rJava"的配置失败
*删除"/home/me/R-3.0.1/library/rJava"

=========================
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/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include -
I/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/../include/linux'
java libs : '-L/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.9.x86_64/jre/lib/amd64/se
rver -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 '/home/me/R-3.0.1/library/rJava'

=================================

==================================

由于我只能远程访问服务器,因此我无权访问主目录/home/me之外的任何内容.

Since I can only access the server remotely, I do not have write access to anything outside my home directory /home/me.

任何信息将不胜感激!

推荐答案

只要我尝试以普通用户身份安装(Linux,Debian),在R版本3.0.2中尝试install.packages("rJava")时都会遇到相同的问题. .以root身份运行install.packages("rJava")没问题.然后,尝试library(rJava)可以为root用户工作,但不能作为我的用户:

I ran into the same problem trying to install.packages("rJava") in R version 3.0.2, as long as I tried to install as ordinary user (Linux, Debian). There was no problem running install.packages("rJava") as root. Then, trying library(rJava) worked for root but not for me as a user:

Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/usr/usr.local.original.Debian/lib/R/site-library/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory

添加环境变量JAVA_HOMELD_LIBRARY_PATH所需的此问题 到~/.login(按照在

This problem required to add the environment variables JAVA_HOME and LD_LIBRARY_PATH to ~/.login (following instructions found at Trouble in Setting Java Environment Path on Ubuntu (libjvm.so: cannot open shared object file: No such file or directory)):

setenv JAVA_HOME /usr/lib/jvm/java-7-oracle/
setenv LD_LIBRARY_PATH $JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server

# For c-shell; for bash, it would have to be:
export JAVA_HOME=/usr/lib/jvm/java-7-oracle/
export LD_LIBRARY_PATH=$JAVA_HOME/jre/lib/amd64:$JAVA_HOME/jre/lib/amd64/server

因此,您将需要让系统管理员为您安装rJava,然后设置您的环境变量,当然还要在R中设置您自己的.libPaths()以便找到rJava.

So, you would have to have a system administrator install rJava for you, then set your environment variables and, of course, set your own .libPaths() in R such as to find rJava.

这篇关于安装rJava-“配置:错误:一种或多种JNI类型不同于相应的本机类型"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆