安装 rJava - 一种或多种 JNI 类型与 Mac Os 10.11 上的相应本机类型不同 [英] install rJava - One or more JNI types differ from the corresponding native type on Mac Os 10.11

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

问题描述

我正在尝试在我的 mac 上获得一个有效的 R 环境.我刚刚更新到 Mac OS 10.11.1.

I am trying to get a working R environnement on my mac. I just updated to Mac OS 10.11.1.

从 rStudio, install.packages("rJava") 导致此错误:

From rStudio, install.packages("rJava") leads to this error:

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/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/../include/darwin'
java libs   : '-L/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/lib/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 ‘/usr/local/lib/R/3.2/site-library/rJava’

R CMD javareconf 的输出为:

The output of R CMD javareconf is:

Java interpreter : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/jre/bin/java
Java version     : 1.8.0_66
Java home path   : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
Java compiler    : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/javac
Java headers gen.: /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/javah
Java archive tool: /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/bin/jar
System Java on OS X

trying to compile and link a JNI program 
detected JNI cpp flags    : -I/System/Library/Frameworks/JavaVM.framework/Headers
detected JNI linker flags : -framework JavaVM
clang -I/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl/include -I/usr/local/include  -I/usr/local/include   -fPIC  -g -O2  -c conftest.c -o conftest.o
conftest.c:4:5: warning: 'JNI_CreateJavaVM' is deprecated [-Wdeprecated-declarations]
JNI_CreateJavaVM(0, 0, 0);
^
/System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1937:1: note:    'JNI_CreateJavaVM' has been explicitly marked deprecated here
JNI_CreateJavaVM(JavaVM **pvm, void **penv, void *args);
^
1 warning generated.
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -        L/usr/local/Cellar/r/3.2.2_1/R.framework/Resources/lib -    L/usr/local/opt/gettext/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/openssl/lib -L/usr/local/lib -o conftest.so conftest.o -framework JavaVM -F/usr/local/Cellar/r/3.2.2_1/R.framework/.. -framework R -lintl -Wl,-framework -Wl,CoreFoundation


JAVA_HOME        : /Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home
Java library path: 
JNI cpp flags    : -I/System/Library/Frameworks/JavaVM.framework/Headers
JNI linker flags : -framework JavaVM
Updating Java configuration in /usr/local/Cellar/r/3.2.2_1/R.framework/Resources

我不知道.有没有办法解决这个问题?

I have no clue. Any idea to fix this?

谢谢

推荐答案

我有 完全相同的问题,最后通过我找到的解决方案解决了这里.

I had exactly the same problem, and finally resolved, via a solution I found here.

新的 Mac OS X(10.11,El Capitan)在环境变量方面有问题.

The new Mac OS X (10.11, El Capitan) has trouble with env variables.

rJava 的最新开发风格设法正确处理事情.这是我为解决它所做的:

The newest dev flavor of rJava manages to handle things correctly. Here is what I did to resolve it:

  1. 这里
  2. 从下载的源安装:

  1. Download version 0.9-8 (rJava_0.9-8.tar.gz) from here
  2. Install it from the downloaded source:

$ R CMD INSTALL ~/Downloads/rJava_0.9-8.tar.gz

$ R CMD INSTALL ~/Downloads/rJava_0.9-8.tar.gz

(或者你放在哪里)

仅此而已!

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

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