6

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

'</p>

我在 Ubuntu 12.04 上使用 R 版本 2.15.2。首先我认为缺少一些依赖项,但我已经通过突触包管理器安装了 Armadillo (libarmadillo2 v2.4.2),还安装了 g++ (v4.6.3)。我不熟悉 c++,所以我不知道是否需要一些额外的包。但是,安装 Rcpp 可以正常工作。

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

4

2 回答 2

8

install.packages并将R CMD INSTALL(重新)启动 R 并阅读您的.Rprofile. if (interactive()) { }因此,您应该考虑在文件中包装.Rprofile您只想在交互式会话(例如libraryrequire调用)中运行的代码。

否则,您需要--vanilla在使用之前使用标志启动 R install.packages(),或者使用R --vanilla CMD INSTALLfrom bash。

于 2012-12-02T20:29:55.657 回答
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的软件包。

于 2012-12-02T20:01:16.740 回答