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

rcmdcheck::check() fails on Windows when Rtools is not installed #174

Open
maxsutton opened this issue Dec 14, 2021 · 2 comments · May be fixed by #178
Open

rcmdcheck::check() fails on Windows when Rtools is not installed #174

maxsutton opened this issue Dec 14, 2021 · 2 comments · May be fixed by #178
Labels
bug an unexpected problem or unintended behavior

Comments

@maxsutton
Copy link

maxsutton commented Dec 14, 2021

Description

rcmdcheck::check() now throws an error and stops checking the package on Windows when Rtools is not installed.

Previous working behaviour

Previously (rcmdcheck v1.3.3), check() would issue a warning about missing Rtools, but still complete the checking of the package.

Cause

The cause seems to be the pkgbuild::local_build_tools() call introduced for #111 , which was seemingly done for convenience.

Here is the line in the latest version, where the issue remains:

pkgbuild::without_cache(pkgbuild::local_build_tools())

local_build_tools() has an argument required which is TRUE by default and is called as such. The description of the required argument is:

If TRUE, and build tools are not available, will throw an error. Otherwise will attempt to run code without them

Possible solutions

There are a couple of ways that I've thought of to fix this regression. There are likely others:

  • rcmdcheck::check() could call local_build_tools(required = FALSE), but I don't know if this would break the new intended behaviour introduced in Use pkgbuild::with_build_tools() in rcmcheck #111.

  • An option could be added which would set the required argument to false: e.g. options("rcmdcheck.rtools.required" = FALSE)

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Dec 15, 2021
@gaborcsardi
Copy link
Member

As a workaround, you can build the source package first, and then call rcmdcheck::rcmdcheck() on that.

@maxsutton
Copy link
Author

As a workaround, you can build the source package first, and then call rcmdcheck::rcmdcheck() on that.

I tried the suggested workaround (output below), but rcmdcheck::rcmdcheck() still threw the error. This is because pkgbuild::local_build_tools() is called regardless of whether a package tarball or directory is given.

Another concern is that such a workaround would be different to well-documented and recommended workflows (e.g. r-pkgs Automated checking), which could make it difficult for newer contributors.

Code

> pkg <- devtools::build()
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/.
√  checking for file '/path/to/pkg/DESCRIPTION' (827ms)
-  preparing 'pkg': (3.3s)
√  checking DESCRIPTION meta-information ... 
-  installing the package to build vignettes
√  creating vignettes (14.6s)
-  checking for LF line-endings in source and make files and shell scripts (2.2s)
-  checking for empty or unneeded directories
-  building 'pkg_0.0.0.9000.tar.gz'
   
> rcmdcheck::rcmdcheck(pkg)
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.

maxsutton pushed a commit to maxsutton/rcmdcheck that referenced this issue Mar 10, 2022
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.
@maxsutton maxsutton linked a pull request Mar 10, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants