On 06/02/2023 3:46 p.m., Winston Chang wrote:
I recently submitted a package to CRAN with "SystemRequirements: C++11".
This raises the following NOTE on R-devel, and I was asked to fix and
resubmit:
* checking C++ specification ... NOTE
Specified C++11: please update to current default of C++17
If I understand correctly, I have two options, neither of which will work:
1. Remove "SystemRequirements: C++11" entirely. The problem with this is
that on systems with older versions of R (3.6 and below, I believe), it may
try to compile the package with an older C++ standard, which will fail.
2. Update it to "SystemRequirements: C++17". The problem here is that on
systems that don't have a C++17 compiler, the package won't build -- even
though the package only actually requires a C++11 compiler.
How should I deal with this?
After reading the discussion here and the manuals, I think this is how
to do it. I'm assuming your code is compatible with both C++11 and
C++17, but not some earlier standards.
1. In SystemRequirements, state that it needs C++11 or higher. That
field is supposed to be human readable (though I think there are scripts
that try to read it; maybe they will suggest a particular wording to use).
2. Have a configure script (e.g. like the one Ivan posted) that
specifies CXX_STD=CXX11 in Makevars if the R version is less than 4.0.0,
and gives no specification otherwise (because from 4.0.0 onwards, if C++
is available, it will be C++11 or higher).
I think it wouldn't hurt to look through the available versions and pick
from them, but I don't think it's supposed to be necessary.
If it eventually turns out that your code is not compatible with some
later standard, I'm sure CRAN will let you know.
Duncan Murdoch
______________________________________________
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel