RESOLVED!!
See my solution below, in case this question helps others in the future.
请参阅下面的解决方案,以防这个问题在将来帮助其他人。
Error
As the title described, it it failing for me. The error I'm receiving, when I attempt to install.packages('rJava')
from inside R is (with some preceding good checks):
正如标题所描述的那样,它失败了。我收到的错误,当我尝试从R内部安装.packages('rJava')时(有一些先前的好检查):
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’
Fix Attempts
I have checked and tried the following resolutions, none of which worked for me:
我检查并尝试了以下决议,其中没有一个对我有用:
-
sudo R CMD javareconf
-
more detailed sudo R CMD javareconf
更详细的sudo R CMD javareconf
-
export JAVA_HOME
, however in this case, I did not do the LD_LIBRARY_PATH, as it did not seem relevant to a Mac.导出JAVA_HOME,但是在这种情况下,我没有执行LD_LIBRARY_PATH,因为它似乎与Mac无关。
No such luck, with any of these attempts.
没有这样的运气,任何这些尝试。
I had previously had rJava
(and RJDBC
) installed properly.
我以前安装了rJava(和RJDBC)。
[Edit: I later found out, the actual problem was upgrading to OS X 10.11, El Capitan.]
[编辑:我后来发现,实际问题是升级到OS X 10.11,El Capitan。]
Configuration
$ java -version
java version "1.8.0_45"
> R.Version()
$platform
[1] "x86_64-apple-darwin15.0.0"
$version.string
[1] "R version 3.2.2 (2015-08-14)"
Mac OS itself:
Mac OS本身:
System Version: OS X 10.11.1 (15B42)
2 个解决方案
#1
5
I did not do the LD_LIBRARY_PATH, as it did not seem relevant to a Mac
我没有做LD_LIBRARY_PATH,因为它似乎与Mac无关
Yes, but a Mac has DYLD_LIBRARY_PATH
. If you link with -ljvm
you have to have the directory containing libjvm.dylib
in DYLD_LIBRARY_PATH
.
是的,但Mac有DYLD_LIBRARY_PATH。如果链接-ljvm,则必须在DYLD_LIBRARY_PATH中包含libjvm.dylib的目录。
That said, I found it more convenient to link JNI programs with -ljli
(in lib/jli
), because the programs linked with -ljvm
will open a prompt to install Apple's own Java runtime when the system doesn't have it (at least they did on my and our customers' systems some while ago).
也就是说,我发现使用-ljli(在lib / jli中)链接JNI程序更方便,因为与-ljvm链接的程序会在系统没有它时打开安装Apple自己的Java运行库的提示(至少他们之前在我和我们客户的系统上做过。
Edit: here's a link to the dyld documentation
编辑:这是dyld文档的链接
#2
5
I finally resolved this, via a solution I found here.
我终于通过我在这里找到的解决方案解决了这个问题。
The new Mac OS X (10.11, El Capitan) has trouble with env variables.
新的Mac OS X(10.11,El Capitan)在env变量方面存在问题。
The newest dev flavor of rJava
manages to handle things correctly. Here is what I did to resolve it:
rJava的最新开发风格设法正确处理事情。以下是我解决它的方法:
- Download version 0.9-8 (
rJava_0.9-8.tar.gz
) from here -
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
从这里下载0.9-8版本(rJava_0.9-8.tar.gz)
(Or wherever you put it)
(或者无论你把它放在哪里)
That's all it took!
这就是全部!
#1
5
I did not do the LD_LIBRARY_PATH, as it did not seem relevant to a Mac
我没有做LD_LIBRARY_PATH,因为它似乎与Mac无关
Yes, but a Mac has DYLD_LIBRARY_PATH
. If you link with -ljvm
you have to have the directory containing libjvm.dylib
in DYLD_LIBRARY_PATH
.
是的,但Mac有DYLD_LIBRARY_PATH。如果链接-ljvm,则必须在DYLD_LIBRARY_PATH中包含libjvm.dylib的目录。
That said, I found it more convenient to link JNI programs with -ljli
(in lib/jli
), because the programs linked with -ljvm
will open a prompt to install Apple's own Java runtime when the system doesn't have it (at least they did on my and our customers' systems some while ago).
也就是说,我发现使用-ljli(在lib / jli中)链接JNI程序更方便,因为与-ljvm链接的程序会在系统没有它时打开安装Apple自己的Java运行库的提示(至少他们之前在我和我们客户的系统上做过。
Edit: here's a link to the dyld documentation
编辑:这是dyld文档的链接
#2
5
I finally resolved this, via a solution I found here.
我终于通过我在这里找到的解决方案解决了这个问题。
The new Mac OS X (10.11, El Capitan) has trouble with env variables.
新的Mac OS X(10.11,El Capitan)在env变量方面存在问题。
The newest dev flavor of rJava
manages to handle things correctly. Here is what I did to resolve it:
rJava的最新开发风格设法正确处理事情。以下是我解决它的方法:
- Download version 0.9-8 (
rJava_0.9-8.tar.gz
) from here -
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
从这里下载0.9-8版本(rJava_0.9-8.tar.gz)
(Or wherever you put it)
(或者无论你把它放在哪里)
That's all it took!
这就是全部!