无法在R中编译RcppArmadillo

无法在R中编译RcppArmadillo,r,rcpp,R,Rcpp,我在编译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.

我在编译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
"

我在Ubuntu 12.04上使用的是R版本2.15.2。 首先,我认为缺少一些依赖项,但我已经通过synaptic软件包管理器安装了Armadillo(libarmadillo 2 v2.4.2),也安装了g++(v4.6.3)。我不熟悉C++,所以我不知道是否需要一些额外的软件包。然而,安装Rcpp工作得非常好


如果有人能帮助我,我会非常高兴。

你发出的命令到底是为了得到什么

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安装…
? 我碰巧在Ubuntu12上开发了这些软件包。*所以我很确定这是可行的

此外,我不确定您尝试阅读了多少文档,但我们不建议安装
libarmadillo
,以便使用。
该软件包提供了自己的一套犰狳资源,供其使用,以及其他R软件包使用


这很有效(TM),因为仅在CRAN上就有20多个软件包在使用。

install。软件包和
R CMD install
将(重新)启动R并读取您的
.Rprofile
。因此,您应该考虑包装在<代码> > rPrime>代码>文件中的包<代码> > {} /代码>,您只希望在交互会话中运行(例如<代码>库< /代码>或<代码>要求< /COD>调用)。
否则,在使用
install.packages()
之前,您需要使用
--vanilla
标志启动R,或者使用bash中的
R--vanilla CMD install

看起来像是一条SSH登录消息正在传递给gcc。我使用了:install.packages(“RcppArmadillo”)我刚刚使用了R CMD install'RcppArmadillo_0.3.4.4.tar.gz',我收到了相同的错误消息。在整个安装过程中,我对以前报告的代码进行了一点扩展。您使用的是
.Rprofile
?尝试用
R--vanilla
启动R,然后安装。@Gsee非常感谢您的提示。香草奏效了。谢谢:-)