gpt4 book ai didi

r - 无法编译 RcppArmadillo

转载 作者:行者123 更新时间:2023-12-04 19:30:16 30 4
gpt4 key购买 nike

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”命令( 和这个版本在使用相同的其他软件包之前完全可以正常工作,这就是为什么我要安装它的原因 ),但是,只要我安装的另一个软件包需要,R 就会立即将其更新到版本 0.10.1.0.0 RcppArmadillo 作为依赖项,然后导致上述错误和我的构建失败。我还没有找到一种方法来阻止 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'

最佳答案

之前在 GitHub 存储库、邮件列表或此处已经讨论过几次。
您最简单的选择是通过以下方式选择更新版本

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

关于r - 无法编译 RcppArmadillo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64652764/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com