R 包失败 devtools::check_win_devel()

问题描述 投票:0回答:1

我和一位合著者正在编写一个 R 包并准备发布。我在开发过程中完全在 mac 上工作,并且该包清除了 devtools::check() ,没有任何错误或警告。但是,当我运行 devtools::check_win_devel() 以确保它与 Windows 兼容时,我收到安装错误。从错误日志中我可以看到问题很可能与包中包含的 C 代码有关,因为它无法创建适当的 DLL 文件,但我不知道如何解决它。错误日志如下:

* installing *source* package ...
** using staged installation
** libs
using C++ compiler: 'g++.exe (GCC) 12.2.0'
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG  -I'D:/RCompile/CRANpkg/lib/4.4/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.4/RcppArmadillo/include'   -I"d:/rtools43/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG  -I'D:/RCompile/CRANpkg/lib/4.4/Rcpp/include' -I'D:/RCompile/CRANpkg/lib/4.4/RcppArmadillo/include'   -I"d:/rtools43/x86_64-w64-mingw32.static.posix/include"     -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c a019_old.cpp -o a019_old.o
g++ -std=gnu++17 -shared -s -static-libgcc -o evinf.dll tmp.def RcppExports.o a019_old.o -Ld:/rtools43/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools43/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -lR
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text+0x201e): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text+0x23e1): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text+0x2f08): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text+0x30ef): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text+0x3967): undefined reference to `dtrtri_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text+0x49c2): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text+0x4d63): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0xd98): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0xf3b): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x119b): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x1489): undefined reference to `dgemm_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x1593): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x17ba): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x1996): undefined reference to `dsyrk_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x1cd9): undefined reference to `dgemm_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x1de7): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x1ec5): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text.hot+0x2364): undefined reference to `dsyrk_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma3MatIdEC1INS_2OpINS_3ColIdEENS_9op_htransEEES5_NS_10glue_timesEEERKNS_4GlueIT_T0_T1_EE[_ZN4arma3MatIdEC1INS_2OpINS_3ColIdEENS_9op_htransEEES5_NS_10glue_timesEEERKNS_4GlueIT_T0_T1_EE]+0x1a9): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma3MatIdEC1INS_2OpINS_3ColIdEENS_9op_htransEEES5_NS_10glue_timesEEERKNS_4GlueIT_T0_T1_EE[_ZN4arma3MatIdEC1INS_2OpINS_3ColIdEENS_9op_htransEEES5_NS_10glue_timesEEERKNS_4GlueIT_T0_T1_EE]+0x2be): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb0ELb1ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb0ELb1ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x1b5): undefined reference to `dgemm_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb0ELb1ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb0ELb1ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x33a): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma10glue_times5applyIdLb0ELb0ELb1ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_[_ZN4arma10glue_times5applyIdLb0ELb0ELb1ENS_3MatIdEES3_EEvRNS2_IT_EERKT3_RKT4_S4_]+0x417): undefined reference to `dgemv_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma6auxlib9inv_sympdIdEEbRNS_3MatIT_EERb[_ZN4arma6auxlib9inv_sympdIdEEbRNS_3MatIT_EERb]+0x79): undefined reference to `dpotrf_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma6auxlib9inv_sympdIdEEbRNS_3MatIT_EERb[_ZN4arma6auxlib9inv_sympdIdEEbRNS_3MatIT_EERb]+0xa4): undefined reference to `dpotri_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE[_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE]+0x96): undefined reference to `dgetrf_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE[_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE]+0xf9): undefined reference to `dgetri_'
D:\rtools43\x86_64-w64-mingw32.static.posix\bin/ld.exe: a019_old.o:a019_old.cpp:(.text$_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE[_ZN4arma6auxlib3invIdEEbRNS_3MatIT_EE]+0x1ec): undefined reference to `dgetri_'
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 
* removing 'd:/RCompile/CRANguest/R-devel/lib/[...]'

我尝试在本地构建包并提交构建,以及使用 pkgbuild::build() 函数的参数“binary”和“compile_attributes”。

r windows devtools r-package
1个回答
0
投票

已解决: 该问题与 RcppArmadillo makevars 文件有关,需要使用 usethis::use_rcpp_armadillo() 重新创建该文件。当我更新cpp代码时,之前的makevars文件被删除了。

© www.soinside.com 2019 - 2024. All rights reserved.