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

Fix check() failing when Rtools not installed #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

maxsutton
Copy link

pkgbuild::local_build_tools() fails if Rtools is missing on Windows
when required argument is TRUE, which is the default. This changes
required to FALSE, which shouldn't throw an error, but will load Rtools
if it is available.

Closes #174.

pkgbuild::local_build_tools() fails if Rtools is missing on Windows
when `required` argument is TRUE, which is the default. This changes
`required` to FALSE, which shouldn't through an error.

Closes r-lib#174.
@codecov-commenter
Copy link

Codecov Report

Merging #178 (0c3b082) into main (bda6e71) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 0c3b082 differs from pull request most recent head 3fd9f7d. Consider uploading reports for the commit 3fd9f7d to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #178   +/-   ##
=======================================
  Coverage   80.63%   80.63%           
=======================================
  Files          19       19           
  Lines        1007     1007           
=======================================
  Hits          812      812           
  Misses        195      195           
Impacted Files Coverage Δ
R/package.R 87.09% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bda6e71...3fd9f7d. Read the comment docs.

@gaborcsardi
Copy link
Member

Thanks! So after this patch, what happens if a package needs Rtools, but it is not installed? What is the error you get?

@maxsutton
Copy link
Author

I tried this patch out with the dplyr and data.table packages, which require Rtools. I got the following output from rcmdcheck() and devtools::check() (they're the same across both dplyr and data.table). In both cases, a pop-up appears asking if the user wants to install Rtools. I've shown the output if they select No.

This output is very similar to (if not the same as) the output from rcmdcheck 1.4.0, shown below.

With patch

rcmdcheck::rcmdcheck()
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
-- R CMD build ------------------------------------------------------------------------------------------------
pdflatex not found! Not building PDF manual.
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
==> devtools::check(document = FALSE)

-- Building ------------------------------------------- data.table --
Setting env vars:
* CFLAGS    : -Wall -pedantic
* CXXFLAGS  : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
---------------------------------------------------------------------
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
Execution halted

Exited with status 1.

rcmdcheck 1.4.0

> rcmdcheck::rcmdcheck()
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
==> devtools::check(document = FALSE)

-- Building ------------------------------------------- data.table --
Setting env vars:
* CFLAGS    : -Wall -pedantic
* CXXFLAGS  : -Wall -pedantic
* CXX11FLAGS: -Wall -pedantic
---------------------------------------------------------------------
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
WARNING: Rtools is required to build R packages, but is not currently installed.

Please download and install Rtools 4.0 from https://cran.r-project.org/bin/windows/Rtools/.
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
Execution halted

Exited with status 1.

@maxsutton
Copy link
Author

Separately, the checks show that the package now fails for R 3.4. I don't know if this is related to this PR, or if that's because of a change somewhere else?

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 this pull request may close these issues.

rcmdcheck::check() fails on Windows when Rtools is not installed
3 participants