首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法编译RcppArmadillo

无法编译RcppArmadillo
EN

Stack Overflow用户
提问于 2020-11-02 20:21:54
回答 1查看 1.1K关注 0票数 2

RcppArmadillo是我试图安装的几个软件包的依赖项。在编译RcppArmadillo版本0.10.1.0.0时,我得到了这个错误(当R发现RcppArmadillo是dep时,它会自动从CRAN中提取):

代码语言:javascript
复制
RcppArmadillo.cpp:26:40: error: redeclaration 'arma::arma_version::major' differs in 'constexpr'
 const unsigned int arma::arma_version::major;
                                        ^
In file included from ../inst/include/armadillo:91:0,
                 from ../inst/include/RcppArmadilloForward.h:49,
                 from ../inst/include/RcppArmadillo.h:31,
                 from RcppArmadillo.cpp:22:
../inst/include/armadillo_bits/arma_version.hpp:31:33: error: from previous declaration 'arma::arma_version::major'
   static constexpr unsigned int major = ARMA_VERSION_MAJOR;
                                 ^
RcppArmadillo.cpp:26:40: error: declaration of 'constexpr const unsigned int arma::arma_version::major' outside of class is not definition [-fpermissive]
 const unsigned int arma::arma_version::major;
                                        ^
RcppArmadillo.cpp:27:40: error: redeclaration 'arma::arma_version::minor' differs in 'constexpr'
 const unsigned int arma::arma_version::minor;
                                        ^
In file included from ../inst/include/armadillo:91:0,
                 from ../inst/include/RcppArmadilloForward.h:49,
                 from ../inst/include/RcppArmadillo.h:31,
                 from RcppArmadillo.cpp:22:
../inst/include/armadillo_bits/arma_version.hpp:32:33: error: from previous declaration 'arma::arma_version::minor'
   static constexpr unsigned int minor = ARMA_VERSION_MINOR;
                                 ^
RcppArmadillo.cpp:27:40: error: declaration of 'constexpr const unsigned int arma::arma_version::minor' outside of class is not definition [-fpermissive]
 const unsigned int arma::arma_version::minor;
                                        ^
RcppArmadillo.cpp:28:40: error: redeclaration 'arma::arma_version::patch' differs in 'constexpr'
 const unsigned int arma::arma_version::patch;
                                        ^
In file included from ../inst/include/armadillo:91:0,
                 from ../inst/include/RcppArmadilloForward.h:49,
                 from ../inst/include/RcppArmadillo.h:31,
                 from RcppArmadillo.cpp:22:
../inst/include/armadillo_bits/arma_version.hpp:33:33: error: from previous declaration 'arma::arma_version::patch'
   static constexpr unsigned int patch = ARMA_VERSION_PATCH;
                                 ^
RcppArmadillo.cpp:28:40: error: declaration of 'constexpr const unsigned int arma::arma_version::patch' outside of class is not definition [-fpermissive]
 const unsigned int arma::arma_version::patch;
                                        ^
make: *** [RcppArmadillo.o] Error 1
make: *** Waiting for unfinished jobs....
ERROR: compilation failed for package 'RcppArmadillo'
* removing '/usr/local/lib64/R/library/RcppArmadillo'
* restoring previous '/usr/local/lib64/R/library/RcppArmadillo'
Error: Failed to install 'unknown package' from URL:
  (converted from warning) installation of package 'RcppArmadillo' had non-zero exit status
Execution halted
FATAL:   post proc: exit status 1
FATAL:   While performing build: while running engine: exit status 255

这是在R3.6.0中的Singuarity容器中构建的,在CentOS 7上使用GCC 4.8.5构建。我可以使用devtools中的"install_version“命令安装RcppArmadillo的0.9.900.3.0版本(和这个版本以前与其他软件包完全兼容,这就是为什么我正在尝试安装),但是,每当我安装的另一个软件包需要依赖时,R立即将其更新为0.10.1.0.0,这会导致上面的错误和我的构建失败。我一直无法找到阻止R这样做的方法,只是告诉它不要为某些软件包安装依赖关系,但这让我头疼,我想看看这里是否有一个更简单的解决方案。有人知道如何修复这个编译错误,或者如何防止R在安装另一个需要它的包时自动更新软件包吗?

下面是显示RcppArmadillo版本0.9.900.3.0成功安装后立即进行更新的输出部分:

代码语言:javascript
复制
* DONE (RcppArmadillo)
Downloading package from url: https://ftp.osuosl.org/pub/cran/src/contrib/gratia_0.4.1.tar.gz
RcppArmad... (0.9.900.3.0 -> 0.10.1.0.0) [CRAN]
mvnfast      (NA          -> 0.2.5.1   ) [CRAN]
patchwork    (NA          -> 1.0.1     ) [CRAN]
Installing 3 packages: RcppArmadillo, mvnfast, patchwork
trying URL 'https://ftp.osuosl.org/pub/cran/src/contrib/RcppArmadillo_0.10.1.0.0.tar.gz'
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-11-02 23:31:16

这一点以前在GitHub回购、邮件列表或这里已经讨论过几次。

您最简单的选择是通过

代码语言:javascript
复制
install.packages("RcppArmadillo", repos="https://rcppcore.github.io/drat")

由于这不影响任何系统CRAN (或大多数用户)部署,因此可能不值得进行新的上载(以及所有相关的麻烦)。如果您在这方面有选择的话,您最好考虑从CentOS 7继续前进。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64652764

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档