Search code examples
rwindowsdevtoolsr-package

R package failing devtools::check_win_devel()


A co-author and I are writing up an R package and making it ready for release. I've worked entirely on mac during the development process and the package clears devtools::check() without any errors or warnings. However, when I run devtools::check_win_devel() to ensure that it is compatible with Windows I get an installation error. From the error log I can see that the problem is most likely related to the C-code included in the package as it fails to create the appropriate DLL file(s), but I cannot figure out how to solve it. The error log is included below:

* 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/[...]'

I've tried building the package locally and submitting the build, as well as toying with the arguments, 'binary', and 'compile_attributes' for the pkgbuild::build() function.


Solution

  • SOLVED: The problem was related to the RcppArmadillo makevars files which needed to be re-created using usethis::use_rcpp_armadillo(). The previous makevars files were deleted when I was updating the cpp code.