Building from my stack overflow question here, I've done all the obvious stuff I can think of.
I uninstalled RStudio, R and deleted rtools40 folder, restarted and reinstalled those items. I believe I have the path set up appropriately.
Here's the code I tried:
#troubleshooting installation
pkgbuild::find_rtools()
pkgbuild::has_rtools(TRUE)
pkgbuild::check_rtools(TRUE)
pkgbuild::rtools_path()
pkgbuild::check_build_tools(TRUE)
pkgbuild::check_compiler(TRUE)
Sys.getenv("PATH")
Sys.getenv('BINPREF')
sessionInfo()
#Test installation from source via CRAN
pkgbuild::with_build_tools(install.packages("lme4", type = "source"))
Sys.getenv("R_ARCH")
Sys.getenv("R_ARCH_BIN")
#Sys.setenv("R_ARCH_BIN"="/x64") #does not fix the problem:
And here is the output
Restarting R session...
> #troubleshooting installation
> pkgbuild::find_rtools()
[1] TRUE
> pkgbuild::has_rtools(TRUE)
[1] TRUE
> pkgbuild::check_rtools(TRUE)
[1] TRUE
> pkgbuild::rtools_path()
[1] "C:\\rtools40/usr/bin"
> pkgbuild::check_build_tools(TRUE)
Your system is ready to build packages!
> pkgbuild::check_compiler(TRUE)
Trying to compile a simple C file
Running "C:/PROGRA~1/R/R-40~1.3/bin/x64/Rcmd.exe" SHLIB foo.c
C:/rtools40/mingw64/bin/gcc -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c foo.c -o foo.o
C:/rtools40/mingw64/bin/gcc -shared -s -static-libgcc -o foo.dll tmp.def foo.o -LC:/PROGRA~1/R/R-40~1.3/bin/x64 -lR
[1] TRUE
> Sys.getenv("PATH")
[1] "C:\\Program Files\\R\\R-4.0.3\\bin\\x64;C:\\rtools40\\bin;C:\\rtools40\\mingw64\\bin;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\lib\\gcc\\x86_64-w64-mingw32\\8.3.0;C:\\rtools40\\mingw32\\lib\\gcc\\i686-w64-mingw32\\8.3.0;C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Pandoc\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\dotnet\\;C:\\Program Files\\Microsoft SQL Server\\130\\Tools\\Binn\\;C:\\Program Files\\Microsoft SQL Server\\Client SDK\\ODBC\\170\\Tools\\Binn\\;C:\\Users\\nealm\\AppData\\Local\\Microsoft\\WindowsApps;C:\\ProgramData\\Anaconda3;C:\\ProgramData\\Anaconda3\\Scripts;C:\\Users\\nealm\\.conda\\pkgs\\conda-4.7.5-py37_0\\Scripts;C:\\ProgramData\\Anaconda3\\Library\\bin;C:\\Users\\nealm\\AppData\\Local\\GitHubDesktop\\bin;C:\\Users\\nealm\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\nealm\\AppData\\Roaming\\TinyTeX\\bin\\win32;"
> Sys.getenv('BINPREF')
[1] "C:/rtools40/mingw64/bin/"
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252 LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] processx_3.4.5 compiler_4.0.3 assertthat_0.2.1 R6_2.5.0 cli_2.2.0 prettyunits_1.1.1
[7] tools_4.0.3 glue_1.4.2 rstudioapi_0.13 crayon_1.3.4 fansi_0.4.1 callr_3.5.1
[13] ps_1.4.0 pkgbuild_1.1.0
>
> #Test installation from source via CRAN
> pkgbuild::with_build_tools(install.packages("lme4", type = "source"))
Installing package into ‘C:/Rpackages’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/lme4_1.1-26.tar.gz'
Content type 'application/x-gzip' length 3297635 bytes (3.1 MB)
downloaded 3.1 MB
* installing *source* package 'lme4' ...
** package 'lme4' successfully unpacked and MD5 sums checked
** using staged installation
** libs
*** arch - i386
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c external.cpp -o external.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c glmFamily.cpp -o glmFamily.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c optimizer.cpp -o optimizer.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c predModule.cpp -o predModule.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-40~1.3/include" -DNDEBUG -I. -DNDEBUG -DEIGEN_DONT_VECTORIZE -I'C:/Rpackages/Rcpp/include' -I'C:/Rpackages/RcppEigen/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c respModule.cpp -o respModule.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -shared -s -static-libgcc -o lme4.dll tmp.def external.o glmFamily.o optimizer.o predModule.o respModule.o -LC:/PROGRA~1/R/R-40~1.3/bin/i386 -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-40~1.3/bin/i386/R.dll when searching for -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:/PROGRA~1/R/R-40~1.3/bin/i386/R.dll when searching for -lR
C:/rtools40/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lR
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'lme4'
* removing 'C:/Rpackages/lme4'
* restoring previous 'C:/Rpackages/lme4'
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\nealm\AppData\Local\Temp\RtmpKMQyxB\downloaded_packages’
>
> Sys.getenv("R_ARCH")
[1] "/x64"
> Sys.getenv("R_ARCH_BIN")
[1] ""
I had to add the path to make.exe for the check_compiler to work.
Adding paths for the locations for collect2.exe did not resolve the problem.
It was raised in comments that it appears to be using 32bit architecture for the build (*** arch - i386). Specifying R_ARCH_BIN did not work to resolve the problem or change that part of the output.
I can confirm that the same error results trying an install from Rgui, whether 64 or 32 bit.
Building from my stack overflow question here, I've done all the obvious stuff I can think of.
I uninstalled RStudio, R and deleted rtools40 folder, restarted and reinstalled those items. I believe I have the path set up appropriately.
Here's the code I tried:
And here is the output
I had to add the path to make.exe for the
check_compiler
to work.Adding paths for the locations for collect2.exe did not resolve the problem.
It was raised in comments that it appears to be using 32bit architecture for the build (
*** arch - i386
). Specifying R_ARCH_BIN did not work to resolve the problem or change that part of the output.I can confirm that the same error results trying an install from Rgui, whether 64 or 32 bit.
Suggestions?