本文介绍了无法编译RcppArmadillo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

RcppArmadillo is a dependency of a few packages I'm trying to install. I get this error on compilation of RcppArmadillo version 0.10.1.0.0 (which is what R automatically pulls from CRAN when it finds that RcppArmadillo is a dep):

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构建的.我可以在RcppArmadillo的0.9.900.3.0版本中安装"install_version".来自devtools的命令(,此版本在与其他软件包相同之前完全可以正常工作,这就是为什么我要安装该软件包的原因),但是,R会立即将其更新为版本0.10.1.0. .0每当我正在安装的另一个软件包都需要RcppArmadillo作为依赖项时,这将导致上面的错误并使我的构建失败.我还没有找到阻止R做到这一点的方法,只是告诉R根本不安装某些软件包的依赖项,但这令人头疼,我想看看这里是否有更简单的解决方案.有谁知道如何解决此编译错误或如何防止R在安装需要该软件包的另一个软件包时自动更新该软件包?

This is being built inside of a Singuarity container in R 3.6.0 and with GCC 4.8.5 on CentOS 7. I can install version 0.9.900.3.0 of RcppArmadillo fine with the "install_version" command from devtools (and this version has completely worked fine before with the same other packages, which is why it's the one I'm trying to install), however, R immediately updates it to version 0.10.1.0.0 whenever another package I'm installing needs RcppArmadillo as a dependency, which then causes the error above and my build to fail. I haven't been able to find a way to stop R from doing this short of just telling it to not install dependencies for certain packages at all, but this poses headaches and I wanted to see if there was an easier solution here. Does anyone know how to fix this compilation error or how to keep R from automatically updating the package on install of another package that needs it?

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

Here's the part of the output showing the update happening right after version 0.9.900.3.0 of RcppArmadillo is successfully installed:

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

推荐答案

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

That has been discussed a few times before at the GitHub repo, or the mailing list, or here.

您最简单的选择是通过

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

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

As this does not affect any of the systems CRAN (or most users) deploy, it is likely not worth a new upload (and all the associated hassle). You maight want to consider moving on from CentOS 7 if you have a choice in that matter.

这篇关于无法编译RcppArmadillo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 13:24