[R-pkg-devel] Ongoing CXX17 woes

Tim Keitt tke|tt @end|ng |rom gm@||@com
Fri Aug 6 22:51:37 CEST 2021


Hi Folks,

I have a package that compiles fine under C++11 but it throws an "Error:
C++17 standard requested but CXX17 is not defined" error when checking
under Solaris.

My configure looks like:

#!/bin/sh

# Borrowed from
https://github.com/eddelbuettel/rcppsimdjson/blob/master/configure

: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
    echo Could not determine R_HOME.
    exit 1
fi

CXX17=`${R_HOME}/bin/R CMD config --all | awk '{print $1}' | grep "^CXX17$"`

if test "x${CXX17}" = "x"; then
   sed -e 's/@CXXSTD@/CXX11/' -e 's/@NOCXX17@/-DNO_CXX17/' src/Makevars.in
> src/Makevars
else
   sed -e 's/@CXXSTD@/CXX17/' -e 's/@NOCXX17@//' src/Makevars.in >
src/Makevars
fi

exit 0

If I change the grep match to something nonsensical (forcing c++11), then
the package builds and checks just fine on my machine.

So it seems that there is some checking code that searches for c++17
statements in the package and throws an error. If that is the case, then
those checks should be removed as they cannot account for conditional
compilation. For example, in my vignettes, I have c++17 code but those
chunks are not evaluated if c++17 is not available.

Is the checking code available for inspection? I'd like to find exactly
where the error is coming from.

THK

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list