2

RcppArmadillo 是我尝试安装的一些软件包的依赖项。我在编译 RcppArmadillo 版本 0.10.1.0.0 时收到此错误(这是 R 在发现 RcppArmadillo 是一个 dep 时自动从 CRAN 中提取的内容):

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

这是在 R 3.6.0 的 Singuarity 容器内构建的,并且在 CentOS 7 上使用 GCC 4.8.5。我可以使用 devtools 的“install_version”命令安装 RcppArmadillo 的 0.9.900.3.0 版本(这个版本已经完全之前使用相同的其他软件包工作得很好,这就是为什么我要安装它的原因),但是,只要我正在安装的另一个包需要 RcppArmadillo 作为依赖项,R 就会立即将其更新到版本 0.10.1.0.0,这会导致上述错误并且我的构建失败。除了告诉它根本不为某些包安装依赖项之外,我还没有找到一种方法来阻止 R 这样做,但这让人头疼,我想看看这里是否有更简单的解决方案。有谁知道如何修复这个编译错误或如何防止 R 在安装另一个需要它的包时自动更新包?

下面是输出的一部分,显示在成功安装 RcppArmadillo 版本 0.9.900.3.0 之后发生的更新:

* 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'
4

1 回答 1

4

之前在 GitHub 存储库、邮件列表或此处已经讨论过几次。

您最简单的选择是通过以下方式选择更新版本

install.packages("RcppArmadillo", repos="https://rcppcore.github.io/drat")

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

于 2020-11-02T23:31:16.460 回答