我遇到了许多其他人似乎在某一时刻遇到过的同样的 rJava 问题。R CMD INSTALL
测试JNI程序是否可以编译时出现该错误。
输出建议运行R CMD javareconf -ed
或sudo R CMD javareconf
后者的输出是:
computer: home$ sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.6.0_31
Java home path : /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path:
JNI linker flags : -framework JavaVM
JNI cpp flags : -I$(JAVA_HOME)/include
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
之后尝试安装 rJava 时,
computer: home$ R CMD INSTALL ~/Downloads/rJava_0.9-4.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library’
* installing *source* package ‘rJava’ ...
checking for gcc... gcc -arch x86_64 -std=gnu99
checking for C compiler default output file name... a.out
/* Passes all checks */
configure: checking whether gcc -arch x86_64 -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 : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags : '-I/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/include'
java libs : '-framework JavaVM'
checking whether JNI programs can be compiled... configure: error: Cannot compile a simple JNI program. See config.log for details.
Make sure you have Java Development Kit installed and correctly registered in R.
If in doubt, re-run "R CMD javareconf" as root.
ERROR: configuration failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/rJava’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/rJava’
/usr/bin/javac
替换为的替代尝试/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
同样失败。
我正在运行 Mac OS 10.7.3 和
computer: home$ java -version
java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b04-415-11M3646)
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01-415, mixed mode)
以下是在我的.bash_profile
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
此外,我在 Red-Hat 上也有同样的问题。我希望提供的任何修复程序也能在那里工作,但如果不能,为什么不知道,请解释。
几年来,我一直在使用这个网站令人难以置信的知识库,但这是我的第一篇文章。多谢提前。
我已经浏览过的一些(不是全部)资源是
- https://stat.ethz.ch/pipermail/r-devel/2008-November/051224.html
- https://stat.ethz.ch/pipermail/r-help/2008-October/177688.html
- R:rJava包安装失败
请注意,除非有和/或apt-get
的等效解决方案,否则最后一个链接中的解决方案对我没有用(我认为)。port
yum