This is an automated email from the ASF dual-hosted git repository.

assignuser pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 928827515b GH-32292: [R][Packaging] Use binaries built on CentOS 7 for 
Ubuntu < 22.04 (#34048)
928827515b is described below

commit 928827515bfbd99060d04ccb754646a76a20f7ec
Author: Sutou Kouhei <[email protected]>
AuthorDate: Wed Mar 22 12:40:51 2023 +0900

    GH-32292: [R][Packaging] Use binaries built on CentOS 7 for Ubuntu < 22.04 
(#34048)
    
    ### Rationale for this change
    
    Binaries built on CentOS 7 uses `_GLIBCXX_USE_CXX11_ABI=0`. So we can't use 
them on Ubuntu 20.04 because
    Ubuntu 20.04 uses `_GLIBCXX_USE_CXX11_ABI=1`. If we use them on Ubuntu 
20.04, our R package must use
    `_GLIBCXX_USE_CXX11_ABI=0` too.
    
    There is another problem for Ubuntu 20.04. CentOS 7 uses OpenSSL 1.0 but 
Ubuntu 20.04 uses OpenSSL 1.1.
    OpenSSL 1.0 and 1.1 are incompatible. So we can't use binaries built on 
CentOS 7. We need binaries for OpenSSL
    1.0 and OpenSSL 1.1. We can't use the same binaries on CentOS 7 (OpenSSL 
1.0) and Ubuntu 20.04 (OpenSSL 1.1).
    
    ### What changes are included in this PR?
    
    This changes add `-D_GLIBCXX_USE_CXX11_ABI=0` to `Cflags` in `arrow.pc`. 
Our R package uses `Cflags` in
    `arrow.pc`. So users don't need to specify `-D_GLIBCXX_USE_CXX11_ABI=0` 
explicitly.
    
    This changes replace binaries built on Ubuntu 18.04 with binaries built on 
CentOS 7 with OpenSSL 1.1.
    (The "ubuntu-18.04" binaries are replaced with the "linux-openssl-1.1" 
binaries.)
    
    The "centos-7" binaries are renamed to the "linux-openssl-1.0" binaries.
    
    The "ubuntu-22.04" binaries are renamed to the "linux-openssl-3.0" binaries.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    No.
    
    * Closes: GH-33091
    * Closes: #32292
    
    Authored-by: Sutou Kouhei <[email protected]>
    Signed-off-by: Jacob Wujciak-Jens <[email protected]>
---
 ci/docker/centos-7-cpp.dockerfile           | 39 +++++++++++----------
 cpp/CMakeLists.txt                          |  1 +
 cpp/cmake_modules/ThirdpartyToolchain.cmake | 53 ++++++++++++++++++-----------
 cpp/src/arrow/CMakeLists.txt                | 20 +++++++++--
 dev/tasks/macros.jinja                      |  8 ++---
 dev/tasks/r/github.packages.yml             | 27 +++++++++------
 dev/tasks/tasks.yml                         |  6 ++--
 docker-compose.yml                          |  2 +-
 r/configure                                 |  3 ++
 r/tools/nixlibs.R                           | 48 ++++++++++++--------------
 r/tools/test-nixlibs.R                      | 34 ++++++++++++------
 r/vignettes/developers/setup.Rmd            |  8 ++---
 r/vignettes/install.Rmd                     |  4 +--
 13 files changed, 151 insertions(+), 102 deletions(-)

diff --git a/ci/docker/centos-7-cpp.dockerfile 
b/ci/docker/centos-7-cpp.dockerfile
index f4e0430aad..8c1893cbbb 100644
--- a/ci/docker/centos-7-cpp.dockerfile
+++ b/ci/docker/centos-7-cpp.dockerfile
@@ -17,28 +17,27 @@
 
 FROM centos:centos7
 
-RUN yum install -y \
-  centos-release-scl \
-  curl \
-  diffutils \
-  gcc-c++ \
-  libcurl-devel \
-  make \
-  openssl-devel \
-  wget \
-  which
-
 # devtoolset is required for C++17
-RUN yum install -y devtoolset-8
-
-# yum install cmake version is too old
-ARG cmake=3.23.1
-RUN mkdir /opt/cmake-${cmake}
-RUN wget -nv -O - 
https://github.com/Kitware/CMake/releases/download/v${cmake}/cmake-${cmake}-Linux-x86_64.tar.gz
 | \
-  tar -xzf -  --strip-components=1 -C /opt/cmake-${cmake}
+RUN \
+  yum install -y \
+    centos-release-scl \
+    epel-release && \
+  yum install -y \
+    cmake3 \
+    curl \
+    devtoolset-8 \
+    diffutils \
+    gcc-c++ \
+    libcurl-devel \
+    make \
+    openssl-devel \
+    openssl11-devel \
+    wget \
+    which
 
 COPY ci/scripts/install_sccache.sh /arrow/ci/scripts/
 RUN bash /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin
 
-ENV PATH=/opt/cmake-${cmake}/bin:$PATH \
-  ARROW_R_DEV=TRUE 
+ENV \
+  ARROW_R_DEV=TRUE \
+  CMAKE=/usr/bin/cmake3
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index 14de0cd496..b6d18cd39f 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -491,6 +491,7 @@ enable_testing()
 
 # For arrow.pc. Cflags.private, Libs.private and Requires.private are
 # used when "pkg-config --cflags --libs --static arrow" is used.
+set(ARROW_PC_CFLAGS "")
 set(ARROW_PC_CFLAGS_PRIVATE " -DARROW_STATIC")
 set(ARROW_PC_LIBS_PRIVATE "")
 set(ARROW_PC_REQUIRES_PRIVATE "")
diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake 
b/cpp/cmake_modules/ThirdpartyToolchain.cmake
index 8b7e62b734..2232177dd9 100644
--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake
+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake
@@ -3872,7 +3872,11 @@ macro(build_grpc)
       "${EP_COMMON_CMAKE_ARGS}"
       "-DCMAKE_C_FLAGS=${GRPC_C_FLAGS}"
       "-DCMAKE_CXX_FLAGS=${GRPC_CXX_FLAGS}"
+      -DCMAKE_INSTALL_PREFIX=${GRPC_PREFIX}
       -DCMAKE_PREFIX_PATH='${GRPC_PREFIX_PATH_ALT_SEP}'
+      -DOPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}
+      -DOPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR}
+      -DOPENSSL_SSL_LIBRARY=${OPENSSL_SSL_LIBRARY}
       -DgRPC_ABSL_PROVIDER=package
       -DgRPC_BUILD_CSHARP_EXT=OFF
       -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF
@@ -3888,14 +3892,10 @@ macro(build_grpc)
       -DgRPC_PROTOBUF_PROVIDER=package
       -DgRPC_RE2_PROVIDER=package
       -DgRPC_SSL_PROVIDER=package
-      -DgRPC_ZLIB_PROVIDER=package
-      -DCMAKE_INSTALL_PREFIX=${GRPC_PREFIX})
+      -DgRPC_ZLIB_PROVIDER=package)
   if(PROTOBUF_VENDORED)
     list(APPEND GRPC_CMAKE_ARGS -DgRPC_PROTOBUF_PACKAGE_TYPE=CONFIG)
   endif()
-  if(OPENSSL_ROOT_DIR)
-    list(APPEND GRPC_CMAKE_ARGS -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR})
-  endif()
 
   # XXX the gRPC git checkout is huge and takes a long time
   # Ideally, we should be able to use the tarballs, but they don't contain
@@ -4224,10 +4224,10 @@ macro(build_google_cloud_cpp_storage)
       -DGOOGLE_CLOUD_CPP_ENABLE=storage
       # We need this to build with OpenSSL 3.0.
       # See also: https://github.com/googleapis/google-cloud-cpp/issues/8544
-      -DGOOGLE_CLOUD_CPP_ENABLE_WERROR=OFF)
-  if(OPENSSL_ROOT_DIR)
-    list(APPEND GOOGLE_CLOUD_CPP_CMAKE_ARGS 
-DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_DIR})
-  endif()
+      -DGOOGLE_CLOUD_CPP_ENABLE_WERROR=OFF
+      -DOPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}
+      -DOPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR}
+      -DOPENSSL_SSL_LIBRARY=${OPENSSL_SSL_LIBRARY})
 
   add_custom_target(google_cloud_cpp_dependencies)
 
@@ -4729,16 +4729,25 @@ macro(build_awssdk)
     set(AWSSDK_BUILD_TYPE release)
   endif()
 
-  # provide hint for AWS SDK to link with the already located openssl
-  get_filename_component(OPENSSL_ROOT_HINT "${OPENSSL_INCLUDE_DIR}" DIRECTORY)
   set(AWSSDK_COMMON_CMAKE_ARGS
       ${EP_COMMON_CMAKE_ARGS}
       -DCMAKE_BUILD_TYPE=${AWSSDK_BUILD_TYPE}
       -DCMAKE_INSTALL_PREFIX=${AWSSDK_PREFIX}
-      -DCMAKE_PREFIX_PATH=${AWSSDK_PREFIX}\\$<SEMICOLON>${OPENSSL_ROOT_HINT}
+      -DCMAKE_PREFIX_PATH=${AWSSDK_PREFIX}
       -DENABLE_TESTING=OFF
       -DENABLE_UNITY_BUILD=ON
-      -DOPENSSL_ROOT_DIR=${OPENSSL_ROOT_HINT})
+      -DOPENSSL_CRYPTO_LIBRARY=${OPENSSL_CRYPTO_LIBRARY}
+      -DOPENSSL_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR}
+      -DOPENSSL_SSL_LIBRARY=${OPENSSL_SSL_LIBRARY}
+      -Dcrypto_INCLUDE_DIR=${OPENSSL_INCLUDE_DIR}
+      -Dcrypto_LIBRARY=${OPENSSL_CRYPTO_LIBRARY})
+  if(ARROW_OPENSSL_USE_SHARED)
+    list(APPEND AWSSDK_COMMON_CMAKE_ARGS
+         -Dcrypto_SHARED_LIBRARY=${OPENSSL_CRYPTO_LIBRARY})
+  else()
+    list(APPEND AWSSDK_COMMON_CMAKE_ARGS
+         -Dcrypto_STATIC_LIBRARY=${OPENSSL_CRYPTO_LIBRARY})
+  endif()
   set(AWSSDK_CMAKE_ARGS
       ${AWSSDK_COMMON_CMAKE_ARGS}
       -DBUILD_DEPS=OFF
@@ -4754,10 +4763,10 @@ macro(build_awssdk)
     # provide hint for AWS SDK to link with the already located libcurl and 
zlib
     list(APPEND
          AWSSDK_CMAKE_ARGS
-         -DCURL_LIBRARY=${CURL_ROOT_HINT}/lib
          -DCURL_INCLUDE_DIR=${CURL_ROOT_HINT}/include
-         -DZLIB_LIBRARY=${ZLIB_ROOT_HINT}/lib
-         -DZLIB_INCLUDE_DIR=${ZLIB_ROOT_HINT}/include)
+         -DCURL_LIBRARY=${CURL_ROOT_HINT}/lib
+         -DZLIB_INCLUDE_DIR=${ZLIB_ROOT_HINT}/include
+         -DZLIB_LIBRARY=${ZLIB_ROOT_HINT}/lib)
   endif()
 
   file(MAKE_DIRECTORY ${AWSSDK_INCLUDE_DIR})
@@ -4879,9 +4888,15 @@ macro(build_awssdk)
     set(S2N_TLS_CMAKE_ARGS ${AWSSDK_COMMON_CMAKE_ARGS})
     list(APPEND
          S2N_TLS_CMAKE_ARGS
-         -DS2N_INTERN_LIBCRYPTO=ON # internalize libcrypto to avoid name 
conflict with openssl
-         -DCMAKE_PREFIX_PATH=${AWS_LC_PREFIX} # path to find crypto provided 
by aws-lc
-         -DCMAKE_C_FLAGS=${S2N_TLS_C_FLAGS})
+         # internalize libcrypto to avoid name conflict with OpenSSL
+         -DS2N_INTERN_LIBCRYPTO=ON
+         # path to find crypto provided by aws-lc
+         -DCMAKE_PREFIX_PATH=${AWS_LC_PREFIX}
+         -DCMAKE_C_FLAGS=${S2N_TLS_C_FLAGS}
+         # paths to find crypto provided by aws-lc
+         -Dcrypto_INCLUDE_DIR=${AWS_LC_PREFIX}/include
+         -Dcrypto_LIBRARY=${AWS_LC_STATIC_LIBRARY}
+         -Dcrypto_STATIC_LIBRARY=${AWS_LC_STATIC_LIBRARY})
 
     externalproject_add(s2n_tls_ep
                         ${EP_COMMON_OPTIONS}
diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt
index 28f37af9bf..a3e9f7c733 100644
--- a/cpp/src/arrow/CMakeLists.txt
+++ b/cpp/src/arrow/CMakeLists.txt
@@ -601,6 +601,23 @@ if(ARROW_BUILD_BUNDLED_DEPENDENCIES)
   string(APPEND ARROW_PC_LIBS_PRIVATE " -larrow_bundled_dependencies")
   list(INSERT ARROW_STATIC_INSTALL_INTERFACE_LIBS 0 
"Arrow::arrow_bundled_dependencies")
 endif()
+
+if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+  set(GLIBCXX_USE_CXX11_ABI_SOURCE
+      ${CMAKE_CURRENT_BINARY_DIR}/try_compile_glibcxx_use_cxx_abi.cc)
+  file(WRITE ${GLIBCXX_USE_CXX11_ABI_SOURCE}
+       "#include <string>\n"
+       "#if !_GLIBCXX_USE_CXX11_ABI\n"
+       "#error Not using CXX11 ABI\n"
+       "#endif\n"
+       "int main(void) {return 0;}\n")
+  try_compile(IS_GLIBCXX_USE_CXX11_ABI ${CMAKE_CURRENT_BINARY_DIR}/try_compile
+              SOURCES ${GLIBCXX_USE_CXX11_ABI_SOURCE})
+  if(NOT IS_GLIBCXX_USE_CXX11_ABI)
+    string(APPEND ARROW_PC_CFLAGS " -D_GLIBCXX_USE_CXX11_ABI=0")
+  endif()
+endif()
+
 # Need -latomic on Raspbian.
 # See also: https://issues.apache.org/jira/browse/ARROW-12860
 if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES 
"armv7")
@@ -614,7 +631,7 @@ endif()
 # linking. ARROW_PC_* except ARROW_PC_*_PRIVATE are for the static
 # linking case.
 if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC)
-  set(ARROW_PC_CFLAGS "${ARROW_PC_CFLAGS_PRIVATE}")
+  string(APPEND ARROW_PC_CFLAGS "${ARROW_PC_CFLAGS_PRIVATE}")
   set(ARROW_PC_CFLAGS_PRIVATE "")
   set(ARROW_PC_LIBS "${ARROW_PC_LIBS_PRIVATE}")
   set(ARROW_PC_LIBS_PRIVATE "")
@@ -624,7 +641,6 @@ if(NOT ARROW_BUILD_SHARED AND ARROW_BUILD_STATIC)
   string(APPEND ARROW_TESTING_PC_CFLAGS "${ARROW_TESTING_PC_CFLAGS_PRIVATE}")
   set(ARROW_TESTING_PC_CFLAGS_PRIVATE "")
 else()
-  set(ARROW_PC_CFLAGS "")
   set(ARROW_PC_LIBS "")
   set(ARROW_PC_REQUIRES "")
 endif()
diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja
index 9cb0c0f8a8..8eedb97163 100644
--- a/dev/tasks/macros.jinja
+++ b/dev/tasks/macros.jinja
@@ -320,12 +320,12 @@ on:
       path: repo/libarrow/bin/windows
   {% endif %}
   {% if get_nix %}
-    {% for os in ["ubuntu-18.04", "ubuntu-22.04", "centos-7"] %}
-  - name: Get {{ os }} binary
+    {% for openssl_version in ["1.0", "1.1", "3.0"] %}
+  - name: Get Linux OpenSSL {{ openssl_version }} binary
     uses: actions/download-artifact@v3
     with:
-      name: r-lib__libarrow__bin__{{ os }}
-      path: repo/libarrow/bin/{{ os }}
+      name: r-lib__libarrow__bin__linux-openssl-{{ openssl_version }}
+      path: repo/libarrow/bin/linux-openssl-{{ openssl_version }}
     {% endfor %}
   {% endif %}
   - name: Get src pkg
diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml
index b02fc0ade5..1ecacb0575 100644
--- a/dev/tasks/r/github.packages.yml
+++ b/dev/tasks/r/github.packages.yml
@@ -57,18 +57,23 @@ jobs:
           path: arrow/r/arrow_*.tar.gz
 
   linux-cpp:
-    name: C++ Binary {{ '${{ matrix.config.os }}-${{ matrix.config.version }}' 
}}
+    name: C++ Binary Linux OpenSSL {{ '${{ matrix.openssl }}' }}
     runs-on: ubuntu-latest
     needs: source
     strategy:
       fail-fast: false
       matrix:
-        config:
-          - { os: ubuntu, version: "18.04" }
-          - { os: ubuntu, version: "22.04" }
-          - { os: centos, version: "7" }
-    env:
-      UBUNTU: {{ '${{ matrix.config.version }}' }}
+        include:
+          - openssl: "3.0"
+            os: ubuntu
+            ubuntu: "22.04"
+          - extra-cmake-flags: >-
+              -DCMAKE_INCLUDE_PATH=/usr/include/openssl11
+              -DCMAKE_LIBRARY_PATH=/usr/lib64/openssl11
+            openssl: "1.1"
+            os: centos
+          - openssl: "1.0"
+            os: centos
     steps:
       {{ macros.github_checkout_arrow()|indent }}
       {{ macros.github_change_r_pkg_version(is_fork, '${{ 
needs.source.outputs.pkg_version }}')|indent }}
@@ -77,12 +82,14 @@ jobs:
       - name: Build libarrow
         shell: bash
         env:
-          UBUNTU: {{ '"${{ matrix.config.version }}"' }}
+          UBUNTU: {{ '"${{ matrix.ubuntu }}"' }}
         {{ macros.github_set_sccache_envvars()|indent(8) }}
         run: |
           sudo sysctl -w kernel.core_pattern="core.%e.%p"
           ulimit -c unlimited
-          archery docker run  {{ '${{ matrix.config.os}}' }}-cpp-static
+          archery docker run \
+            -e EXTRA_CMAKE_FLAGS="{{ '${{ matrix.extra-cmake-flags }}' }}" \
+            {{ '${{ matrix.os }}' }}-cpp-static
       - name: Bundle libarrow
         shell: bash
         env:
@@ -96,7 +103,7 @@ jobs:
       - name: Upload binary artifact
         uses: actions/upload-artifact@v3
         with:
-          name: r-lib__libarrow__bin__{{ '${{ matrix.config.os}}-${{ 
matrix.config.version}}' }}
+          name: r-lib__libarrow__bin__linux-openssl-{{ '${{ matrix.openssl }}' 
}}
           path: arrow/r/libarrow/dist/arrow-*.zip
 
   windows-cpp:
diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml
index b345bcd48e..f387fdbf94 100644
--- a/dev/tasks/tasks.yml
+++ b/dev/tasks/tasks.yml
@@ -989,9 +989,9 @@ tasks:
       custom_version: Unset
     artifacts:
       - r-lib__libarrow__bin__windows__arrow-{no_rc_r_version}\.zip
-      - r-lib__libarrow__bin__centos-7__arrow-{no_rc_r_version}\.zip
-      - r-lib__libarrow__bin__ubuntu-18.04__arrow-{no_rc_r_version}\.zip
-      - r-lib__libarrow__bin__ubuntu-22.04__arrow-{no_rc_r_version}\.zip
+      - r-lib__libarrow__bin__linux-openssl-1.0__arrow-{no_rc_r_version}\.zip
+      - r-lib__libarrow__bin__linux-openssl-1.1__arrow-{no_rc_r_version}\.zip
+      - r-lib__libarrow__bin__linux-openssl-3.0__arrow-{no_rc_r_version}\.zip
       - r-pkg__bin__windows__contrib__4.1__arrow_{no_rc_r_version}\.zip
       - r-pkg__bin__windows__contrib__4.2__arrow_{no_rc_r_version}\.zip
       - r-pkg__bin__macosx__contrib__4.1__arrow_{no_rc_r_version}\.tgz
diff --git a/docker-compose.yml b/docker-compose.yml
index 1914b50c64..38a22e23d6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -443,7 +443,7 @@ services:
       ARROW_DEPENDENCY_SOURCE: BUNDLED
       ARROW_HOME: /arrow
       LIBARROW_MINIMAL: "false"
-    command: /bin/bash -c " 
+    command: /bin/bash -c "
           scl enable devtoolset-8 '/arrow/r/inst/build_arrow_static.sh'"
 
   ubuntu-cpp-bundled:
diff --git a/r/configure b/r/configure
index 05ff4ae93c..dc0e8e6319 100755
--- a/r/configure
+++ b/r/configure
@@ -211,6 +211,9 @@ else
         else
           # This case must be ARROW_DEPENDENCY_SOURCE=BUNDLED.
           PKG_CFLAGS="-I${LIB_DIR}/../include $PKG_CFLAGS"
+          if grep -q "_GLIBCXX_USE_CXX11_ABI=0" 
"${LIB_DIR}/pkgconfig/arrow.pc"; then
+            PKG_CFLAGS="${PKG_CFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0"
+          fi
           PKG_DIRS="-L${LIB_DIR}"
           if [ "${OPENSSL_ROOT_DIR}" != "" ]; then
             PKG_DIRS="${PKG_DIRS} -L${OPENSSL_ROOT_DIR}/lib"
diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index 3d9edf0368..b1af28272a 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -96,12 +96,13 @@ download_binary <- function(lib) {
 # of action based on the current system. Other values you can set it to:
 # * "FALSE" (not case-sensitive), to skip this option altogether
 # * "TRUE" (not case-sensitive), to try to discover your current OS, or
-# * Some other string: a "distro-version" that corresponds to a binary that is
-#   available, to override what this function may discover by default.
+# * Some other string: a "linux-openssl-${OPENSSL_VERSION}" that corresponds to
+#   a binary that is available, to override what this function may discover by
+#   default.
 #   Possible values are:
-#    * "centos-7" (gcc 8 (devtoolset), openssl 1, glib 2.17)
-#    * "ubuntu-18.04" (gcc 8, openssl 1, glib 2.27)
-#    * "ubuntu-22.04" (openssl 3)
+#    * "linux-openssl-1.0" (OpenSSL 1.0)
+#    * "linux-openssl-1.1" (OpenSSL 1.1)
+#    * "linux-openssl-3.0" (OpenSSL 3.0)
 #   These string values, along with `NULL`, are the potential return values of
 #   this function.
 identify_binary <- function(lib = Sys.getenv("LIBARROW_BINARY"), info = 
distro()) {
@@ -160,7 +161,7 @@ select_binary <- function(os = 
tolower(Sys.info()[["sysname"]]),
   }
 }
 
-# This tests that curl and openssl are present (bc we can include their 
headers)
+# This tests that curl and OpenSSL are present (bc we can include their 
headers)
 # and it checks for other versions/features and raises errors that we grep for
 test_for_curl_and_openssl <- "
 #include <ciso646>
@@ -168,15 +169,14 @@ test_for_curl_and_openssl <- "
 #error Using libc++
 #endif
 
-#if !( __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 27)
-#error glibc version too old
-#endif
-
 #include <curl/curl.h>
 #include <openssl/opensslv.h>
 #if OPENSSL_VERSION_NUMBER < 0x10002000L
 #error OpenSSL version too old
 #endif
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#error Using OpenSSL version 1.0
+#endif
 #if OPENSSL_VERSION_NUMBER >= 0x30000000L
 #error Using OpenSSL version 3
 #endif
@@ -190,14 +190,13 @@ compile_test_program <- function(code) {
   suppressWarnings(system2("echo", sprintf('"%s" | %s -', code, runner), 
stdout = FALSE, stderr = TRUE))
 }
 
-# TODO(ARROW-16976): drop "ubuntu-18.04" and just use "centos-7"
 # (built with newer devtoolset but older glibc (2.17) for broader 
compatibility,# like manylinux2014)
 determine_binary_from_stderr <- function(errs) {
   if (is.null(attr(errs, "status"))) {
-    # There was no error in compiling: so we found libcurl and openssl > 1.0.2,
-    # openssl is < 3.0, glibc is >= 2.27, and we're not using a strict libc++
-    cat("*** Found libcurl and openssl >= 1.0.2\n")
-    return("ubuntu-18.04")
+    # There was no error in compiling: so we found libcurl and OpenSSL >= 1.1,
+    # openssl is < 3.0
+    cat("*** Found libcurl and OpenSSL >= 1.1\n")
+    return("linux-openssl-1.1")
     # Else, check for dealbreakers:
   } else if (any(grepl("Using libc++", errs, fixed = TRUE))) {
     # Our binaries are all built with GNU stdlib so they fail with libc++
@@ -207,23 +206,18 @@ determine_binary_from_stderr <- function(errs) {
     cat("*** libcurl not found\n")
     return(NULL)
   } else if (header_not_found("openssl/opensslv", errs)) {
-    cat("*** openssl not found\n")
+    cat("*** OpenSSL not found\n")
     return(NULL)
   } else if (any(grepl("OpenSSL version too old", errs))) {
-    cat("*** openssl found but version >= 1.0.2 is required for some 
features\n")
+    cat("*** OpenSSL found but version >= 1.0.2 is required for some 
features\n")
     return(NULL)
     # Else, determine which other binary will work
-  } else if (any(grepl("glibc version too old", errs))) {
-    # ubuntu-18.04 has glibc 2.27, so even if you install newer compilers
-    # (e.g. devtoolset on centos) and have curl/openssl, you run into problems
-    # TODO(ARROW-16976): build binaries with older glibc
-    cat("*** Checking glibc version\n")
-    # If we're here, we're on an older OS but with a new enough compiler
-    # (e.g. CentOS 7 with devtoolset-8)
-    return("centos-7")
+  } else if (any(grepl("Using OpenSSL version 1.0", errs))) {
+    cat("*** Found libcurl and OpenSSL < 1.1\n")
+    return("linux-openssl-1.0")
   } else if (any(grepl("Using OpenSSL version 3", errs))) {
-    cat("*** Found libcurl and openssl >= 3.0.0\n")
-    return("ubuntu-22.04")
+    cat("*** Found libcurl and OpenSSL >= 3.0.0\n")
+    return("linux-openssl-3.0")
   }
   NULL
 }
diff --git a/r/tools/test-nixlibs.R b/r/tools/test-nixlibs.R
index 631ff7a3e3..e099dcdad4 100644
--- a/r/tools/test-nixlibs.R
+++ b/r/tools/test-nixlibs.R
@@ -26,7 +26,7 @@ source("nixlibs.R", local = TRUE)
 
 test_that("identify_binary() based on LIBARROW_BINARY", {
   expect_null(identify_binary("FALSE"))
-  expect_identical(identify_binary("ubuntu-18.04"), "ubuntu-18.04")
+  expect_identical(identify_binary("linux-openssl-1.0"), "linux-openssl-1.0")
   expect_null(identify_binary("", info = list(id = "debian")))
 })
 
@@ -52,22 +52,29 @@ test_that("determine_binary_from_stderr", {
   expect_output(
     expect_identical(
       determine_binary_from_stderr(compile_test_program("int a;")),
-      "ubuntu-18.04"
+      "linux-openssl-1.1"
     ),
-    "Found libcurl and openssl >= 1.0.2"
+    "Found libcurl and OpenSSL >= 1.1"
+  )
+  expect_output(
+    expect_identical(
+      determine_binary_from_stderr(compile_test_program("#error Using OpenSSL 
version 1.0")),
+      "linux-openssl-1.0"
+    ),
+    "Found libcurl and OpenSSL < 1.1"
   )
   expect_output(
     expect_identical(
       determine_binary_from_stderr(compile_test_program("#error Using OpenSSL 
version 3")),
-      "ubuntu-22.04"
+      "linux-openssl-3.0"
     ),
-    "Found libcurl and openssl >= 3.0.0"
+    "Found libcurl and OpenSSL >= 3.0.0"
   )
   expect_output(
     expect_null(
       determine_binary_from_stderr(compile_test_program("#error OpenSSL 
version too old"))
     ),
-    "openssl found but version >= 1.0.2 is required for some features"
+    "OpenSSL found but version >= 1.0.2 is required for some features"
   )
 })
 
@@ -75,16 +82,23 @@ test_that("select_binary() with test program", {
   expect_output(
     expect_identical(
       select_binary("linux", "x86_64", "int a;"),
-      "ubuntu-18.04"
+      "linux-openssl-1.1"
+    ),
+    "Found libcurl and OpenSSL >= 1.1"
+  )
+  expect_output(
+    expect_identical(
+      select_binary("linux", "x86_64", "#error Using OpenSSL version 1.0"),
+      "linux-openssl-1.0"
     ),
-    "Found libcurl and openssl >= 1.0.2"
+    "Found libcurl and OpenSSL < 1.1"
   )
   expect_output(
     expect_identical(
       select_binary("linux", "x86_64", "#error Using OpenSSL version 3"),
-      "ubuntu-22.04"
+      "linux-openssl-3.0"
     ),
-    "Found libcurl and openssl >= 3.0.0"
+    "Found libcurl and OpenSSL >= 3.0.0"
   )
 })
 
diff --git a/r/vignettes/developers/setup.Rmd b/r/vignettes/developers/setup.Rmd
index 88f14a1897..f678338fc0 100644
--- a/r/vignettes/developers/setup.Rmd
+++ b/r/vignettes/developers/setup.Rmd
@@ -53,10 +53,10 @@ recent version of the library without building from source.
 On Linux, you can download a .zip file containing libarrow from the
 [nightly repository](https://nightlies.apache.org/arrow/r/libarrow/bin/).
 
-The directory names correspond to the OS the binaries where built on:
-- "centos-7" (gcc 8 via devtoolset, openssl 1, glib 2.17)
-- "ubuntu-18.04" (gcc 8, openssl 1, glib 2.27)
-- "ubuntu-22.04" (openssl 3)
+The directory names correspond to the OpenSSL version the binaries built with:
+- "linux-openssl-1.0" (OpenSSL 1.0)
+- "linux-openssl-1.1" (OpenSSL 1.1)
+- "linux-openssl-3.0" (OpenSSL 3.0)
 
 Version numbers in that repository correspond to dates.
 
diff --git a/r/vignettes/install.Rmd b/r/vignettes/install.Rmd
index 8051debc84..b33c439236 100644
--- a/r/vignettes/install.Rmd
+++ b/r/vignettes/install.Rmd
@@ -297,8 +297,8 @@ See below for more in-depth explanations of these 
environment variables.
   will work with your system. You can set it to `false` to skip this option
   altogether, or you can specify a string "distro-version" that corresponds to
   a binary that is available, to override what this function may discover by
-  default. Possible values are: "centos-7",
-  "ubuntu-18.04" (both with gcc 8, and openssl 1), "ubuntu-22.04" (openssl 3).
+  default. Possible values are: "linux-openssl-1.0", "linux-openssl-1.1",
+  "linux-openssl-3.0".
 * `LIBARROW_BUILD` : If set to `false`, the build script
   will not attempt to build the C++ from source. This means you will only get
   a working arrow R package if a prebuilt binary is found.

Reply via email to