[R-pkg-devel] How to update "SystemRequirements: C++11"?

Winston Chang w|n@tonch@ng1 @end|ng |rom gm@||@com
Wed Feb 8 15:35:08 CET 2023


>
> Now that I think about it some more, I think I can do the following:
>
> 1. In the DESCRIPTION file, remove "SystemRequirements: C++11". I believe
> this field is used only for R CMD check, not for actually installing
> packages. CRAN only runs R CMD check on r-oldrel, r-release, and r-devel,
> and all of those versions (4.1, 4.2, and 4.3) have C++11. For older
> versions of R, the package might not pass R CMD check, but it will still
> install (provided there's a C++11 compiler).
>
> 2. In my case, I think I can skip the configure script. This is because I
> also have GNU Make as a requirement, and it allows you to conditionally set
> the CXX_STD variable only when R < 4.0, by putting this in the Makevars
> file:
>
> R_VERSION=$(shell $(R_HOME)/bin/Rscript --vanilla -e 'if (getRversion()<4)
> cat("lt4") else cat("ge4")')
> ifeq ($(R_VERSION), lt4)
> CXX_STD=CXX11
> endif
>
>
I found that this strategy doesn't work. It turns out that R detects the
C++ version by simply grepping for CXX_STD in  the Makevars file, so even
with my fancy ifeq() statement, it still thinks that the package uses C++11.

So now my plan is to simply remove "CXX_STD" from Makevars and
"SystemRequirements: C++11" from DESCRIPTION. My understanding is that this
will cause the package to no longer build on R 3.5, but as of R 3.6.2,
C++11 became the default, so it should build on that version of R or higher.

-Winston

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list