2012-12-02 96 views
4

我編譯RcppArmadillo時遇到問題。這是結果,當我嘗試安裝軟件包:無法在R編譯RcppArmadillo

> install.packages("RcppArmadillo") 
Installing package(s) into ‘/home/*****/R/i686-pc-linux-gnu-library/2.15’ 
(as ‘lib’ is unspecified) 
trying URL 'http://cran.rstudio.com/src/contrib/RcppArmadillo_0.3.4.4.tar.gz' 
Content type 'application/x-gzip' length 742125 bytes (724 Kb) 
opened URL 
================================================== 
downloaded 724 Kb 

Loading required package: survival 
Loading required package: stats 
Loading required package: utils 
Loading required package: graphics 
Loading required package: splines 
Hmisc library by Frank E Harrell Jr 

Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') 
to see overall documentation. 

NOTE:Hmisc no longer redefines [.factor to drop unused levels when 
subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 


Attaching package: ‘Hmisc’ 

The following object(s) are masked from ‘package:survival’: 

    untangle.specials 

The following object(s) are masked from ‘package:base’: 

    format.pval, round.POSIXt, trunc.POSIXt, units 


    Welcome at Sun Dec 2 18:54:49 2012 
    * installing *source* package ‘RcppArmadillo’ ... 
    ** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked 
    ** libs 
    g++ -I/usr/share/R/include -DNDEBUG -I"/home/******/R/i686-pc-linux-gnu-library/2.15/Rcpp/include" -I../inst/include -fpic -O3 -pipe -g -c RcppArmadillo.cpp -o RcppArmadillo.o 
    g++ -I/usr/share/R/include -DNDEBUG -I"/home/******/R/i686-pc-linux-gnu-library/2.15/Rcpp/include" -I../inst/include -fpic -O3 -pipe -g -c fastLm.cpp -o fastLm.o 
    Loading required package: survival 
    Loading required package: stats 
    Loading required package: utils 
    Loading required package: graphics 
    Loading required package: splines 
    Hmisc library by Frank E Harrell Jr 

    Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') 
    to see overall documentation. 

    NOTE:Hmisc no longer redefines [.factor to drop unused levels when 
    subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 


    Attaching package: ‘Hmisc’ 

    The following object(s) are masked from ‘package:survival’: 

     untangle.specials 

    The following object(s) are masked from ‘package:base’: 

     format.pval, round.POSIXt, trunc.POSIXt, units 

    g++ -shared -o RcppArmadillo.so RcppArmadillo.o fastLm.o Welcome at Sun Dec 2 18:55:06 2012 
-L/home/******/R/i686-pc-linux-gnu-library/2.15/Rcpp/lib -lRcpp -Wl,-rpath,/home/******/R/i686-pc-linux-gnu-library/2.15/Rcpp/lib -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR 
    Loading required package: survival 
    Loading required package: stats 
    Loading required package: utils 
    Loading required package: graphics 
    Loading required package: splines 
    Hmisc library by Frank E Harrell Jr 

    Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') 
    to see overall documentation. 

    NOTE:Hmisc no longer redefines [.factor to drop unused levels when 
    subsetting. To get the old behavior of Hmisc type dropUnusedLevels(). 


    Attaching package: ‘Hmisc’ 

    The following object(s) are masked from ‘package:survival’: 

     untangle.specials 

    The following object(s) are masked from ‘package:base’: 

     format.pval, round.POSIXt, trunc.POSIXt, units 
     g++: error: Welcome: No such file or directory 
     g++: error: at: No such file or directory 
     g++: error: Sun: No such file or directory 
     g++: error: Dec: No such file or directory 
     g++: error: 2: No such file or directory 
     g++: error: 18:55:08: No such file or directory 
     g++: error: 2012: No such file or directory 
     make: *** [RcppArmadillo.so] Error 1 
     ERROR: compilation failed for package ‘RcppArmadillo’ 
     * removing ‘/home/****/R/i686-pc-linux-gnu-library/2.15/RcppArmadillo’ 
     Warning in install.packages : 
      installation of package ‘RcppArmadillo’ had non-zero exit status 

     The downloaded source packages are in 
      ‘/tmp/RtmpDAngtR/downloaded_packages 

我,使用R版本2.15.2在Ubuntu 12.04。 首先,我認爲缺少一些依賴關係,但我通過突觸包管理器安裝了Armadillo(libarmadillo2 v2.4.2),同時安裝了g ++(v4.6.3)。我不熟悉C++,所以我不知道我是否需要一些額外的軟件包。但是,安裝Rcpp完美無缺。

如果有人能幫助我,我會很高興。

+0

你使用'.Rprofile'嗎?嘗試用'R --vanilla'開始R,然後安裝。 – GSee

+0

@Gsee非常感謝tipp。 R - 香草工作。感謝:-) – DUWUDA

回答

7

install.packages and R CMD INSTALL will(re)start R and read your .Rprofile。因此,您應考慮在您的.Rprofile文件中圍繞代碼使用if (interactive()) { },您只想在交互式會話中運行(例如libraryrequire調用)。

否則,您需要在使用install.packages()之前使用--vanilla標誌啓動R,或者使用bash中的R --vanilla CMD INSTALL

1

究竟什麼是你發出的命令來獲得

g++: error: Welcome: No such file or directory 
g++: error: at: No such file or directory 
g++: error: Sun: No such file or directory 
g++: error: Dec: No such file or directory 
g++: error: 2: No such file or directory 
g++: error: 18:55:08: No such file or directory 
g++: error: 2012: No such file or directory 

回來?

你知道如何構建一個R包嗎?你有沒有做過R CMD INSTALL ....? 我碰巧在Ubuntu 12上開發了這些軟件包。*所以我非常確定這是可行的。

此外,我不確定你試過多少文件,但我們建議安裝libarmadillo以便使用RcppArmadillo
該軟件包提供自己的一套Armadillo資源,以供其使用以及使用RcppArmadillo的其他R軟件包使用。

而且Just Works(TM)由於在CRAN上有超過20個包裝使用RcppArmadillo

+0

它看起來像一個SSH登錄消息傳遞給gcc。 –

+0

我用過:install.packages(「RcppArmadillo」) – DUWUDA

+0

我剛剛使用了R CMD INSTALL'RcppArmadillo_0.3.4.4.tar.gz'但是,我得到了同樣的錯誤信息。在整個安裝過程中,我擴展了以前報告的代碼 – DUWUDA