2012-01-17 16 views
0

rJavaパッケージをR 2.14.1-9.1にインストールします。OpenSUSE 11.3です。私はthis質問を見ましたが、それはUbuntu用です。私はSun JDKをインストールし、それを使用するようにシステムを再構成しました。R 2.14とOpenSUSEでrJavaをインストールすると失敗する

[email protected]:~> java -version 
java version "1.6.0_29" 
Java(TM) SE Runtime Environment (build 1.6.0_29-b11) 
Java HotSpot(TM) Client VM (build 20.4-b02, mixed mode) 
[email protected]:~> 

EDIT 1: は、JDKおよびJREを更新しました。私はinstall.packages("rJava")を実行すると、わずかに異なるエラーがある、私は(新しいエラーが太字に掲載して終了される)エラーが発生して次の出力を得る:

> install.packages("rJava") 
Installing package(s) into ‘/home/admin/R/i686-pc-linux-gnu-library/2.14’ 
(as ‘lib’ is unspecified) 
--- Please select a CRAN mirror for use in this session --- 
Loading Tcl/Tk interface ... done 
trying URL 'http://ftp.iitm.ac.in/cran/src/contrib/rJava_0.9-3.tar.gz' 
Content type 'application/x-gzip' length 537153 bytes (524 Kb) 
opened URL 
================================================== 
downloaded 524 Kb 

* installing *source* package ‘rJava’ ... 
** package ‘rJava’ successfully unpacked and MD5 sums checked 
checking for gcc... gcc -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 gcc -std=gnu99 accepts -g... yes                                                        
checking for gcc -std=gnu99 option to accept ISO C89... none needed                                                    
checking how to run the C preprocessor... gcc -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 gcc -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/usr/lib/jvm/java-1.6.0-sun-1.6.0/jre/../include -I/usr/lib/jvm/java-1.6.0-sun-1.6.0/jre/../include/linux'                                      
java libs : '-L/usr/lib/jvm/java-1.6.0-sun-1.6.0/jre/lib/i386/client -L/usr/lib/jvm/java-1.6.0-sun-1.6.0/jre/lib/i386 -L/usr/lib/jvm/java-1.6.0-sun-1.6.0/jre/../lib/i386 -L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm' 
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 ‘/home/admin/R/i686-pc-linux-gnu-library/2.14/rJava’ 

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

新しいエラーライン:

はJNIをチェックデータ型... configure:error:1つ以上のJNI型が、対応するネイティブ型と異なります。これを修正するには、非標準のコンパイラフラグまたは別のコンパイラを使用する必要があります。

R CMD javareconfrootとして実行しました。それはcppフラグフィールドを空のままにします。私はこれが失敗している理由の一つだが、それを解決する方法は知らない。

dependencies = TRUEオプションを指定してこのインストールコマンドを試してみました。また、repoを明示的に指定することもできます(例:repo = "blah blah")。何も働かなかった。

私はOpenSUSEのアップデート方法を知りません。しかし、SUSEのための簡単な方法はないと思われます.Ubuntuとは異なり、ステップは明らかにhereです。

何か助けていただければ幸いです。

+4

です....エラーメッセージに表示されている指示に従って試してみましたか? –

+0

@JackManey: 'R CMD javareconf'を' root'として実行しました。 'cpp flags'フィールドは空のままにします。私はこれが失敗している理由の一つだが、それを解決する方法は知らない。 ( – Bhushan

+0

)JDK(JREだけでなく)はインストールされていますか? –

答えて

5

update-alternatives --config javacを実行していても、JAVA_HOMEは更新されませんでした。したがって私は手動で設定します:

export JAVA_HOME=/usr/lib/jvm/java-1.6.0-sun-1.6.0.u6 

rootとして上記のコマンドを実行する必要があります。

R CMD javareconfを実行してください。いくつかの進歩がありました。以前は失敗していた場所を越えてインストールされました。

zypper install R-patched R-patched-devel 

rootとして上記のコマンドを実行)した後:エラーでの提案どおりに

Warning: R include directory is empty -- perhaps need to install R-devel.rpm or similar 
gcc -std=gnu99 -I/usr/lib/R/include -I. -I/usr/lib/jvm/java-1.6.0-sun-1.6.0/include -I/usr/lib/jvm/java-1.6.0-sun-1.6.0/include/linux -I/usr/local/include -fpic -fomit-frame-pointer -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -c Rglue.c -o Rglue.o 
In file included from Rglue.c:2:0: 
rJava.h:23:15: fatal error: R.h: No such file or directory 
compilation terminated. 
make: *** [Rglue.o] Error 1 
ERROR: compilation failed for package ‘rJava’ 
* removing ‘/usr/lib/R/library/rJava’ 

The downloaded packages are in 
     ‘/tmp/Rtmp3zqlgI/downloaded_packages’ 
Updating HTML index of packages in '.Library' 
Making packages.html ... done 
Warning message: 
In install.packages("rJava") : 
    installation of package ‘rJava’ had non-zero exit status 
> 

は次に、このように、 R-devel-rpmをインストール:しかし、それはまだ私に次のエラーが発生しましたこれはRを実行し、 "install.package(" rJava ")"が機能しました。

本物の質問のために約5時間の賛成と4回の票決がありましたが、ついに救済! :)

+1

ありがとう、私は、openSUSE 13.1のJDK 8では動作しなかったと報告することもできます。 。 –

0

驚くばかりです。 Gentooの下で同じこと。 Do

env | grep JAVA 

あなたの環境を確認してください。

2
# R CMD javareconf 
Updating Java configuration in /usr/lib/R Done. 

> install.packages("rJava") 
* DONE (rJava) 
関連する問題