diff --git a/r/DESCRIPTION b/r/DESCRIPTION index 86ca441263e..34d1f5a9f46 100644 --- a/r/DESCRIPTION +++ b/r/DESCRIPTION @@ -28,7 +28,7 @@ URL: https://github.com/apache/arrow/, https://arrow.apache.org/docs/r/ BugReports: https://github.com/apache/arrow/issues Encoding: UTF-8 Language: en-US -SystemRequirements: C++17; for AWS S3 support on Linux, libcurl and openssl (optional); +SystemRequirements: C++20; for AWS S3 support on Linux, libcurl and openssl (optional); cmake >= 3.26 (build-time only, and only for full source build) Biarch: true Imports: diff --git a/r/README.md b/r/README.md index 1ab9206f119..c5cc647ec6b 100644 --- a/r/README.md +++ b/r/README.md @@ -44,7 +44,7 @@ There are some special cases to note: - On Linux the installation process can sometimes be more involved because CRAN does not host binaries for Linux. For more information please see the [installation guide](https://arrow.apache.org/docs/r/articles/install.html). -- If you are compiling arrow from source, please note that as of version 10.0.0, arrow requires C++17 to build. This has implications on Windows and CentOS 7. For Windows users it means you need to be running an R version of 4.0 or later. On CentOS 7, it means you need to install a newer compiler than the default system compiler gcc. See the [installation details article](https://arrow.apache.org/docs/r/articles/developers/install_details.html) for guidance. +- If you are compiling arrow from source, please note that as of version 22.0.0, arrow requires C++20 to build. This has implications on Windows and CentOS 7. For Windows users it means you need to be running an R version of 4.1 or later. See the [installation details article](https://arrow.apache.org/docs/r/articles/developers/install_details.html) for guidance. - Development versions of arrow are released nightly. For information on how to install nightly builds please see the [installing nightly builds](https://arrow.apache.org/docs/r/articles/install_nightly.html) article. diff --git a/r/configure b/r/configure index f64a3673f97..74f3f359d83 100755 --- a/r/configure +++ b/r/configure @@ -86,10 +86,10 @@ if [ "$ARROW_R_DEV" = "true" ] && [ -f "data-raw/codegen.R" ]; then ${R_HOME}/bin/Rscript data-raw/codegen.R fi -# Arrow requires C++17, so check for it -if [ ! "`${R_HOME}/bin/R CMD config CXX17`" ]; then +# Arrow requires C++20, so check for it +if [ ! "`${R_HOME}/bin/R CMD config CXX20`" ]; then echo "------------------------- NOTE ---------------------------" - echo "Cannot install arrow: a C++17 compiler is required." + echo "Cannot install arrow: a C++20 compiler is required." echo "See https://arrow.apache.org/docs/r/articles/install.html" echo "---------------------------------------------------------" exit 1 @@ -265,7 +265,7 @@ set_pkg_vars () { # match the substring. However, expr always outputs the number of matched characters # to stdout, to avoid noise in the log we redirect the output to /dev/null if [ "$UNAME" = "Darwin" ] && expr $(sw_vers -productVersion) : '10\.13' >/dev/null 2>&1; then - # avoid C++17 availability warnings on macOS < 11 + # avoid C++20 availability warnings on macOS < 11 PKG_CFLAGS="$PKG_CFLAGS -D_LIBCPP_DISABLE_AVAILABILITY" fi } @@ -408,11 +408,11 @@ else fi # Test that we can compile something with those flags -CXX17="`${R_HOME}/bin/R CMD config CXX17` -E" -CXX17FLAGS=`"${R_HOME}"/bin/R CMD config CXX17FLAGS` -CXX17STD=`"${R_HOME}"/bin/R CMD config CXX17STD` +CXX20="`${R_HOME}/bin/R CMD config CXX20` -E" +CXX20FLAGS=`"${R_HOME}"/bin/R CMD config CXX20FLAGS` +CXX20STD=`"${R_HOME}"/bin/R CMD config CXX20STD` CPPFLAGS=`"${R_HOME}"/bin/R CMD config CPPFLAGS` -TEST_CMD="${CXX17} ${CPPFLAGS} ${PKG_CFLAGS} ${CXX17FLAGS} ${CXX17STD} -xc++ -" +TEST_CMD="${CXX20} ${CPPFLAGS} ${PKG_CFLAGS} ${CXX20FLAGS} ${CXX20STD} -xc++ -" TEST_ERROR=$(echo "#include $PKG_TEST_HEADER" | ${TEST_CMD} -o /dev/null 2>&1) if [ $? -eq 0 ]; then diff --git a/r/configure.win b/r/configure.win index 433ef28439a..50d3e70081d 100755 --- a/r/configure.win +++ b/r/configure.win @@ -122,7 +122,7 @@ set_pkg_vars () { # match the substring. However, expr always outputs the number of matched characters # to stdout, to avoid noise in the log we redirect the output to /dev/null if [ "$UNAME" = "Darwin" ] && expr $(sw_vers -productVersion) : '10\.13' >/dev/null 2>&1; then - # avoid C++17 availability warnings on macOS < 11 + # avoid C++20 availability warnings on macOS < 11 PKG_CFLAGS="$PKG_CFLAGS -D_LIBCPP_DISABLE_AVAILABILITY" fi } diff --git a/r/src/Makevars.in b/r/src/Makevars.in index af0826faacb..1b7ad08e1cb 100644 --- a/r/src/Makevars.in +++ b/r/src/Makevars.in @@ -25,7 +25,7 @@ PKG_CPPFLAGS=@cflags@ # https://bugs.llvm.org/show_bug.cgi?id=39191 # https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg534862.html # PKG_CXXFLAGS=$(CXX_VISIBILITY) -CXX_STD=CXX17 +CXX_STD=CXX20 PKG_LIBS=@libs@ all: $(SHLIB) purify diff --git a/r/src/Makevars.ucrt b/r/src/Makevars.ucrt index a91dedc2d55..b72ed64d98e 100644 --- a/r/src/Makevars.ucrt +++ b/r/src/Makevars.ucrt @@ -19,4 +19,4 @@ CRT=-ucrt include Makevars.win # XXX for some reason, this variable doesn't seem propagated from Makevars.win -CXX_STD=CXX17 +CXX_STD=CXX20 diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 9d0a2604682..f4ccb4956a8 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -310,11 +310,11 @@ compile_test_program <- function(code) { openssl_dir <- paste0("-I", openssl_root_dir, "/include") } runner <- paste( - R_CMD_config("CXX17"), + R_CMD_config("CXX20"), openssl_dir, R_CMD_config("CPPFLAGS"), - R_CMD_config("CXX17FLAGS"), - R_CMD_config("CXX17STD"), + R_CMD_config("CXX20FLAGS"), + R_CMD_config("CXX20STD"), "-E", "-xc++" ) @@ -565,8 +565,11 @@ build_libarrow <- function(src_dir, dst_dir) { # is found, it will be used by the libarrow build, and this does # not affect how R compiles the arrow bindings. CC = sub("^.*ccache", "", R_CMD_config("CC")), - CXX = paste(sub("^.*ccache", "", R_CMD_config("CXX17")), R_CMD_config("CXX17STD")), - # CXXFLAGS = R_CMD_config("CXX17FLAGS"), # We don't want the same debug symbols + CXX = paste( + sub("^.*ccache", "", R_CMD_config("CXX20")), + R_CMD_config("CXX20STD") + ), + # CXXFLAGS = R_CMD_config("CXX20FLAGS"), # We don't want the same debug symbols LDFLAGS = R_CMD_config("LDFLAGS"), N_JOBS = ncores ) diff --git a/r/vignettes/install.Rmd b/r/vignettes/install.Rmd index 69780bd64df..d9cdcc3885c 100644 --- a/r/vignettes/install.Rmd +++ b/r/vignettes/install.Rmd @@ -23,8 +23,8 @@ but there are a few things to note. ### Compilers -As of version 10.0.0, arrow requires a C++17 compiler to build. -For `gcc`, this generally means version 7 or newer. Most contemporary Linux +As of version 22.0.0, arrow requires a C++20 compiler to build. +For `gcc`, this generally means version 10 or newer. Most contemporary Linux distributions have a new enough compiler; however, CentOS 7 is a notable exception, as it ships with gcc 4.8.