Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install cli from source on Windows 4.2 (and binary install causes other source installations to fail) #494

Closed
cpsievert opened this issue Jul 11, 2022 · 7 comments · Fixed by #508
Milestone

Comments

@cpsievert
Copy link

cpsievert commented Jul 11, 2022

> remotes::install_github("r-lib/cli")
Downloading GitHub repo r-lib/cli@HEAD
Installing 1 packages: glue
Installing package intoC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/glue_1.6.2.zip'
Content type 'application/zip' length 162214 bytes (158 KB)
downloaded 158 KB

packagegluesuccessfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\cpsievert\AppData\Local\Temp\Rtmp0ErltS\downloaded_packages
Running `R CMD build`...
* checking for file 'C:\Users\cpsievert\AppData\Local\Temp\Rtmp0ErltS\remotes14d445844e46\r-lib-cli-e92e517/DESCRIPTION' ... OK
* preparing 'cli':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'cli_3.3.0.9000.tar.gz'
Installing package intoC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)
* installing *source* package 'cli' ...
** using staged installation
** libs
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c ansi.c -o ansi.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c cleancall.c -o cleancall.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c diff.c -o diff.o
diff.c: In function 'clic_diff_chr':
diff.c:104:3: warning: 'sn' may be used uninitialized in this function [-Wmaybe-uninitialized]
  104 |   SET_VECTOR_ELT(result, 0, allocVector(INTSXP, sn));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c errors.c -o errors.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c init.c -o init.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c md5.c -o md5.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c progress-altrep.c -o progress-altrep.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c progress.c -o progress.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c sha256.c -o sha256.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c thread.c -o thread.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c tty.c -o tty.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c utf8.c -o utf8.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c utils.c -o utils.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c win-utf8.c -o win-utf8.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c winfiles.c -o winfiles.o
gcc -shared -s -static-libgcc -o cli.dll tmp.def ansi.o cleancall.o diff.o errors.o init.o md5.o progress-altrep.o progress.o sha256.o thread.o tty.o utf8.o utils.o win-utf8.o winfiles.o -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~2/R/R-42~1.1/bin/x64 -lR
installing to C:/Users/cpsievert/AppData/Local/R/win-library/4.2/00LOCK-cli/00new/cli/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
ERROR: loading failed
* removing 'C:/Users/cpsievert/AppData/Local/R/win-library/4.2/cli'
Warning message:
In i.p(...) :
  installation of packageC:/Users/CPSIEV~1/AppData/Local/Temp/Rtmp0ErltS/file14d42af8c6a/cli_3.3.0.9000.tar.gzhad non-zero exit status

Also, more problematically, installing the current {cli} binary on CRAN causes other type="source" installations to fail with the same error:

> install.packages("cli")
Installing package intoC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.2/cli_3.3.0.zip'
Content type 'application/zip' length 1221213 bytes (1.2 MB)
downloaded 1.2 MB

packageclisuccessfully unpacked and MD5 sums checked

The downloaded binary packages are in
	C:\Users\cpsievert\AppData\Local\Temp\Rtmp0ErltS\downloaded_packages

> install.packages("rlang", type = "source")
Installing package intoC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rlang_1.0.3.tar.gz'
Content type 'application/x-gzip' length 740744 bytes (723 KB)
downloaded 723 KB

* installing *source* package 'rlang' ...
** package 'rlang' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c capture.c -o capture.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c internal.c -o internal.o
g++  -std=gnu++11 -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c rlang-rcc.cpp -o rlang-rcc.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c rlang.c -o rlang.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c version.c -o version.o
g++ -shared -s -static-libgcc -o rlang.dll tmp.def capture.o internal.o rlang-rcc.o rlang.o version.o -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~2/R/R-42~1.1/bin/x64 -lR
installing to C:/Users/cpsievert/AppData/Local/R/win-library/4.2/00LOCK-rlang/00new/rlang/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
ERROR: loading failed
* removing 'C:/Users/cpsievert/AppData/Local/R/win-library/4.2/rlang'
* restoring previous 'C:/Users/cpsievert/AppData/Local/R/win-library/4.2/rlang'
Warning in install.packages :
  installation of packagerlanghad non-zero exit status

The downloaded source packages are inC:\Users\cpsievert\AppData\Local\Temp\Rtmp0ErltS\downloaded_packages

And after remove.packages("cli"), it succeeds:

> install.packages("rlang", type = "source")
Installing package intoC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rlang_1.0.3.tar.gz'
Content type 'application/x-gzip' length 740744 bytes (723 KB)
downloaded 723 KB

* installing *source* package 'rlang' ...
** package 'rlang' successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c capture.c -o capture.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c internal.c -o internal.o
g++  -std=gnu++11 -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign  -c rlang-rcc.cpp -o rlang-rcc.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c rlang.c -o rlang.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG -I./rlang/    -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c version.c -o version.o
g++ -shared -s -static-libgcc -o rlang.dll tmp.def capture.o internal.o rlang-rcc.o rlang.o version.o -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~2/R/R-42~1.1/bin/x64 -lR
installing to C:/Users/cpsievert/AppData/Local/R/win-library/4.2/00LOCK-rlang/00new/rlang/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (rlang)

The downloaded source packages are inC:\Users\cpsievert\AppData\Local\Temp\Rtmp0ErltS\downloaded_packages
> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

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

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

loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1    remotes_2.4.2
@gaborcsardi
Copy link
Member

** testing if installed package can be loaded from temporary location
ERROR: loading failed

Can you try to find the actual error message? E.g. install the package with R CMD INSTALL --no-test-load and then try to load the installed package with library()?

@cpsievert
Copy link
Author

cpsievert commented Jul 11, 2022

Huh, after installing that way library(cli) works (and same with setwd(tempdir()); library(cli))

@cpsievert
Copy link
Author

cpsievert commented Jul 11, 2022

There still appears to be some issues with lazy loading, though:

> remotes::install_github("rstudio/htmltools", INSTALL_opts = "--no-test-load --no-byte-compile")
Downloading GitHub repo rstudio/htmltools@HEAD
Running `R CMD build`...
* checking for file 'C:\Users\cpsievert\AppData\Local\Temp\RtmpigI9PP\remotes118c32634b0d\rstudio-htmltools-5d297d4/DESCRIPTION' ... OK
* preparing 'htmltools':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'htmltools_0.5.2.9000.tar.gz'
Installing package intoC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)
* installing *source* package 'htmltools' ...
** using staged installation
** libs
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c init.c -o init.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c template.c -o template.o
gcc -shared -s -static-libgcc -o htmltools.dll tmp.def init.o template.o -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~2/R/R-42~1.1/bin/x64 -lR
installing to C:/Users/cpsievert/AppData/Local/R/win-library/4.2/00LOCK-htmltools/00new/htmltools/libs/x64
** R
** preparing package for lazy loading
ERROR: lazy loading failed for package 'htmltools'
* removing 'C:/Users/cpsievert/AppData/Local/R/win-library/4.2/htmltools'
* restoring previous 'C:/Users/cpsievert/AppData/Local/R/win-library/4.2/htmltools'
Warning message:
In i.p(...) :
  installation of packageC:/Users/CPSIEV~1/AppData/Local/Temp/RtmpigI9PP/file118c157f75fb/htmltools_0.5.2.9000.tar.gzhad non-zero exit status
> remove.packages("cli")

Removing package fromC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)

> remotes::install_github("rstudio/htmltools", INSTALL_opts = "--no-test-load")
Downloading GitHub repo rstudio/htmltools@HEAD
Running `R CMD build`...
* checking for file 'C:\Users\cpsievert\AppData\Local\Temp\Rtmp0ErltS\remotes14d41610b9f\rstudio-htmltools-5d297d4/DESCRIPTION' ... OK
* preparing 'htmltools':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building 'htmltools_0.5.2.9000.tar.gz'
Installing package intoC:/Users/cpsievert/AppData/Local/R/win-library/4.2’
(aslibis unspecified)
* installing *source* package 'htmltools' ...
** using staged installation
** libs
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c init.c -o init.o
gcc  -I"C:/PROGRA~2/R/R-42~1.1/include" -DNDEBUG     -I"C:/rtools42/x86_64-w64-mingw32.static.posix/include"     -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign  -c template.c -o template.o
gcc -shared -s -static-libgcc -o htmltools.dll tmp.def init.o template.o -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib/x64 -LC:/rtools42/x86_64-w64-mingw32.static.posix/lib -LC:/PROGRA~2/R/R-42~1.1/bin/x64 -lR
installing to C:/Users/cpsievert/AppData/Local/R/win-library/4.2/00LOCK-htmltools/00new/htmltools/libs/x64
** R
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
* DONE (htmltools)

@gaborcsardi
Copy link
Member

Try setting the CLI_NO_THREAD="true" env var.

@gaborcsardi
Copy link
Member

What version of Windows is this exactly, btw?

@cpsievert
Copy link
Author

cpsievert commented Jul 11, 2022

That appears to have fixed it, thanks! I'm running Windows 11 (via parallels on an M1 mac):

Screen Shot 2022-07-11 at 1 52 50 PM

@gaborcsardi
Copy link
Member

gaborcsardi commented Jul 11, 2022

We haven't seen anything like this on intel hardware and nothing has changed in cli for a while, so it is very likely that this is an issue in the x86_64 emulation of arm64 Windows. (Which is very buggy, btw. so brace yourself if you intend to use it for daily work.) Or it could be an issue in the pthread implementation in MinGW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants