zoukankan      html  css  js  c++  java
  • install.packages("RcppArmadillo")

    CentOS 7

    R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
    Copyright (C) 2019 The R Foundation for Statistical Computing
    Platform: x86_64-redhat-linux-gnu (64-bit)

    试开URL’https://mirrors.sjtug.sjtu.edu.cn/cran/src/contrib/RcppArmadillo_0.10.1.0.0.tar.gz'

    RcppArmadillo.cpp:26:40: 错误:对‘arma::arma_version::major’的重声明在‘constexp’方面
     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: 错误:与先前的声明‘arma::arma_version::major’不同
       static constexpr unsigned int major = ARMA_VERSION_MAJOR;
                                     ^
    RcppArmadillo.cpp:26:40: 错误:出现在类外的‘constexpr const unsigned int arma::arma_version::major’的声明不是定义 [-fpermissive]
     const unsigned int arma::arma_version::major;
                                            ^
    RcppArmadillo.cpp:27:40: 错误:对‘arma::arma_version::minor’的重声明在‘constexp’方面
     const unsigned int arma::arma_version::minor;

    原因:
    在使用install.packages("forecast")安装包时,R会搜索最新的相关的安装包进行安装,如果操作系统的版本较低与R包不兼容,就会出现编译等错误。

    解决办法:
    升级Linux(CentOS)系统版本,或,安装较低版本的R包

    下载低版本R包:
    http://cran.r-project.org/src/contrib/Archive/RcppArmadillo/
     
    手动安装低版本R RcppArmadillo包:

    wget https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.9.900.3.0.tar.gz

    R CMD INSTALL -l /usr/lib64/R/library RcppArmadillo_0.9.900.3.0.tar.gz

     ===================================================================

     CentOS 6.4:

    [root@testtest software]# R CMD INSTALL -l /usr/lib64/R/library RcppArmadillo_0.9.600.4.0.tar.gz
    * installing *source* package ‘RcppArmadillo’ ...
    ** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked
    checking whether the C++ compiler works... no
    configure: error: in `/tmp/RtmpDaPmhu/R.INSTALL41a7c56321c/RcppArmadillo':
    configure: error: C++ compiler cannot create executables
    See `config.log' for more details
    ERROR: configuration failed for package ‘RcppArmadillo’
    * removing ‘/usr/lib64/R/library/RcppArmadillo’
     


    安装成功:

    R CMD INSTALL -l /usr/lib64/R/library RcppArmadillo_0.5.600.2.0.tar.gz

  • 相关阅读:
    Linux编程make命令(转)
    如何处理Global symbol * requires explicit package name编译错误,以及use strict用法
    6235与旧版本的区别
    Linux下动态链接库的使用
    MTK Socket学习——HTTP请求
    指针和指针的引用
    VC/MFC Combo Box控件的用法
    makefile教程
    常用数据类型使用转换详解
    Linux发送与接收信息
  • 原文地址:https://www.cnblogs.com/emanlee/p/13914849.html
Copyright © 2011-2022 走看看