通过devtools下载软件包(使用RcppArmadillo)时出错

时间:2018-10-25 21:09:06

标签: r rcpp devtools

我正在尝试使用devtools从github下载R包,但遇到了一些问题。从我收到的错误消息中,问题似乎与RcppArmadillo有关,因为“ dgemv_”似乎是RcppArmadillo的一部分。卸载或重新安装RcppArmadillo不会停止错误。

由于收到此错误消息,因此我卸载了R,RStudio和Rtools。我重新安装了R,安装了一些软件包,安装了Rtools,并且错误仍然存​​在。


在R中,我的会话信息为:

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] RcppArmadillo_0.9.100.5.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19      magrittr_1.5      usethis_1.4.0     devtools_2.0.0    pkgload_1.0.1     R6_2.3.0          rlang_0.3.0       tools_3.5.1      
 [9] pkgbuild_1.0.2    sessioninfo_1.1.0 cli_1.0.1         withr_2.1.2       remotes_2.0.1     assertthat_0.2.0  digest_0.6.18     rprojroot_1.3-2  
[17] crayon_1.3.4      processx_3.2.0    callr_3.0.0       base64enc_0.1-3   fs_1.2.6          ps_1.2.0          curl_3.2          memoise_1.1.0    
[25] glue_1.3.0        compiler_3.5.1    desc_1.2.0        backports_1.1.2   prettyunits_1.0.2

当我跑步时:

devtools::install_github("irinagain/mixedCCA")

我收到错误消息:

Downloading GitHub repo irinagain/mixedCCA@master
√  checking for file 'C:\Users\ben\AppData\Local\Temp\RtmpSQ7zwU\remotes2a5c2e561667\irinagain-mixedCCA-af59bb9/DESCRIPTION' (406ms)
-  preparing 'mixedCCA':
√  checking DESCRIPTION meta-information
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts
-  checking for empty or unneeded directories
-  building 'mixedCCA_0.1.0.tar.gz'

* installing *source* package 'mixedCCA' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"C:/Program Files/R/R-3.5.1/library/Rcpp/include" -I"C:/Program Files/R/R-3.5.1/library/RcppArmadillo/include"        -O2 -Wall  -mtune=generic -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_32/bin/g++  -I"C:/PROGRA~1/R/R-35~1.1/include" -DNDEBUG  -I"C:/Program Files/R/R-3.5.1/library/Rcpp/include" -I"C:/Program Files/R/R-3.5.1/library/RcppArmadillo/include"        -O2 -Wall  -mtune=generic -c find_w12.cpp -o find_w12.o
c:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o mixedCCA.dll tmp.def RcppExports.o find_w12.o -LC:/PROGRA~1/R/R-35~1.1/bin/i386 -lR
find_w12.o:find_w12.cpp:(.text$_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[__ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE]+0x361): undefined reference to `dgemv_'
find_w12.o:find_w12.cpp:(.text$_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[__ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE]+0x622): undefined reference to `dgemv_'
find_w12.o:find_w12.cpp:(.text$_ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE[__ZN4arma27glue_times_redirect2_helperILb0EE5applyINS_3MatIdEENS_3ColIdEEEEvRNS3_INT_9elem_typeEEERKNS_4GlueIS7_T0_NS_10glue_timesEEE]+0xa6b): undefined reference to `dgemv_'
find_w12.o:find_w12.cpp:(.text$_ZN4arma5ProxyINS_4GlueINS_3MatIdEENS_3ColIdEENS_10glue_timesEEEEC1ERKS7_[__ZN4arma5ProxyINS_4GlueINS_3MatIdEENS_3ColIdEENS_10glue_timesEEEEC1ERKS7_]+0x18c): undefined reference to `dgemv_'
find_w12.o:find_w12.cpp:(.text$_ZN4arma5ProxyINS_4GlueINS_3MatIdEENS_3ColIdEENS_10glue_timesEEEEC1ERKS7_[__ZN4arma5ProxyINS_4GlueINS_3MatIdEENS_3ColIdEENS_10glue_timesEEEEC1ERKS7_]+0x43a): undefined reference to `dgemv_'
find_w12.o:find_w12.cpp:(.text$_ZN4arma5ProxyINS_4GlueINS_3MatIdEENS_3ColIdEENS_10glue_timesEEEEC1ERKS7_[__ZN4arma5ProxyINS_4GlueINS_3MatIdEENS_3ColIdEENS_10glue_timesEEEEC1ERKS7_]+0x987): more undefined references to `dgemv_' follow
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'mixedCCA'
* removing 'C:/Program Files/R/R-3.5.1/library/mixedCCA'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/ben/AppData/Local/Temp/RtmpSQ7zwU/file2a5c4fb94283/mixedCCA_0.1.0.tar.gz’ had non-zero exit status

3 个答案:

答案 0 :(得分:3)

问题在于链接期间未提及BLAS和LAPACK库。为此,软件包作者应使用类似

的方法
PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
src/Makevars(.win)

。当使用RcppArmadillo::RcppArmadillo.package.skeleton()来设置程序包时,这会自动发生。但是,mixedCCA根本没有Makevars文件:https://github.com/irinagain/mixedCCA/tree/master/src。您应该在GH上打开一个问题才能解决此问题。

答案 1 :(得分:2)

不是Rcpp问题,也不是RcppArmadillo问题,因为它显示了

other attached packages:
[1] RcppArmadillo_0.9.100.5.0

RcppArmadillo仅被加载。

我建议您在mixedCCA回购中打开票证。

答案 2 :(得分:0)

我使用以下方法解决了这个问题:

  • 在本地克隆存储库
  • 创建一个文件src / Makevars.win,其中包含以下行:PKG_LIBS = $(LAPACK_LIBS)$(BLAS_LIBS)$(FLIBS)
  • install.packages('path / to / the / repo',repos = NULL,type ='source')
相关问题