【问题标题】:R: rJava fails to install on Mac OSX 10.8.5 'lzma library missing' and 'libjri.jnilib make error'R:rJava 无法在 Mac OSX 10.8.5 上安装“lzma library missing”和“libjri.jnilib make error”
【发布时间】:2013-11-22 20:11:41
【问题描述】:

当使用install.packages("rJava") 安装 rJava 时,我遇到了几个错误。

lm-mb:~ lisa$ R

R Under development (unstable) (2013-11-21 r64282) -- "Unsuffered Consequences"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> install.packages("rJava")
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://www.stats.bris.ac.uk/R/src/contrib/rJava_0.9-4.tar.gz'
Content type 'application/x-gzip' length 498108 bytes (486 Kb)
opened URL
==================================================
downloaded 486 Kb

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... llvm-gcc-4.2 -arch x86_64 -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether llvm-gcc-4.2 -arch x86_64 -std=gnu99 accepts -g... yes
checking for llvm-gcc-4.2 -arch x86_64 -std=gnu99 option to accept ISO C89... none     needed
checking how to run the C preprocessor... llvm-gcc-4.2 -arch x86_64 -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether llvm-gcc-4.2 -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/Frameworks/JavaVM.framework/Headers'
java libs   : '-framework JavaVM'
checking whether JNI programs can be compiled... yes
checking JNI data types... ok
checking whether JRI should be compiled (autodetect)... yes
checking whether debugging output should be enabled... no
checking whether memory profiling is desired... no
checking whether threads support is requested... no
checking whether callbacks support is requested... no
checking whether JNI cache support is requested... no
checking whether JRI is requested... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/zzz.R
config.status: creating src/config.h
=== configuring in jri     (/private/var/folders/dn/lvhnwvq15n37bdh0dqm033zh0000gp/T/RtmpuD563L/R.INSTALL158732c239a6c/rJava/jri)
configure: running /bin/sh ./configure '--prefix=/usr/local'  --cache-file=/dev/null --    srcdir=.
checking build system type... i386-apple-darwin12.5.0
checking host system type... i386-apple-darwin12.5.0
checking for gcc... llvm-gcc-4.2 -arch x86_64 -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether llvm-gcc-4.2 -arch x86_64 -std=gnu99 accepts -g... yes
checking for llvm-gcc-4.2 -arch x86_64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... llvm-gcc-4.2 -arch x86_64 -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... rm: conftest.dSYM: is a directory
rm: conftest.dSYM: is a directory
yes
checking whether Java interpreter works... checking whether JNI programs can be     compiled... yes
checking whether JNI programs can be run... yes
checking JNI data types... ok
checking whether Rinterface.h exports R_CStackXXX variables... yes
checking whether Rinterface.h exports R_SignalHandlers... yes
configure: creating ./config.status
config.status: creating src/Makefile
config.status: creating Makefile
config.status: creating run
config.status: creating src/config.h
** libs
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c Rglue.c -o Rglue.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c arrayc.c -o arrayc.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c callJNI.c -o callJNI.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c callback.c -o callback.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c fields.c -o fields.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c init.c -o init.o
init.c: In function ‘initJVM’:
init.c:100: warning: ‘JNI_GetDefaultJavaVMInitArgs’ is deprecated (declared at     /System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1934)
init.c:139: warning: ‘JNI_CreateJavaVM’ is deprecated (declared at /System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1937)
init.c: In function ‘RinitJVM’:
init.c:278: warning: ‘JNI_GetCreatedJavaVMs’ is deprecated (declared at /System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1940)
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c jri_glue.c -o jri_glue.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c loader.c -o loader.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c otables.c -o otables.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c rJava.c -o rJava.o
rJava.c: In function ‘getJNIEnv’:
rJava.c:200: warning: ‘JNI_GetCreatedJavaVMs’ is deprecated (declared at /System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1940)
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I. -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include    -fPIC  -mtune=core2 -g -O2  -c tools.c -o tools.o
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o rJava.so Rglue.o arrayc.o callJNI.o callback.o fields.o init.o jri_glue.o loader.o otables.o rJava.o tools.o -framework JavaVM -F/Library/Frameworks/R.framework/.. -    framework R -Wl,-framework -Wl,CoreFoundation
(cd ../jri && make)
make -C src JRI.jar
/usr/bin/javac -target 1.4 -source 1.4 -d . ../Mutex.java ../RBool.java             ../RConsoleOutputStream.java ../REXP.java ../RFactor.java ../RList.java     ../RMainLoopCallbacks.java ../RVector.java ../Rengine.java ../package-info.java
/usr/bin/javah -d . -classpath . org.rosuda.JRI.Rengine
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude  -    DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -mtune=core2 -g -O2  -    I/System/Library/Frameworks/JavaVM.framework/Headers  -fno-common -I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o jri.o jri.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -mtune=core2 -g -O2  -I/System/Library/Frameworks/JavaVM.framework/Headers  -fno-common -I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o Rcallbacks.o Rcallbacks.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -mtune=core2 -g -O2  -I/System/Library/Frameworks/JavaVM.framework/Headers  -fno-common -I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include
Rcallbacks.c: In function ‘checkEnvironment’:
Rcallbacks.c:46: warning: ‘JNI_GetCreatedJavaVMs’ is deprecated (declared at /System/Library/Frameworks/JavaVM.framework/Headers/jni.h:1940)
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o Rinit.o Rinit.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -mtune=core2 -g -O2  -I/System/Library/Frameworks/JavaVM.framework/Headers  -fno-common -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Resources/include
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o globals.o globals.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -mtune=core2 -g -O2  -I/System/Library/Frameworks/JavaVM.framework/Headers  -fno-common -I/System/Library/Frameworks/JavaVM.framework/Headers
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -mtune=core2 -g -O2  -I/System/Library/Frameworks/JavaVM.framework/Headers  -fno-common -I/System/Library/Frameworks/JavaVM.framework/Headers
llvm-gcc-4.2 -arch x86_64 -std=gnu99 -o libjri.jnilib Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o  -dynamiclib -framework JavaVM -F/Library/Frameworks/R.framework/.. -framework R -llzma -licucore -lm -liconv
ld: library not found for -llzma
collect2: ld returned 1 exit status
make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rJava’

The downloaded source packages are in
    ‘/private/var/folders/dn/lvhnwvq15n37bdh0dqm033zh0000gp/T/Rtmp5B1vEJ/downloaded_packages’
Warning message:
In install.packages("rJava") :
  installation of package ‘rJava’ had non-zero exit status

第一个报告我缺少与lzma 关联的库。谷歌搜索告诉我这个库,liblzma,与 XY 文件压缩相关联? XZ Compression Tukaani这对吗,如果是,我在哪里可以获得这个库?

我不知道为什么尝试构建时会出现其他错误?我猜它们与我的 Java 环境相关联?

make[2]: *** [libjri.jnilib] Error 1
make[1]: *** [src/JRI.jar] Error 2
make: *** [jri] Error 2

我已经更新了我的 Java 版本,现在正在运行最新版本。

lm-mb:~ lisa$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

我也看到libjdns_sd.jnilib也找到了

lm-mb:jre lisa$ ls /usr/lib/java/
libjdns_sd.jnilib

我也根据这篇帖子R: rJava package install failing设置了我的JAVA_HOME环境

export JAVA_HOME=$/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
export JAVA_HOME

export PATH=$PATH:$JAVA_HOME/bin
export PATH

非常感谢任何帮助。

【问题讨论】:

  • 一种方法:安装 homebrew,然后 brew install xz。你试过 R CMD javareconf 吗??

标签: java r macos rjava


【解决方案1】:

我遇到了同样的问题,我似乎已经通过安装 mac 二进制版本解决了这个问题:

install.packages("rJava", type="mac.binary")

如果你真的需要使用那个 lzma 库,你可以通过 MacPorts 安装它:

sudo port install lzma

我使用的是 OS X 10.6.8 (Snow Leopard)。

【讨论】:

  • 我将在 2015 年 10 月在这里添加评论,因为这对我也有效。我无法安装一系列依赖于 rJava 的软件包,但通过使用sudo 在命令行中工作,我能够安装所有内容。
【解决方案2】:

Linux 用户(14.04 测试):

我有类似的问题,但在我的环境中,我使用的是 java 1.6。我通过安装缺少的 lzma 库解决了它

sudo apt-get install liblzma-dev

希望它可以帮助某人:) 干杯

【讨论】:

  • 这是关于 MacOS 的,我怀疑他们那里有 apt-get
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-04-09
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-27
  • 2015-08-27
相关资源
最近更新 更多