{"action":"created","issue":{"url":"https://api.github.com/repos/r-lib/pkgbuild/issues/54","repository_url":"https://api.github.com/repos/r-lib/pkgbuild","labels_url":"https://api.github.com/repos/r-lib/pkgbuild/issues/54/labels{/name}","comments_url":"https://api.github.com/repos/r-lib/pkgbuild/issues/54/comments","events_url":"https://api.github.com/repos/r-lib/pkgbuild/issues/54/events","html_url":"https://github.com/r-lib/pkgbuild/issues/54","id":372016637,"node_id":"MDU6SXNzdWUzNzIwMTY2Mzc=","number":54,"title":"with_build_tools fails on CRAN when building the prophet package","user":{"login":"bgoodri","id":3386282,"node_id":"MDQ6VXNlcjMzODYyODI=","avatar_url":"https://avatars2.githubusercontent.com/u/3386282?v=4","gravatar_id":"","url":"https://api.github.com/users/bgoodri","html_url":"https://github.com/bgoodri","followers_url":"https://api.github.com/users/bgoodri/followers","following_url":"https://api.github.com/users/bgoodri/following{/other_user}","gists_url":"https://api.github.com/users/bgoodri/gists{/gist_id}","starred_url":"https://api.github.com/users/bgoodri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgoodri/subscriptions","organizations_url":"https://api.github.com/users/bgoodri/orgs","repos_url":"https://api.github.com/users/bgoodri/repos","events_url":"https://api.github.com/users/bgoodri/events{/privacy}","received_events_url":"https://api.github.com/users/bgoodri/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-10-19T15:52:59Z","updated_at":"2018-12-19T18:46:27Z","closed_at":null,"author_association":"NONE","body":"I have started using **pkgbuild** internally in **rstan**, not to build a package but to build dynamic loaded shared objects via `inline::cxxfunction`. This looks like it will be a big help for Windows users and it is working fine in most cases, including in many packages that depend on **rstan**.\r\n\r\nHowever, the **prophet** package maintained by @seanjtaylor and @bletham is the one package that imports **rstan** that is failing to build on CRAN for all flavors of Windows, with \r\n\r\n> WARNING: Rtools is required to build R packages, but is not currently installed.\r\n> Please download and install Rtools 3.5 from http://cran.r-project.org/bin/windows/Rtools/.\r\n> Error: Could not find tools necessary to compile a package\r\n> * removing 'd:/Rcompile/CRANpkg/lib/3.6/prophet'\r\n> * restoring previous 'd:/Rcompile/CRANpkg/lib/3.6/prophet'\r\n\r\nFor the full-log see, e.g.\r\nhttps://www.r-project.org/nosvn/R.check/r-devel-windows-ix86+x86_64/prophet-00install.html\r\n\r\nThe **prophet** package has an unusual build process that utilizes a `src/install_libs.R`file that calls `rstan::stan_model`\r\nhttps://github.com/facebook/prophet/blob/master/R/src/install.libs.R#L14\r\nwhich ultimately calls `pkgbuild::with_build_tools(inline::cxxfunction(...))`\r\nhttps://github.com/stan-dev/rstan/blob/develop/rstan/rstan/R/cxxfunplus.R#L152\r\n\r\nBut I have no idea why `with_build_tools` would think RTools is not installed on the Windows server that tests R packages."},"comment":{"url":"https://api.github.com/repos/r-lib/pkgbuild/issues/comments/448702834","html_url":"https://github.com/r-lib/pkgbuild/issues/54#issuecomment-448702834","issue_url":"https://api.github.com/repos/r-lib/pkgbuild/issues/54","id":448702834,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0ODcwMjgzNA==","user":{"login":"jimhester","id":205275,"node_id":"MDQ6VXNlcjIwNTI3NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/205275?v=4","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"created_at":"2018-12-19T18:46:27Z","updated_at":"2018-12-19T18:46:27Z","author_association":"MEMBER","body":" think the issue is largely stemming because you are trying to compile from within [install.iibs.R](https://github.com/jimhester/prophet/blob/211f30039ab40f95ee6e477cbd13f733618f62a9/R/src/install.libs.R#L13-L17)\r\n\r\nNotably this function is run from the _64_ bit version of R for both architectures on Windows, but the `R_ARCH` environment variable is changed when installing the 32 bit libraries, so [pkgbuild:::gcc_arch()](https://github.com/r-lib/pkgbuild/blob/3919d9c997a28e0f61def0ebf4e076ffc69d2466/R/utils.R#L14-L16) returns 32 and that does not match what `R CMD config CC` returns, so the toolchain is not found.\r\n\r\nOptions to remedy this are\r\n\r\n1. Do the stan compilation elsewhere than `install.libs.R` so you don't run into this behavior. You could call a R script from the Makevars file for instance.\r\n2. The 'WARNING' text is actually coming from a [message()](https://github.com/r-lib/pkgbuild/blob/94d2f0da8a49fe9bec5a7f5e9608b7dead959b7c/R/rtools.R#L71-L74), and the compilation works fine even with the messages, so adding `suppressMessages()` around the rstan calls will work as well.\r\n\r\nThe first option is probably the cleanest, but the second is simpler to implement. I checked this approach with win-builder and it fixes the WARNING you have observed, although there seem to be additional test failures unrelated to this problem. I opened a PR with this approach https://github.com/facebook/prophet/pull/776"}}
{"actor":{"display_login":"jimhester"}}