I'm updating an R package that I last released (with no problems) on R3.6. I've since updated to R 4.0.0 and Rtools 40.
The package builds and runs successfully on 64-bit R. But I see that on win builder, the package's testthat tests fail on win32 (but not win64).
To diagnose the failure, I'm building the package on my 64-bit Windows 10 machine, using a 32-bit version of R and devtools::install(args= "--no-multiarch")
.
I've edited the PATH
environment variable, replacing:
The install process is indeed looking to mingw32 for the g++ and gcc executables. Installation is successful, with no warnings or errors.
However, when I attempt to load the package with devtools::load_all()
, I see:
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/path/to/PACKAGENAME/src/PACKAGENAME.dll':
LoadLibrary failure: %1 is not a valid Win32 application.
If I instead run library('PACKAGENAME')
, then run tests, the R GUI freezes and exits silently -- paralleling the failure on win builder.
I'm struggling to diagnose why a DLL that works perfectly on 64-bit won't work on a 32-bit architecture. The only substantive change I've made to the C++ code is to replace some int
s with typedef int16_t xint
.
The problem seems to have been the existence of 64-bit dlls in the package's source folder (as insinuated by the error message), created by 'devtools'.
Once these files were deleted load_all
would happily re-create them using the 32-bit compilers.