gpt4 book ai didi

r - 安装 rJava - 一种或多种 JNI 类型与 Mac Os 10.11 上相应的 native 类型不同

转载 作者:行者123 更新时间:2023-12-01 19:20:18 26 4
gpt4 key购买 nike

我正在尝试在我的 mac 上建立一个可以工作的 R 环境。我刚刚更新到 Mac OS 10.11.1。

从 rStudio 中,install.packages("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/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 的输出是:

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

我不知道。有办法解决这个问题吗?

谢谢

最佳答案

我有exactly the same problem ,并最终通过我找到的解决方案解决了 here .

新的 Mac OS X(10.11、El Capitan)在环境变量方面存在问题。

<小时/>

最新的 rJava 开发风格能够正确处理事情。这是我解决这个问题的方法:

  1. here 下载版本 0.9-8 (rJava_0.9-8.tar.gz)
  2. 从下载的源安装它:

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

(或者无论你把它放在哪里)

这就是全部!

关于r - 安装 rJava - 一种或多种 JNI 类型与 Mac Os 10.11 上相应的 native 类型不同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33550437/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com