2011-08-20 37 views
16

Tôi sử dụng R 2.13 từ CRAN apt repo cho Ubuntu 10.04 và tôi đang cố gắng cài đặt Deducer, yêu cầu JGR/rJava, nhưng rJava từ chối xây dựng/cài đặt, phàn nàn về không thể xây dựng ứng dụng JNI. Tôi đã thử sudo R CMD javareconf như được đề xuất nhưng điều đó chỉ dẫn đến một lỗi khác về cấu hình không được đặt. Tôi tìm thấy R: rJava package install failing, vì vậy tôi đã thử các đề xuất có cài đặt r-cran-rjava (nhưng đó là 0.8 và Deducer/JGR dường như nhấn mạnh vào việc cài đặt 0.9) và không quan trọng với số $JAVA_HOME của tôi, tất cả đều không có. Bất kỳ ý tưởng?Không thể cài đặt rJava 0.9 trên Ubuntu 10.04

Dưới đây là một bảng điểm đầy đủ hơn về những gì đã xảy ra:

$ sudo aptitude install r-cran-rjava 
... 
$ R 

R version 2.13.1 (2011-07-08) 
Copyright (C) 2011 The R Foundation for Statistical Computing 
ISBN 3-900051-07-0 
Platform: x86_64-pc-linux-gnu (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(c('JGR','Deducer')) 
Installing package(s) into ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13’ 
(as ‘lib’ is unspecified) 
also installing the dependencies ‘rJava’, ‘JavaGD’, ‘iplots’ 

trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rJava_0.9-1.tar.gz' 
Content type 'application/x-gzip' length 527197 bytes (514 Kb) 
opened URL 
================================================== 
downloaded 514 Kb 

trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/JavaGD_0.5-4.tar.gz' 
Content type 'application/x-gzip' length 102242 bytes (99 Kb) 
opened URL 
================================================== 
downloaded 99 Kb 

trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/iplots_1.1-4.tar.gz' 
Content type 'application/x-gzip' length 330323 bytes (322 Kb) 
opened URL 
================================================== 
downloaded 322 Kb 

trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/JGR_1.7-7.tar.gz' 
Content type 'application/x-gzip' length 536564 bytes (523 Kb) 
opened URL 
================================================== 
downloaded 523 Kb 

trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/Deducer_0.4-4.tar.gz' 
Content type 'application/x-gzip' length 5325794 bytes (5.1 Mb) 
opened URL 
================================================== 
downloaded 5.1 Mb 

* installing *source* package ‘rJava’ ... 
checking for gcc... gcc 
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 
c hecking whether we are using the GNU C compiler... yes 
checking whether gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /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 gcc 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/usr/lib/jvm/java-6-openjdk/jre/../include' 
java libs : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm' 
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 ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13/rJava’ 
* installing *source* package ‘JavaGD’ ... 
checking for gcc... gcc 
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 gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /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 
checking for stdlib.h... (cached) yes 
checking for GNU libc compatible malloc... yes 
checking return type of signal handlers... void 
checking for memset... yes 
checking for mkdir... yes 
checking for rmdir... yes 
checking for select... yes 
checking for socket... yes 
checking Java support in R... present: 
interpreter : '/usr/bin/java' 
cpp flags : '-I/usr/lib/jvm/java-6-openjdk/jre/../include' 
java libs : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm' 
checking whether JNI programs can be compiled... configure: error: Cannot compile a simple JNI program. See config.log for details. 
ERROR: configuration failed for package ‘JavaGD’ 
* removing ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13/JavaGD’ 
ERROR: dependency ‘rJava’ is not available for package ‘iplots’ 
* removing ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13/iplots’ 
ERROR: dependencies ‘rJava’, ‘JavaGD’, ‘iplots’ are not available for package ‘JGR’ 
* removing ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13/JGR’ 
ERROR: dependencies ‘rJava’, ‘JGR’ are not available for package ‘Deducer’ 
* removing ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13/Deducer’ 

The downloaded packages are in 
     ‘/tmp/RtmpCSITmm/downloaded_packages’ 
Warning messages: 
1: In install.packages(c("JGR", "Deducer")) : 
    installation of package 'rJava' had non-zero exit status 
2: In install.packages(c("JGR", "Deducer")) : 
    installation of package 'JavaGD' had non-zero exit status 
3: In install.packages(c("JGR", "Deducer")) : 
    installation of package 'iplots' had non-zero exit status 
4: In install.packages(c("JGR", "Deducer")) : 
    installation of package 'JGR' had non-zero exit status 
5: In install.packages(c("JGR", "Deducer")) : 
    installation of package 'Deducer' had non-zero exit status 
> 


R version 2.13.1 (2011-07-08) 
Copyright (C) 2011 The R Foundation for Statistical Computing 
ISBN 3-900051-07-0 
Platform: x86_64-pc-linux-gnu (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') 
Installing package(s) into ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13’ 
(as ‘lib’ is unspecified) 
trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rJava_0.9-1.tar.gz' 
Content type 'application/x-gzip' length 527197 bytes (514 Kb) 
opened URL 
================================================== 
downloaded 514 Kb 

* installing *source* package ‘rJava’ ... 
checking for gcc... gcc 
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 gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /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 gcc 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/usr/lib/jvm/java-6-openjdk/jre/../include' 
java libs : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm' 
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 ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13/rJava’ 

The downloaded packages are in 
     ‘/tmp/RtmpTk0ftk/downloaded_packages’ 
Warning message: 
In install.packages("rJava") : 
    installation of package 'rJava' had non-zero exit status 
> 
$ sudo R CMD javareconf 
Java interpreter : /usr/bin/java 
Java version  : 1.6.0_20 
Java home path : /usr/lib/jvm/java-6-openjdk/jre 
Java compiler : /usr/bin/javac 
Java headers gen.: /usr/bin/javah 
Java archive tool: /usr/bin/jar 
Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib 
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm 
JNI cpp flags : 

Updating Java configuration in /etc/R 
Done. 

$ R 

R version 2.13.1 (2011-07-08) 
Copyright (C) 2011 The R Foundation for Statistical Computing 
ISBN 3-900051-07-0 
Platform: x86_64-pc-linux-gnu (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') 
Installing package(s) into ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13’ 
(as ‘lib’ is unspecified) 
trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rJava_0.9-1.tar.gz' 
Content type 'application/x-gzip' length 527197 bytes (514 Kb) 
opened URL 
================================================== 
downloaded 514 Kb 

* installing *source* package ‘rJava’ ... 
checking for gcc... gcc 
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 gcc accepts -g... yes 
checking for gcc option to accept ISO C89... none needed 
checking how to run the C preprocessor... gcc -E 
checking for grep that handles long lines and -e... /bin/grep 
checking for egrep... /bin/grep -E 
checking for ANSI C header files... yes 
c hecking 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 gcc 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 : '' 
java libs : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm' 
configure: error: One or more Java configuration variables are not set. 
Make sure R is configured with full Java support (including JDK). Run 
R CMD javareconf 
as root to add Java support to R. 

If you don't have root privileges, run 
R CMD javareconf -e 
to set all Java-related variables and then install rJava. 

ERROR: configuration failed for package ‘rJava’ 
* removing ‘/home/yang/R/x86_64-pc-linux-gnu-library/2.13/rJava’ 

The downloaded packages are in 
     ‘/tmp/RtmpsJBxfe/downloaded_packages’ 
Warning message: 
In install.packages("rJava") : 
    installation of package 'rJava' had non-zero exit status 
> 
+2

Nó cũng cho bạn lời khuyên tương tự nhiều lần. Có lý do chính đáng nào để không chú ý đến nó không? Đây là một lần nữa nếu bạn bỏ lỡ nó: "Nếu nghi ngờ, chạy lại" R CMD javareconf "là root." –

+1

Huh? Tôi đã tuyên bố rõ ràng rằng tôi đã làm điều đó trong câu hỏi ban đầu của mình, và nó cũng có trong bảng điểm .... – Yang

+0

Xin lỗi. Những gì tôi _saw_ là bạn tham chiếu một câu hỏi và sau đó tiến hành cài đặt trước khi thực hiện các bản sửa lỗi được đề xuất. –

Trả lời

17

Dah, không lâu sau khi công bố Tôi tìm thấy câu trả lời ở đây:

http://r-interface.blogspot.com/2012/04/install-r-jgr-and-deducer-in-ubuntu.html

Mặc dù tôi đã đã được cài đặt Sun Java, chính là chạy update-java-alternatives để thực sự chuyển sang Sun Java trước khi chạy javareconf:

sudo update-java-alternatives -s java-6-sun 
sudo R CMD javareconf 
+0

Tất cả mọi thứ sẽ hoạt động như được vận chuyển trong Debian/Ubuntu với tùy chọn Java được định cấu hình lúc xây dựng cho các gói R và rJava, sử dụng SDK Java trong Ubuntu. Nếu bạn quyết định chuyển sang một chương trình phụ trợ Java khác, bạn phải thực sự cấu hình lại. –

0

Đây là một lựa chọn:

trước khi chạy R, làm được điều này

export LD_LIBRARY_PATH=/usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/server 

(cho đường dẫn ở trên, vị trí thay thế của libjvm.so cụ thể của bạn, nếu bạn có một cấu hình khác nhau). Để tìm libjvm.so, bạn có thể làm

sudo updatedb && locate libjvm.so 
1

Một khác (tương đối rõ ràng) cảnh báo: không làm những gì tôi đã làm và cài đặt cả hai java6 và java7. Điều đó dẫn đến xung đột tôi không thể 'sửa' thông qua chỉ định đường dẫn và biến môi trường. Loại bỏ cả hai và cài đặt lại java6 dẫn đến cài đặt thành công của JGR. (Đây dưới ubuntu chính xác, trên Apple PowerBook G4)

0

DWright là thay thế right..an thay vì xuất khẩu nó mỗi thời gian hơn bạn bắt đầu R là xác định vị trí con đường java của bạn

sudo locate libjvm.so 

và thêm ir để ldpaths

sudo gedit /etc/R/ldpaths 

i.e 
${JAVA_HOME=/usr/java/jdk1.7.0_07/jre} 
Các vấn đề liên quan