为什么无法安装RJava

时间:2014-04-25 20:34:45

标签: r rstudio rjava

我正在尝试安装RJava,但我无法安装。以下是我认为可用于排除错误的文件和输出。我检查了类似的问题,但我的错误与发布的其他问题不同

这是错误的输出,一些冗余行已被删除

install.packages("rJava")
installing *source* package ‘rJava’ ...
package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
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
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-   amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c Rglue.c -o Rglue.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c arrayc.c -o arrayc.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c callJNI.c -o callJNI.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c callback.c -o callback.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c fields.c -o fields.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c jri_glue.c -o jri_glue.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c loader.c -o loader.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c otables.c -o otables.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c rJava.c -o rJava.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c tools.c -o tools.o
gcc -std=gnu99 -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -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 -L/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR
(cd ../jri && make)
make[1]: Entering directory `/tmp/RtmpyveV0g/R.INSTALL38bc46246ade/rJava/jri`
make -C src JRI.jar
make[2]: Entering directory `/tmp/RtmpyveV0g/R.INSTALL38bc46246ade/rJava/jri/src`
/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
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
 4 warnings
/usr/bin/javah -d . -classpath . org.rosuda.JRI.Rengine
gcc -std=gnu99 -c -o Rengine.o Rengine.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include  -fpic -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o jri.o jri.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include  -fpic -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o Rcallbacks.o Rcallbacks.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include  -fpic -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o Rinit.o Rinit.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include  -fpic -I/usr/share/R/include -I/usr/share/R/include
gcc -std=gnu99 -c -o globals.o globals.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include  -fpic -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include
gcc -std=gnu99 -c -o rjava.o rjava.c -g -Iinclude  -DRIF_HAS_CSTACK -DRIF_HAS_RSIGHAND -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include  -fpic -I/usr/lib/jvm/java-6-openjdk-amd64/jre/../include
rjava.c: In function ‘RJava_init_ctrl’:
rjava.c:51:8: warning: ignoring return value of ‘write’, declared with attribute   warn_unused_result [-Wunused-result]
rjava.c:52:7: warning: ignoring return value of ‘read’, declared with attribute   warn_unused_result [-Wunused-result]
rjava.c: In function ‘RJava_request_callback’:
rjava.c:39:8: warning: ignoring return value of ‘write’, declared with attribute  warn_unused_result [-Wunused-result]
rjava.c: In function ‘RJava_clear_lock’:
rjava.c:30:8: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
rjava.c: In function ‘RJava_request_lock’:
rjava.c:22:8: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
gcc -std=gnu99 -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o  -shared -L/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/server -ljvm -Wl,--export-dynamic -fopenmp  -L/usr/lib/R/lib -lR -lpcre -llzma -lbz2 -lrt -ldl -lm
/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
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
/usr/bin/jar fc JRI.jar org libjri.so
make[2]: Leaving directory `/tmp/RtmpyveV0g/R.INSTALL38bc46246ade/rJava/jri/src`
rm -f libjri.so
cp src/libjri.so libjri.so
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples    examples/rtest.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: examples/rtest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples     examples/rtest2.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
Note: examples/rtest2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
4 warnings
make[1]: Leaving directory `/tmp/RtmpyveV0g/R.INSTALL38bc46246ade/rJava/jri`
installing via 'install.libs.R' to /home/waheeb/R/x86_64-pc-linux-gnu-library/3.1/rJava
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/waheeb/R/x86_64-pc-linux-gnu-library /3.1/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/waheeb/R/x86_64-pc-linux-gnu-library/3.1/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status

这是我系统中的Java备选方案:

*0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java    1061      auto mode.   
1            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java    1061      manual mode.   
2            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java    1051      manual mode.   
3            /usr/local/java/jdk1.8.0/bin/java                 1         manual mode.   

这里是/etc/R/ldpaths文件:只显示两行。

  ${JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre}.  
 :${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server}

这是libjvm.so文件的位置:

/usr/local/java/jdk1.8.0/jre/lib/amd64/server/libjvm.so

感谢任何帮助

2 个答案:

答案 0 :(得分:5)

你试过吗

sudo apt-get install r-cran-rjava 

了吗?

我们维护一个包,这样您就不必手动对抗配置。

答案 1 :(得分:0)

无论出于何种原因,有些人必须从源代码安装。

在从源码构建的情况下,R CMD构建   ......似乎在寻找Lempel-Ziv图书馆liblzma

liblzma。*。dylib     不会出现本地分布,至少不会出现在我的OSX / 10.8.4;

I just happened to have an liblzma.5.dylib sitting around
from I don't know where, which after 

导出LDFLAGS =' -L / path / to ../../' #liblzma。*。dylib

./configure

R CMD构建(受影响的CRAN pkg,例如JGR rJava ......)完成。

来自 是什么是liblzma.dylib依赖所谓的 来自?? ??

出现了多种可能的来源:XZ(http://macpkg.sourceforge.net/)等。