I am unable to run the hello world Rcpp example or build the template R-package
Rcpp:
> library(Rcpp)
>hello <- function() {
+ print("Hello, world!")
+ }
> cppFunction('int add(int x, int y, int z) {
+ int sum = x + y + z;
+ return sum;
+ }')
make: *** No rule to make target 'file32c873a03529.o', needed by 'sourceCpp_2.dll'. Stop.
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error 1 occurred building shared library.
building sample package:
devtools::build()
√ checking for file 'D:\Documents\git_repos\testbuild/DESCRIPTION' (364ms)
- preparing 'testbuild':
√ checking DESCRIPTION meta-information ...
- checking for LF line-endings in source and make files and shell scripts
- checking for empty or unneeded directories
- building 'testbuild_0.1.0.tar.gz'
character(0)
...and 'testbuild_0.1.0.tar.gz' does not exist.
Checks:
> Sys.which("make")
make
"C:\\rtools40\\usr\\bin\\make.exe"
> devtools::find_rtools(debug = TRUE)
[1] TRUE
> pkgbuild::find_rtools(debug = TRUE)
[1] TRUE
> pkgbuild::check_rtools(debug = TRUE)
[1] TRUE
> pkgbuild::rtools_path()
[1] "C:\\rtools40/usr/bin"
> pkgbuild::has_build_tools(debug = TRUE)
[1] TRUE
**> .Call("rs_canBuildCpp")**
**[1] FALSE**
Works:
install.packages("jsonlite", type="source")
installing to C:/Program Files/R/R-4.0.2/library/00LOCK-jsonlite/00new/jsonlite/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'jsonlite'
finding HTML links ... done
base64 html
flatten html
fromJSON html
prettify html
rbind_pages html
read_json html
serializeJSON html
stream_in html
unbox html
validate html
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (jsonlite)
I am appending rtools to the path through .Renviron:
PATH="${RTOOLS40_HOME}\usr\bin;${RTOOLS40_HOME}\mingw64\bin\;${PATH}"
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] rstudioapi_0.11 magrittr_1.5 usethis_1.6.1 devtools_2.3.0 pkgload_1.1.0 R6_2.4.1 rlang_0.4.7 fansi_0.4.1 tools_4.0.2
[10] pkgbuild_1.1.0 sessioninfo_1.1.1 cli_2.0.2 withr_2.2.0 ellipsis_0.3.1 remotes_2.1.1 assertthat_0.2.1 digest_0.6.25 rprojroot_1.3-2
[19] crayon_1.3.4 processx_3.4.3 callr_3.4.3 fs_1.4.2 ps_1.3.3 testthat_2.3.2 memoise_1.1.0 glue_1.4.1 compiler_4.0.2
[28] desc_1.2.0 backports_1.1.8 prettyunits_1.1.1
Any help is much appreciated.