Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R: rJava fails to install on Mac OSX 10.8.5 'lzma library missing' and 'libjri.jnilib make error'

Tags:

java

macos

r

rjava

When installing rJava using install.packages("rJava") I get several errors.

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

The first reports that I am missing the library associated with lzma. A bit of googling tells me this library, liblzma, is associated with XY file compression? XZ Compression Tukaani Is this correct, if so where can I obtain this library?

I do not know why the other errors occur when attempting to build? I am guessing they are associated with my Java environment?

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

I have updated my Java version and am now running the latest.

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)

I also see that libjdns_sd.jnilib is also found

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

I have also set my JAVA_HOME environment according to this post R: rJava package install failing

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

Would greatly appreciate any help.

like image 777
lmsimp Avatar asked Nov 22 '13 20:11

lmsimp


1 Answers

I ran into the same issue and I seem to have got through it by installing the mac binary version like so:

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

If you really need to use that lzma library you might have luck installing it via MacPorts:

sudo port install lzma

I'm on OS X 10.6.8 (Snow Leopard).

like image 137
Chris R Avatar answered Sep 24 '22 04:09

Chris R