Has_devel() getting-started check in Wickham's R Packages book


#1

As a beginner with R packages, I was pleased to discover Hadley Wickham's R Packages book online. All was going well until the bottom of page three where he provides code (copied below) for "checking that you have everything installed". The reader is left on his or her own if they get an error message when running the code (which I did).
Is the problem that my installations of R or R-studio or devtools are in the wrong directories? If I can't get past this step, will I still be able to use/benefit from the rest of his book?
Below, I've copied his code, and then I show the output and error message:

CODE:
library(devtools)
has_devel()
#> '/Library/Frameworks/R.framework/Resources/bin/R' --vanilla CMD SHLIB foo.c
#>
#> clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
#> -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include
#> -fPIC -Wall -mtune=core2 -g -O2 -c foo.c -o foo.o
#> clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup
#> -single_module -multiply_defined suppress -L/usr/local/lib -o foo.so foo.o
#> -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
#> -Wl,CoreFoundation
[1] TRUE

OUTPUT WITH ERROR MESSAGE

has_devel()
"C:/PROGRA~1/R/R-34~1.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD
SHLIB foo.c

Warning message:
running command 'make -f "C:/PROGRA~1/R/R-34~1.1/etc/x64/Makeconf" -f "C:/PROGRA~1/R/R-34~1.1/share/make/winshlib.mk" SHLIB="foo.dll" WIN=64 TCLBIN=64 OBJECTS="foo.o"' had status 127
Error: Command failed (1)​

​​Any help would be appreciated.


#2

Based on the NEWS file in the devtools repo on Github, it appears that the has_devel() function is in the process of moving to a new package -- pkgbuild:

find_rtools(), setup_rtools(), has_devel(), compiler_flags(), build() and with_debug() have moved to the new pkgbuild package. build() and with_debug() are re-exported by devtools.

I just tried running has_devel() myself, and I got an error message also. However, I am pretty sure that I DO have the build environment correctly set up (in my experience, this is mainly installing Rtools as I am on Windows). I have not tried the github versions of the packages.

Jameel


#3

Thanks, Jameel. I'll watch for that package. Meanwhile, from your feedback, it appears safe for me to keep working through the R Packages book--and hopefully when I'd need the RTOOLS installation, the issue will have been sorted out.

Bill


#4

Regardless of how well has_devel() function is working, if you are on Windows and want to do package development, and haven't yet installed Rtools, then you should go ahead and do it!

See here: http://cran.us.r-project.org/bin/windows/Rtools/