From d043723a3a8b58d7206259e7a9c54fd01a293f2c Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 5 Sep 2023 05:26:31 +0200 Subject: [PATCH 01/78] add macos libarrow build --- dev/tasks/r/github.packages.yml | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index dbe21ffb6b160..d1debff086a92 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -56,6 +56,47 @@ jobs: name: r-pkg__src__contrib path: arrow/r/arrow_*.tar.gz + macos-cpp: + name: C++ Binary macOS OpenSSL {{ '${{ matrix.openssl }}' }} {{ '${{ matrix.platform.name }}'}} + runs-on: {{ '${{ matrix.platform.runs_on }}'}} + needs: source + strategy: + fail-fast: false + matrix: + platform: + - { runs_on: ["self-hosted", "macos-10.13"], name: "macOS High Sierra", arch: "amd64"} + - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], name: "macOS Big Sur", arch: "arm64" } + openssl: ['3.0', '1.1'] + + steps: + {{ macros.github_checkout_arrow()|indent }} + {{ macros.github_change_r_pkg_version(is_fork, '${{ needs.source.outputs.pkg_version }}')|indent }} + + - name: Build libarrow + shell: bash + env: + {{ macros.github_set_sccache_envvars()|indent(8) }} + run: | + # TODO install deps + brew install openssl@{{ '${{ matrix.openssl }}' }} + export OPENSSL_ROOT_DIR=$(brew --prefix {{'${{ matrix.openssl }}' }}) + r/inst/build_arrow_static.sh + - name: Bundle libarrow + shell: bash + env: + PKG_FILE: arrow-{{ '${{ needs.source.outputs.pkg_version }}' }}.zip + VERSION: {{ '${{ needs.source.outputs.pkg_version }}' }} + run: | + cd arrow/r/libarrow/dist + # These files were created by the docker user so we have to sudo to get them + zip -r $PKG_FILE lib/ include/ + + - name: Upload binary artifact + uses: actions/upload-artifact@v3 + with: + name: r-lib__libarrow__bin__macos-{{ '${{ matrix.platform.arch }}' }}-openssl-{{ '${{ matrix.openssl }}' }} + path: arrow/r/libarrow/dist/arrow-*.zip + linux-cpp: name: C++ Binary Linux OpenSSL {{ '${{ matrix.openssl }}' }} runs-on: ubuntu-latest From 568488377b75ff8db0ea4b7892973c10d22e97da Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 6 Sep 2023 02:43:01 +0200 Subject: [PATCH 02/78] use brewfile for deps --- cpp/Brewfile | 5 +++++ dev/tasks/r/github.packages.yml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cpp/Brewfile b/cpp/Brewfile index 58015d2121b5b..8d5e27b836823 100644 --- a/cpp/Brewfile +++ b/cpp/Brewfile @@ -19,6 +19,7 @@ brew "aws-sdk-cpp" brew "bash" brew "boost" brew "brotli" +brew "bzip2" brew "c-ares" brew "ccache" brew "cmake" @@ -26,17 +27,21 @@ brew "flatbuffers" brew "git" brew "glog" brew "googletest" +brew "google-cloud-sdk" brew "grpc" brew "llvm@14" brew "lz4" +brew "mimalloc" brew "ninja" brew "node" brew "openssl@3" brew "protobuf" brew "python" brew "rapidjson" +brew "re2" brew "snappy" brew "thrift" +brew "utf8proc" brew "wget" brew "xsimd" brew "zstd" diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index d1debff086a92..d2f2af00831a7 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -77,9 +77,9 @@ jobs: env: {{ macros.github_set_sccache_envvars()|indent(8) }} run: | - # TODO install deps + brew bundle --file=arrow/cpp/Brewfile brew install openssl@{{ '${{ matrix.openssl }}' }} - export OPENSSL_ROOT_DIR=$(brew --prefix {{'${{ matrix.openssl }}' }}) + export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) r/inst/build_arrow_static.sh - name: Bundle libarrow shell: bash From f54d1128bfbb9676fb6315a904f59540f81f793b Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 6 Sep 2023 02:53:54 +0200 Subject: [PATCH 03/78] use macos-11 instead of self-hosted 10.13 --- dev/tasks/r/github.packages.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index d2f2af00831a7..ac08317416fc2 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -57,15 +57,15 @@ jobs: path: arrow/r/arrow_*.tar.gz macos-cpp: - name: C++ Binary macOS OpenSSL {{ '${{ matrix.openssl }}' }} {{ '${{ matrix.platform.name }}'}} + name: C++ Binary macOS OpenSSL {{ '${{ matrix.openssl }}' }} {{ '${{ matrix.platform.arch }}'}} runs-on: {{ '${{ matrix.platform.runs_on }}'}} needs: source strategy: fail-fast: false matrix: platform: - - { runs_on: ["self-hosted", "macos-10.13"], name: "macOS High Sierra", arch: "amd64"} - - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], name: "macOS Big Sur", arch: "arm64" } + - { runs_on: "macos-11", arch: "amd64" } + - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], arch: "arm64" } openssl: ['3.0', '1.1'] steps: @@ -76,6 +76,7 @@ jobs: shell: bash env: {{ macros.github_set_sccache_envvars()|indent(8) }} + MACOSX_DEPLOYMENT_TARGET: "10.13" run: | brew bundle --file=arrow/cpp/Brewfile brew install openssl@{{ '${{ matrix.openssl }}' }} From fffcaab133f92de5e064d88881586ea776de777a Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 6 Sep 2023 03:07:50 +0200 Subject: [PATCH 04/78] remove gcs from brew file --- cpp/Brewfile | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/Brewfile b/cpp/Brewfile index 8d5e27b836823..bf491d3073953 100644 --- a/cpp/Brewfile +++ b/cpp/Brewfile @@ -27,7 +27,6 @@ brew "flatbuffers" brew "git" brew "glog" brew "googletest" -brew "google-cloud-sdk" brew "grpc" brew "llvm@14" brew "lz4" From f0200248a71d3673ed98718c7aba9987064d4100 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 6 Sep 2023 03:10:14 +0200 Subject: [PATCH 05/78] update brewfile --- cpp/Brewfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpp/Brewfile b/cpp/Brewfile index bf491d3073953..0f5527985364c 100644 --- a/cpp/Brewfile +++ b/cpp/Brewfile @@ -21,6 +21,7 @@ brew "boost" brew "brotli" brew "bzip2" brew "c-ares" +brew "curl" brew "ccache" brew "cmake" brew "flatbuffers" @@ -34,6 +35,7 @@ brew "mimalloc" brew "ninja" brew "node" brew "openssl@3" +brew "pkg-config" brew "protobuf" brew "python" brew "rapidjson" From 7e510faaff022d66f1f6df3f470da1bdfbfd7814 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 6 Sep 2023 19:42:01 +0200 Subject: [PATCH 06/78] add macos binary test --- dev/tasks/macros.jinja | 14 +++++++++++++- dev/tasks/r/github.packages.yml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index faf77a1168d1b..3d43698715178 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -307,7 +307,8 @@ on: stopifnot(packageVersion("arrow") == {{ '"${{needs.source.outputs.pkg_version}}"' }}) {% endmacro %} -{%- macro github_setup_local_r_repo(get_nix, get_win) -%} +{%- macro github_setup_local_r_repo(get_nix, get_win, get_mac=False) -%} +# TODOf improve arg handling - name: Setup local repo shell: bash run: mkdir repo @@ -327,6 +328,17 @@ on: path: repo/libarrow/bin/linux-openssl-{{ openssl_version }} {% endfor %} {% endif %} + {% if get_mac %} + {% for openssl_version in ["1.1", "3.0"] %} + {% for arch in ["amd64", "arm64"] %} + - name: Get macOS {{ arch }} OpenSSL {{ openssl_version }} binary + uses: actions/download-artifact@v3 + with: + name: r-lib__libarrow__bin__macos-{{arch}}-openssl-{{ openssl_version }} + path: repo/libarrow/bin/macos-{{ arch }}-openssl-{{ openssl_version }} + {% endfor %} + {% endfor %} + {% endif %} - name: Get src pkg uses: actions/download-artifact@v3 with: diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index ac08317416fc2..ae371bf944fce 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -79,8 +79,10 @@ jobs: MACOSX_DEPLOYMENT_TARGET: "10.13" run: | brew bundle --file=arrow/cpp/Brewfile + brew sccache brew install openssl@{{ '${{ matrix.openssl }}' }} export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) + cd arrow r/inst/build_arrow_static.sh - name: Bundle libarrow shell: bash @@ -276,6 +278,36 @@ jobs: name: r-pkg{{ '${{ steps.build.outputs.path }}' }} path: arrow_* + test-macos-binary: + runs-on: macos-11 + needs: macos-cpp + steps: + - uses: r-lib/actions/setup-r@v2 + {{ macros.github_setup_local_r_repo(false, false, true)|indent }} + - run: | + brew install openssl@3 + - name: install with precompiled + shell: Rscript {0} + env: + ARROW_R_DEV: "true" + ARROW_DOWNLOADED_BINARY: "repo/libarrow/bin/macos-amd64-openssl-3.0" + run: | + install.packages('arrow') + remove.packages('arrow') + install.packages( + "arrow", + type = "source", + # The sub is necessary to prevent an error on windows. + repos = sub("file://", "file:", getOption("arrow.dev_repo")),, + INSTALL_opts = INSTALL_opts + ) + + # Test + library(arrow) + arrow::arrow_info() + read_parquet(system.file("v0.7.1.parquet", package = "arrow")) + + test-linux-binary: needs: [source, linux-cpp] name: Test binary {{ '${{ matrix.config.image }}' }} From 0968bbc6f31d9e7b1b74e21752ebba1db45be61c Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 6 Sep 2023 19:42:11 +0200 Subject: [PATCH 07/78] add debug to configure --- r/configure | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/r/configure b/r/configure index 593f60bbddad9..7947d227fafce 100755 --- a/r/configure +++ b/r/configure @@ -79,7 +79,7 @@ TEST_OFFLINE_BUILD=`echo $TEST_OFFLINE_BUILD | tr '[:upper:]' '[:lower:]'` VERSION=`grep '^Version' DESCRIPTION | sed s/Version:\ //` UNAME=`uname -s` -: ${PKG_CONFIG:="pkg-config"} +: ${PKG_CONFIG:="pkg-config --debug"} # These will only be set in the bundled build S3_LIBS="" @@ -130,6 +130,7 @@ fi # same process to find openssl, but doing it now allows us to catch it in # nixlibs.R and throw a nicer error. if [ "${OPENSSL_ROOT_DIR}" = "" ] && brew --prefix openssl >/dev/null 2>&1; then + echo "*** Found openssl via Homebrew." export OPENSSL_ROOT_DIR="`brew --prefix openssl`" export PKG_CONFIG_PATH="${OPENSSL_ROOT_DIR}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" fi @@ -141,19 +142,10 @@ fi find_or_build_libarrow () { if [ "$FORCE_BUNDLED_BUILD" = "true" ]; then do_bundled_build - elif [ "$FORCE_AUTOBREW" = "true" ]; then - do_autobrew else find_arrow if [ "$_LIBARROW_FOUND" = "false" ]; then - # If we haven't found a suitable version of libarrow, build it - if [ "$UNAME" = "Darwin" ] && ! echo $VERSION | grep -q "000"; then - # Only autobrew on release version (for testing, use FORCE_AUTOBREW above) - # (dev versions end in .9000, and nightly gets something like .10000xxx) - do_autobrew - else - do_bundled_build - fi + do_bundled_build fi fi } @@ -410,6 +402,7 @@ arrow_built_with() { # First: find_or_build_libarrow +echo "PKG_LIBS=$PKG_LIBS" # We should have a valid libarrow build in $_LIBARROW_FOUND # Now set `PKG_LIBS`, `PKG_DIRS`, and `PKG_CFLAGS` based on that. # _LIBARROW_FOUND should only be unset in the FORCE_AUTOBREW case, From 6ebbb19e8472e64f213fb9b98df1a3ce8f3a57d5 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 8 Sep 2023 07:26:43 +0200 Subject: [PATCH 08/78] force bundled builds --- dev/tasks/r/github.packages.yml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index ae371bf944fce..fb1f02fae7275 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -79,7 +79,7 @@ jobs: MACOSX_DEPLOYMENT_TARGET: "10.13" run: | brew bundle --file=arrow/cpp/Brewfile - brew sccache + brew install sccache brew install openssl@{{ '${{ matrix.openssl }}' }} export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) cd arrow @@ -128,6 +128,8 @@ jobs: env: UBUNTU: {{ '"${{ matrix.ubuntu }}"' }} {{ macros.github_set_sccache_envvars()|indent(8) }} + MACOSX_DEPLOYMENT_TARGET: "10.13" + EXTRA_CMAKE_FLAGS: "-Dre2_SOURCE=BUNDLED -DSnappy_SOURCE=BUNDLED -DThrift_SOURCE=BUNDLED -DARROW_VERBOSE_THIRDPARTY_BUILD=ON -DCMAKE_VERBOSE_MAKEFILE=ON" run: | sudo sysctl -w kernel.core_pattern="core.%e.%p" ulimit -c unlimited @@ -280,26 +282,33 @@ jobs: test-macos-binary: runs-on: macos-11 - needs: macos-cpp + needs: [source, macos-cpp] steps: - - uses: r-lib/actions/setup-r@v2 {{ macros.github_setup_local_r_repo(false, false, true)|indent }} + - name: Prepare Dependency Installation + shell: bash + run: | + tar -xzf repo/src/contrib/arrow_*.tar.gz arrow/DESCRIPTION + - name: Install dependencies + uses: r-lib/actions/setup-r-dependencies@v2 + with: + working-directory: 'arrow' + extra-packages: cpp11 - run: | brew install openssl@3 - name: install with precompiled shell: Rscript {0} env: ARROW_R_DEV: "true" - ARROW_DOWNLOADED_BINARY: "repo/libarrow/bin/macos-amd64-openssl-3.0" + ARROW_DOWNLOADED_BINARIES: "${{github.workspace}}/repo/libarrow/bin/macos-amd64-openssl-3.0/arrow-${{ needs.source.outputs.pkg_versio }}.zip" run: | - install.packages('arrow') + install.packages('arrow',repos = "http://cran.us.r-project.org") remove.packages('arrow') install.packages( "arrow", type = "source", # The sub is necessary to prevent an error on windows. - repos = sub("file://", "file:", getOption("arrow.dev_repo")),, - INSTALL_opts = INSTALL_opts + repos = sub("file://", "file:", getOption("arrow.dev_repo") ) # Test From e48c4c9f7bfbc54aa7eebd85ed216da540a5e094 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Sat, 9 Sep 2023 03:28:40 +0200 Subject: [PATCH 09/78] escape gha macros --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index fb1f02fae7275..92d126d7cd845 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -300,7 +300,7 @@ jobs: shell: Rscript {0} env: ARROW_R_DEV: "true" - ARROW_DOWNLOADED_BINARIES: "${{github.workspace}}/repo/libarrow/bin/macos-amd64-openssl-3.0/arrow-${{ needs.source.outputs.pkg_versio }}.zip" + ARROW_DOWNLOADED_BINARIES: "{{ '${{github.workspace}}' }}/repo/libarrow/bin/macos-amd64-openssl-3.0/arrow-{{ '${{ needs.source.outputs.pkg_versio }}' }}.zip" run: | install.packages('arrow',repos = "http://cran.us.r-project.org") remove.packages('arrow') From 666c8afc0037813dd4bf8e5fbf12428134f4012d Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 13 Sep 2023 03:23:54 +0200 Subject: [PATCH 10/78] Revert "add debug to configure" This reverts commit 463aaf127abf14d5dbc5ba02fb981c65ea28f8ab. --- r/configure | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/r/configure b/r/configure index 7947d227fafce..593f60bbddad9 100755 --- a/r/configure +++ b/r/configure @@ -79,7 +79,7 @@ TEST_OFFLINE_BUILD=`echo $TEST_OFFLINE_BUILD | tr '[:upper:]' '[:lower:]'` VERSION=`grep '^Version' DESCRIPTION | sed s/Version:\ //` UNAME=`uname -s` -: ${PKG_CONFIG:="pkg-config --debug"} +: ${PKG_CONFIG:="pkg-config"} # These will only be set in the bundled build S3_LIBS="" @@ -130,7 +130,6 @@ fi # same process to find openssl, but doing it now allows us to catch it in # nixlibs.R and throw a nicer error. if [ "${OPENSSL_ROOT_DIR}" = "" ] && brew --prefix openssl >/dev/null 2>&1; then - echo "*** Found openssl via Homebrew." export OPENSSL_ROOT_DIR="`brew --prefix openssl`" export PKG_CONFIG_PATH="${OPENSSL_ROOT_DIR}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" fi @@ -142,10 +141,19 @@ fi find_or_build_libarrow () { if [ "$FORCE_BUNDLED_BUILD" = "true" ]; then do_bundled_build + elif [ "$FORCE_AUTOBREW" = "true" ]; then + do_autobrew else find_arrow if [ "$_LIBARROW_FOUND" = "false" ]; then - do_bundled_build + # If we haven't found a suitable version of libarrow, build it + if [ "$UNAME" = "Darwin" ] && ! echo $VERSION | grep -q "000"; then + # Only autobrew on release version (for testing, use FORCE_AUTOBREW above) + # (dev versions end in .9000, and nightly gets something like .10000xxx) + do_autobrew + else + do_bundled_build + fi fi fi } @@ -402,7 +410,6 @@ arrow_built_with() { # First: find_or_build_libarrow -echo "PKG_LIBS=$PKG_LIBS" # We should have a valid libarrow build in $_LIBARROW_FOUND # Now set `PKG_LIBS`, `PKG_DIRS`, and `PKG_CFLAGS` based on that. # _LIBARROW_FOUND should only be unset in the FORCE_AUTOBREW case, From 0948deff5abe0eb163003b79fa7f764338a671cd Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 13 Sep 2023 04:12:18 +0200 Subject: [PATCH 11/78] use setup-r to avoid issues with unset libraries --- dev/tasks/r/github.packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 92d126d7cd845..bc6c9e9c1c533 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -284,6 +284,7 @@ jobs: runs-on: macos-11 needs: [source, macos-cpp] steps: + - uses: r-lib/actions/setup-r@v2 {{ macros.github_setup_local_r_repo(false, false, true)|indent }} - name: Prepare Dependency Installation shell: bash From ed105a8af7926d5e381acf1df87d08a1647b0b2f Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 13 Sep 2023 07:18:46 +0200 Subject: [PATCH 12/78] fix typo --- dev/tasks/r/github.packages.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index bc6c9e9c1c533..7b29a214972c6 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -303,13 +303,10 @@ jobs: ARROW_R_DEV: "true" ARROW_DOWNLOADED_BINARIES: "{{ '${{github.workspace}}' }}/repo/libarrow/bin/macos-amd64-openssl-3.0/arrow-{{ '${{ needs.source.outputs.pkg_versio }}' }}.zip" run: | - install.packages('arrow',repos = "http://cran.us.r-project.org") - remove.packages('arrow') install.packages( "arrow", type = "source", - # The sub is necessary to prevent an error on windows. - repos = sub("file://", "file:", getOption("arrow.dev_repo") + repos = getOption("arrow.dev_repo") ) # Test From 7dd95d2922b90904c7482bfb34d92c40cfdb0818 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 13 Sep 2023 15:52:27 +0200 Subject: [PATCH 13/78] fix file name --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 7b29a214972c6..ced7df1e1cce9 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -301,7 +301,7 @@ jobs: shell: Rscript {0} env: ARROW_R_DEV: "true" - ARROW_DOWNLOADED_BINARIES: "{{ '${{github.workspace}}' }}/repo/libarrow/bin/macos-amd64-openssl-3.0/arrow-{{ '${{ needs.source.outputs.pkg_versio }}' }}.zip" + ARROW_DOWNLOADED_BINARIES: "{{ '${{github.workspace}}' }}/repo/libarrow/bin/macos-amd64-openssl-3.0/arrow-{{ '${{ needs.source.outputs.pkg_version }}' }}.zip" run: | install.packages( "arrow", From f2249183cf1b3b7315ae0ca7324df5877b0e06ae Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 13 Sep 2023 21:29:44 +0200 Subject: [PATCH 14/78] remove autobrew path in configure --- r/configure | 46 +--------------------------------------------- 1 file changed, 1 insertion(+), 45 deletions(-) diff --git a/r/configure b/r/configure index 593f60bbddad9..19eacd2a3754a 100755 --- a/r/configure +++ b/r/configure @@ -65,8 +65,6 @@ PKG_TEST_HEADER="" # Some env vars that control the build (all logical, case insensitive) # Development mode, also increases verbosity in the bundled build ARROW_R_DEV=`echo $ARROW_R_DEV | tr '[:upper:]' '[:lower:]'` -# autobrew is how mac binaries are built on CRAN; FORCE ensures we use it here -FORCE_AUTOBREW=`echo $FORCE_AUTOBREW | tr '[:upper:]' '[:lower:]'` # The bundled build compiles arrow C++ from source; FORCE ensures we don't pick up # any other packages that may be found on the system FORCE_BUNDLED_BUILD=`echo $FORCE_BUNDLED_BUILD | tr '[:upper:]' '[:lower:]'` @@ -141,19 +139,11 @@ fi find_or_build_libarrow () { if [ "$FORCE_BUNDLED_BUILD" = "true" ]; then do_bundled_build - elif [ "$FORCE_AUTOBREW" = "true" ]; then - do_autobrew else find_arrow if [ "$_LIBARROW_FOUND" = "false" ]; then # If we haven't found a suitable version of libarrow, build it - if [ "$UNAME" = "Darwin" ] && ! echo $VERSION | grep -q "000"; then - # Only autobrew on release version (for testing, use FORCE_AUTOBREW above) - # (dev versions end in .9000, and nightly gets something like .10000xxx) - do_autobrew - else - do_bundled_build - fi + do_bundled_build fi fi } @@ -175,12 +165,6 @@ find_arrow () { # 2. Use pkg-config to find arrow on the system _LIBARROW_FOUND="`${PKG_CONFIG} --variable=prefix --silence-errors ${PKG_CONFIG_NAME}`" echo "*** Trying Arrow C++ found by pkg-config: $_LIBARROW_FOUND" - elif brew --prefix ${PKG_BREW_NAME} > /dev/null 2>&1; then - # 3. On macOS, look for Homebrew apache-arrow - # (note that if you have pkg-config, homebrew arrow may have already been found) - _LIBARROW_FOUND=`brew --prefix ${PKG_BREW_NAME}` - echo "*** Trying Arrow C++ found by Homebrew: ${_LIBARROW_FOUND}" - export PKG_CONFIG_PATH="${_LIBARROW_FOUND}/lib/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}" else _LIBARROW_FOUND="false" fi @@ -247,34 +231,6 @@ do_bundled_build () { fi } -do_autobrew () { - echo "*** Downloading ${PKG_BREW_NAME}" - - # Setup for local autobrew testing - if [ -f "tools/apache-arrow.rb" ]; then - # If you want to use a local apache-arrow.rb formula, do - # $ cp ../dev/tasks/homebrew-formulae/autobrew/apache-arrow*.rb tools - # before R CMD build or INSTALL (assuming a local checkout of the apache/arrow repository). - # If you have this, you should use the local autobrew script so they match. - cp tools/autobrew . - fi - - if [ -f "autobrew" ]; then - echo "**** Using local manifest for ${PKG_BREW_NAME}" - else - if ! curl -sfL "https://autobrew.github.io/scripts/$PKG_BREW_NAME" > autobrew; then - echo "Failed to download manifest for ${PKG_BREW_NAME}" - # Fall back to the local copy - cp tools/autobrew . - fi - fi - if ! . autobrew; then - echo "Failed to retrieve binary for ${PKG_BREW_NAME}" - fi - # autobrew sets `PKG_LIBS`, `PKG_DIRS`, and `PKG_CFLAGS` - # TODO: move PKG_LIBS and PKG_CFLAGS out of autobrew and use set_pkg_vars -} - # Once libarrow is obtained, this function sets `PKG_LIBS`, `PKG_DIRS`, and `PKG_CFLAGS` # either from pkg-config or by inferring things about the directory in $1 set_pkg_vars () { From 03a318c1b69a3e8643c364fc1d3669f90ce113f5 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 13 Sep 2023 23:33:45 +0200 Subject: [PATCH 15/78] don't install brewfile --- dev/tasks/r/github.packages.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index ced7df1e1cce9..23c9909a74df7 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -71,16 +71,17 @@ jobs: steps: {{ macros.github_checkout_arrow()|indent }} {{ macros.github_change_r_pkg_version(is_fork, '${{ needs.source.outputs.pkg_version }}')|indent }} - + - name: Install Deps + run: | + #brew bundle --file=arrow/cpp/Brewfile + brew install sccache + brew install openssl@${{ matrix.openssl }} - name: Build libarrow shell: bash env: {{ macros.github_set_sccache_envvars()|indent(8) }} MACOSX_DEPLOYMENT_TARGET: "10.13" run: | - brew bundle --file=arrow/cpp/Brewfile - brew install sccache - brew install openssl@{{ '${{ matrix.openssl }}' }} export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) cd arrow r/inst/build_arrow_static.sh From bf641ff68816b9753c8b4fa049e85db9ce4ef8f2 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 13 Sep 2023 23:40:03 +0200 Subject: [PATCH 16/78] escape gha macro --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 23c9909a74df7..91123d4536e72 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -75,7 +75,7 @@ jobs: run: | #brew bundle --file=arrow/cpp/Brewfile brew install sccache - brew install openssl@${{ matrix.openssl }} + brew install openssl@{{ '${{ matrix.openssl }}' }} - name: Build libarrow shell: bash env: From 9001053575a4cd57db557566533a405ab5444864 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 19 Sep 2023 05:36:50 +0200 Subject: [PATCH 17/78] force bundled build and additional flags to enable features --- dev/tasks/r/github.packages.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 91123d4536e72..5a46e1b5f4e54 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -73,7 +73,6 @@ jobs: {{ macros.github_change_r_pkg_version(is_fork, '${{ needs.source.outputs.pkg_version }}')|indent }} - name: Install Deps run: | - #brew bundle --file=arrow/cpp/Brewfile brew install sccache brew install openssl@{{ '${{ matrix.openssl }}' }} - name: Build libarrow @@ -81,6 +80,11 @@ jobs: env: {{ macros.github_set_sccache_envvars()|indent(8) }} MACOSX_DEPLOYMENT_TARGET: "10.13" + ARROW_S3: true + ARROW_GCS: true + ARROW_DEPENDENCY_SOURCE: BUNDLED + CMAKE_GENERATOR: Ninja + LIBARROW_MINIMAL: false run: | export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) cd arrow From 3bae0ee563539a511f75886caef7fe49f930f6f8 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 02:29:04 +0200 Subject: [PATCH 18/78] remove formula pinning from jinja macro --- dev/tasks/macros.jinja | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index 3d43698715178..8e644557dc4d3 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -256,22 +256,6 @@ on: done {% endmacro %} -{%- macro pin_brew_formulae(is_fork = false) -%} -{#- This macro expects the cwd to be arrow/r -#} - # Copy all *brew formulae - cp ../dev/tasks/homebrew-formulae/autobrew/apache-arrow*.rb tools/ - - # Pin the git commit in the formula to match - pushd tools - if [ "{{ is_fork }}" == "true" ]; then - sed -i.bak -E -e 's/apache\/arrow.git", branch: "main"$/{{ arrow.github_repo.split("/") | join("\/") }}.git", :revision => "'"{{ arrow.head }}"'"/' apache-arrow*.rb - else - sed -i.bak -E -e 's/arrow.git", branch: "main"$/arrow.git", :revision => "'"{{ arrow.head }}"'"/' apache-arrow*.rb - fi - rm -f apache-arrow*.rb.bak - popd -{% endmacro %} - {%- macro github_change_r_pkg_version(is_fork, version) -%} - name: Modify version shell: bash @@ -282,8 +266,6 @@ on: DESCRIPTION head DESCRIPTION rm -f DESCRIPTION.bak - - {{ pin_brew_formulae(is_fork) }} {% endmacro %} {%- macro github_test_r_src_pkg() -%} @@ -330,7 +312,7 @@ on: {% endif %} {% if get_mac %} {% for openssl_version in ["1.1", "3.0"] %} - {% for arch in ["amd64", "arm64"] %} + {% for arch in ["x86_64", "arm64"] %} - name: Get macOS {{ arch }} OpenSSL {{ openssl_version }} binary uses: actions/download-artifact@v3 with: From f5eae5fe9c71087a4429ff992ffb3483ad194aa2 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 02:29:51 +0200 Subject: [PATCH 19/78] enable precompiled binaries via arrow.(dev_)repo on macos also update/add tests for nixlibs --- r/tools/nixlibs-allowlist.txt | 1 + r/tools/nixlibs.R | 64 ++++++++++++++++++++++++++++------- r/tools/test-nixlibs.R | 56 ++++++++++++++++++++++++------ 3 files changed, 98 insertions(+), 23 deletions(-) diff --git a/r/tools/nixlibs-allowlist.txt b/r/tools/nixlibs-allowlist.txt index bd9f0c1b2c084..9c368e6ed15a2 100644 --- a/r/tools/nixlibs-allowlist.txt +++ b/r/tools/nixlibs-allowlist.txt @@ -2,3 +2,4 @@ ubuntu centos redhat rhel +darwin diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 3d908c05cab07..ec868f7c5d119 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -28,6 +28,8 @@ if (test_mode && is.na(VERSION)) { } dev_version <- package_version(VERSION)[1, 4] +on_macos <- tolower(Sys.info()[["sysname"]]) == "darwin" + # Small dev versions are added for R-only changes during CRAN submission. if (is.na(dev_version) || dev_version < "100") { @@ -114,6 +116,10 @@ download_binary <- function(lib) { # * "linux-openssl-1.0" (OpenSSL 1.0) # * "linux-openssl-1.1" (OpenSSL 1.1) # * "linux-openssl-3.0" (OpenSSL 3.0) +# * "macos-amd64-openssl-1.1" (OpenSSL 1.1) +# * "macos-amd64-openssl-3.0" (OpenSSL 3.0) +# * "macos-arm64-openssl-1.1" (OpenSSL 1.1) +# * "macos-arm64-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()) { @@ -142,7 +148,7 @@ check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apa # Try a remote allowlist so that we can add/remove without a release suppressWarnings(readLines(allowed)), # Fallback to default: allowed only on Ubuntu and CentOS/RHEL - error = function(e) c("ubuntu", "centos", "redhat", "rhel") + error = function(e) c("ubuntu", "centos", "redhat", "rhel", "darwin") ) # allowlist should contain valid regular expressions (plain strings ok too) any(grepl(paste(allowlist, collapse = "|"), os)) @@ -151,25 +157,28 @@ check_allowlist <- function(os, allowed = "https://raw.githubusercontent.com/apa select_binary <- function(os = tolower(Sys.info()[["sysname"]]), arch = tolower(Sys.info()[["machine"]]), test_program = test_for_curl_and_openssl) { - if (identical(os, "linux") && identical(arch, "x86_64")) { - # We only host x86 linux binaries today + if (identical(os, "darwin") || (identical(os, "linux") && identical(arch, "x86_64"))) { + # We only host x86 linux binaries and x86 & arm64 macos today tryCatch( # Somehow the test program system2 call errors on the sanitizer builds # so globally handle the possibility that this could fail { errs <- compile_test_program(test_program) - determine_binary_from_stderr(errs) + openssl_version <- determine_binary_from_stderr(errs) + arch <- ifelse(identical(os, "darwin"), paste0("-", arch, "-"), "-") + binary <- paste0(os, arch, openssl_version) }, error = function(e) { cat("*** Unable to find libcurl and openssl\n") - NULL + binary <- NULL } ) } else { # No binary available for arch cat(sprintf("*** Building on %s %s\n", os, arch)) - NULL + binary <- NULL } + return(binary) } # This tests that curl and OpenSSL are present (bc we can include their headers) @@ -197,27 +206,47 @@ compile_test_program <- function(code) { # Note: if we wanted to check for openssl on macOS, we'd have to set the brew # path as a -I directory. But since we (currently) only run this code to # determine whether we can download a Linux binary, it's not relevant. + openssl_dir <- "" + if(on_macos) { + openssl_root_dir <- get_macos_openssl_dir() + openssl_dir <- paste0("-I", openssl_root_dir, "/include") + } runner <- paste( R_CMD_config("CXX17"), R_CMD_config("CPPFLAGS"), R_CMD_config("CXX17FLAGS"), R_CMD_config("CXX17STD"), "-E", - "-xc++" + "-xc++", + openssl_dir ) suppressWarnings(system2("echo", sprintf('"%s" | %s -', code, runner), stdout = FALSE, stderr = TRUE)) } +get_macos_openssl_dir <- function(){ + openssl_root_dir <- Sys.getenv("OPENSSL_ROOT_DIR", NA) + if (is.na(openssl_root_dir)) { + # try to guess default openssl include dir based on CRAN's build script + # https://github.com/R-macos/recipes/blob/master/build.sh#L35 + if(identical(Sys.info()["machine"], "arm64")){ + openssl_root_dir <- "/opt/R/arm64/include" + } else if (file.exists("/opt/R/x86_64")) { + openssl_root_dir <- "/opt/R/x86_64/include" + } else { + openssl_root_dir <- "/usr/local/include" + } + } +} # (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.1, # openssl is < 3.0 cat("*** Found libcurl and OpenSSL >= 1.1\n") - return("linux-openssl-1.1") + return("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++ + } else if (!on_macos && any(grepl("Using libc++", errs, fixed = TRUE))) { + # Our linux binaries are all built with GNU stdlib so they fail with libc++ cat("*** Found libc++\n") return(NULL) } else if (header_not_found("curl/curl", errs)) { @@ -231,11 +260,15 @@ determine_binary_from_stderr <- function(errs) { return(NULL) # Else, determine which other binary will work } else if (any(grepl("Using OpenSSL version 1.0", errs))) { + if(on_macos) { + cat("*** OpenSSL 1.0 is not supported on macOS\n") + return(NULL) + } cat("*** Found libcurl and OpenSSL < 1.1\n") - return("linux-openssl-1.0") + return("openssl-1.0") } else if (any(grepl("Using OpenSSL version 3", errs))) { cat("*** Found libcurl and OpenSSL >= 3.0.0\n") - return("linux-openssl-3.0") + return("openssl-3.0") } NULL } @@ -248,6 +281,11 @@ header_not_found <- function(header, errs) { #### start distro #### distro <- function() { + # This is not part of distro but needed to enable prebuilt binaries on macos + if(on_macos) { + return(list(id = "darwin", arch = tolower(Sys.info()[["machine"]]))) + } + # The code in this script is a (potentially stale) copy of the distro package if (requireNamespace("distro", quietly = TRUE)) { # Use the version from the package, which may be updated from this @@ -503,7 +541,7 @@ ensure_cmake <- function(cmake_minimum_required = "3.16") { # If not found, download it cat("**** cmake\n") CMAKE_VERSION <- Sys.getenv("CMAKE_VERSION", "3.26.4") - if (tolower(Sys.info()[["sysname"]]) %in% "darwin") { + if (on_macos) { postfix <- "-macos-universal.tar.gz" } else if (tolower(Sys.info()[["machine"]]) %in% c("arm64", "aarch64")) { postfix <- "-linux-aarch64.tar.gz" diff --git a/r/tools/test-nixlibs.R b/r/tools/test-nixlibs.R index e099dcdad4acf..493b0444d8ca6 100644 --- a/r/tools/test-nixlibs.R +++ b/r/tools/test-nixlibs.R @@ -21,8 +21,8 @@ # Flag so that we just load the functions and don't evaluate them like we do # when called from configure.R TESTING <- TRUE - -source("nixlibs.R", local = TRUE) +nixlibs_env <- environment() +source("nixlibs.R", local = nixlibs_env) test_that("identify_binary() based on LIBARROW_BINARY", { expect_null(identify_binary("FALSE")) @@ -31,10 +31,6 @@ test_that("identify_binary() based on LIBARROW_BINARY", { }) test_that("select_binary() based on system", { - expect_output( - expect_null(select_binary("darwin", "x86_64")), # Not built today - "Building on darwin x86_64" - ) expect_output( expect_null(select_binary("linux", arch = "aarch64")), # Not built today "Building on linux aarch64" @@ -52,21 +48,30 @@ test_that("determine_binary_from_stderr", { expect_output( expect_identical( determine_binary_from_stderr(compile_test_program("int a;")), - "linux-openssl-1.1" + "openssl-1.1" ), "Found libcurl and OpenSSL >= 1.1" ) + + nixlibs_env$on_macos <- FALSE expect_output( expect_identical( determine_binary_from_stderr(compile_test_program("#error Using OpenSSL version 1.0")), - "linux-openssl-1.0" + "openssl-1.0" ), "Found libcurl and OpenSSL < 1.1" ) + nixlibs_env$on_macos <- TRUE + expect_output( + expect_null( + determine_binary_from_stderr(compile_test_program("#error Using OpenSSL version 1.0")) + ), + "OpenSSL 1.0 is not supported on macOS" + ) expect_output( expect_identical( determine_binary_from_stderr(compile_test_program("#error Using OpenSSL version 3")), - "linux-openssl-3.0" + "openssl-3.0" ), "Found libcurl and OpenSSL >= 3.0.0" ) @@ -79,6 +84,7 @@ test_that("determine_binary_from_stderr", { }) test_that("select_binary() with test program", { + nixlibs_env$on_macos <- FALSE expect_output( expect_identical( select_binary("linux", "x86_64", "int a;"), @@ -100,13 +106,43 @@ test_that("select_binary() with test program", { ), "Found libcurl and OpenSSL >= 3.0.0" ) + nixlibs_env$on_macos <- TRUE + expect_output( + expect_identical( + select_binary("darwin", "x86_64", "int a;"), + "darwin-x86_64-openssl-1.1" + ), + "Found libcurl and OpenSSL >= 1.1" + ) + expect_output( + expect_identical( + select_binary("darwin", "x86_64", "#error Using OpenSSL version 3"), + "darwin-x86_64-openssl-3.0" + ), + "Found libcurl and OpenSSL >= 3.0.0" + ) + expect_output( + expect_identical( + select_binary("darwin", "arm64", "int a;"), + "darwin-arm64-openssl-1.1" + ), + "Found libcurl and OpenSSL >= 1.1" + ) + expect_output( + expect_identical( + select_binary("darwin", "arm64", "#error Using OpenSSL version 3"), + "darwin-arm64-openssl-3.0" + ), + "Found libcurl and OpenSSL >= 3.0.0" + ) }) test_that("check_allowlist", { tf <- tempfile() - cat("tu$\n^cent\n", file = tf) + cat("tu$\n^cent\n^dar\n", file = tf) expect_true(check_allowlist("ubuntu", tf)) expect_true(check_allowlist("centos", tf)) + expect_true(check_allowlist("darwin", tf)) expect_false(check_allowlist("redhat", tf)) # remote allowlist doesn't have this expect_true(check_allowlist("redhat", tempfile())) # remote allowlist doesn't exist, so we fall back to the default list, which contains redhat expect_false(check_allowlist("debian", tempfile())) From 6e12270cd06d182e61dac0c24215914463f92291 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 02:30:08 +0200 Subject: [PATCH 20/78] use precompiled binaries in nightly packages --- dev/tasks/r/github.packages.yml | 53 +++++---------------------------- 1 file changed, 7 insertions(+), 46 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 5a46e1b5f4e54..506b61a40f73b 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -64,7 +64,7 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: "macos-11", arch: "amd64" } + - { runs_on: "macos-11", arch: "x86_64" } - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], arch: "arm64" } openssl: ['3.0', '1.1'] @@ -73,15 +73,15 @@ jobs: {{ macros.github_change_r_pkg_version(is_fork, '${{ needs.source.outputs.pkg_version }}')|indent }} - name: Install Deps run: | - brew install sccache + brew install sccache ninja brew install openssl@{{ '${{ matrix.openssl }}' }} - name: Build libarrow shell: bash env: {{ macros.github_set_sccache_envvars()|indent(8) }} MACOSX_DEPLOYMENT_TARGET: "10.13" - ARROW_S3: true - ARROW_GCS: true + ARROW_S3: ON + ARROW_GCS: ON ARROW_DEPENDENCY_SOURCE: BUNDLED CMAKE_GENERATOR: Ninja LIBARROW_MINIMAL: false @@ -186,7 +186,7 @@ jobs: path: build/arrow-*.zip r-packages: - needs: [source, windows-cpp] + needs: [source, windows-cpp, macos-cpp] name: {{ '${{ matrix.platform.name }} ${{ matrix.r_version.r }}' }} runs-on: {{ '${{ matrix.platform.runs_on }}' }} strategy: @@ -218,7 +218,7 @@ jobs: rig system setup-user-lib rig system add-pak - {{ macros.github_setup_local_r_repo(false, true)|indent }} + {{ macros.github_setup_local_r_repo(false, true, true)|indent }} - name: Prepare Dependency Installation shell: bash @@ -229,18 +229,12 @@ jobs: with: working-directory: 'arrow' extra-packages: cpp11 - - name: Install sccache - if: startsWith(matrix.platform, 'macos') - run: brew install sccache - name: Build Binary id: build shell: Rscript {0} env: NOT_CRAN: "true" # actions/setup-r sets this implicitly ARROW_R_DEV: "true" - FORCE_AUTOBREW: "true" # this is ignored on windows - # sccache for macos - {{ macros.github_set_sccache_envvars()|indent(8) }} run: | on_windows <- tolower(Sys.info()[["sysname"]]) == "windows" @@ -284,40 +278,6 @@ jobs: with: name: r-pkg{{ '${{ steps.build.outputs.path }}' }} path: arrow_* - - test-macos-binary: - runs-on: macos-11 - needs: [source, macos-cpp] - steps: - - uses: r-lib/actions/setup-r@v2 - {{ macros.github_setup_local_r_repo(false, false, true)|indent }} - - name: Prepare Dependency Installation - shell: bash - run: | - tar -xzf repo/src/contrib/arrow_*.tar.gz arrow/DESCRIPTION - - name: Install dependencies - uses: r-lib/actions/setup-r-dependencies@v2 - with: - working-directory: 'arrow' - extra-packages: cpp11 - - run: | - brew install openssl@3 - - name: install with precompiled - shell: Rscript {0} - env: - ARROW_R_DEV: "true" - ARROW_DOWNLOADED_BINARIES: "{{ '${{github.workspace}}' }}/repo/libarrow/bin/macos-amd64-openssl-3.0/arrow-{{ '${{ needs.source.outputs.pkg_version }}' }}.zip" - run: | - install.packages( - "arrow", - type = "source", - repos = getOption("arrow.dev_repo") - ) - - # Test - library(arrow) - arrow::arrow_info() - read_parquet(system.file("v0.7.1.parquet", package = "arrow")) test-linux-binary: @@ -404,6 +364,7 @@ jobs: print(arrow_info()) test-source: +#TODO add macos (m1)source build needs: source name: Test linux source build runs-on: ubuntu-latest From 8992a1849f574bb8487b3c153135b8c87ba086fa Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 02:38:11 +0200 Subject: [PATCH 21/78] Revert "remove formula pinning from jinja macro" This reverts commit de615f940c49ed2ee8168fe06aa579b02616761a. --- dev/tasks/macros.jinja | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index 8e644557dc4d3..3d43698715178 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -256,6 +256,22 @@ on: done {% endmacro %} +{%- macro pin_brew_formulae(is_fork = false) -%} +{#- This macro expects the cwd to be arrow/r -#} + # Copy all *brew formulae + cp ../dev/tasks/homebrew-formulae/autobrew/apache-arrow*.rb tools/ + + # Pin the git commit in the formula to match + pushd tools + if [ "{{ is_fork }}" == "true" ]; then + sed -i.bak -E -e 's/apache\/arrow.git", branch: "main"$/{{ arrow.github_repo.split("/") | join("\/") }}.git", :revision => "'"{{ arrow.head }}"'"/' apache-arrow*.rb + else + sed -i.bak -E -e 's/arrow.git", branch: "main"$/arrow.git", :revision => "'"{{ arrow.head }}"'"/' apache-arrow*.rb + fi + rm -f apache-arrow*.rb.bak + popd +{% endmacro %} + {%- macro github_change_r_pkg_version(is_fork, version) -%} - name: Modify version shell: bash @@ -266,6 +282,8 @@ on: DESCRIPTION head DESCRIPTION rm -f DESCRIPTION.bak + + {{ pin_brew_formulae(is_fork) }} {% endmacro %} {%- macro github_test_r_src_pkg() -%} @@ -312,7 +330,7 @@ on: {% endif %} {% if get_mac %} {% for openssl_version in ["1.1", "3.0"] %} - {% for arch in ["x86_64", "arm64"] %} + {% for arch in ["amd64", "arm64"] %} - name: Get macOS {{ arch }} OpenSSL {{ openssl_version }} binary uses: actions/download-artifact@v3 with: From 1291fa2afacb8a66e863cdc1b507377e364bf793 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 03:08:21 +0200 Subject: [PATCH 22/78] add correct arch name to macro --- dev/tasks/macros.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index 3d43698715178..c038084625f98 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -330,7 +330,7 @@ on: {% endif %} {% if get_mac %} {% for openssl_version in ["1.1", "3.0"] %} - {% for arch in ["amd64", "arm64"] %} + {% for arch in ["x86_64", "arm64"] %} - name: Get macOS {{ arch }} OpenSSL {{ openssl_version }} binary uses: actions/download-artifact@v3 with: From 82ccfad7ed579b78bd8c24be72daa2923a1a7b36 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 03:59:51 +0200 Subject: [PATCH 23/78] fix select_binary it was not correctly returning NULL but rather partial binary strings on failure (e.g. no openssl) --- r/tools/nixlibs.R | 6 +++--- r/tools/test-nixlibs.R | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index ec868f7c5d119..627110c95e5af 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -159,18 +159,18 @@ select_binary <- function(os = tolower(Sys.info()[["sysname"]]), test_program = test_for_curl_and_openssl) { if (identical(os, "darwin") || (identical(os, "linux") && identical(arch, "x86_64"))) { # We only host x86 linux binaries and x86 & arm64 macos today - tryCatch( + binary <- tryCatch( # Somehow the test program system2 call errors on the sanitizer builds # so globally handle the possibility that this could fail { errs <- compile_test_program(test_program) openssl_version <- determine_binary_from_stderr(errs) arch <- ifelse(identical(os, "darwin"), paste0("-", arch, "-"), "-") - binary <- paste0(os, arch, openssl_version) + ifelse(is.null(openssl_version), NULL, paste0(os, arch, openssl_version)) }, error = function(e) { cat("*** Unable to find libcurl and openssl\n") - binary <- NULL + NULL } ) } else { diff --git a/r/tools/test-nixlibs.R b/r/tools/test-nixlibs.R index 493b0444d8ca6..1377e525756da 100644 --- a/r/tools/test-nixlibs.R +++ b/r/tools/test-nixlibs.R @@ -135,6 +135,12 @@ test_that("select_binary() with test program", { ), "Found libcurl and OpenSSL >= 3.0.0" ) + expect_output( + expect_null( + select_binary("darwin", "x86_64", "#error Using OpenSSL version 1.0") + ), + "OpenSSL 1.0 is not supported on macOS" + ) }) test_that("check_allowlist", { From 229116c73a9215d477915807b9750fa27a66564f Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 04:23:50 +0200 Subject: [PATCH 24/78] fix openssl include dir for test compile --- r/tools/nixlibs.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 627110c95e5af..f582e522c00d8 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -229,12 +229,13 @@ get_macos_openssl_dir <- function(){ # try to guess default openssl include dir based on CRAN's build script # https://github.com/R-macos/recipes/blob/master/build.sh#L35 if(identical(Sys.info()["machine"], "arm64")){ - openssl_root_dir <- "/opt/R/arm64/include" + openssl_root_dir <- "/opt/R/arm64" } else if (file.exists("/opt/R/x86_64")) { - openssl_root_dir <- "/opt/R/x86_64/include" + openssl_root_dir <- "/opt/R/x86_64" } else { - openssl_root_dir <- "/usr/local/include" + openssl_root_dir <- "/usr/local" } + return(paste0(openssl_root_dir, "/include")) } } # (built with newer devtoolset but older glibc (2.17) for broader compatibility,# like manylinux2014) From 1f6c155af3e00ed7423a7d963f0bdeb44c4b98c1 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 04:25:13 +0200 Subject: [PATCH 25/78] ensure openssl --- dev/tasks/r/github.packages.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 506b61a40f73b..139cc69dcb669 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -229,6 +229,9 @@ jobs: with: working-directory: 'arrow' extra-packages: cpp11 + - name: Install openssl + if: contains(matrix.platform.runs_on, 'self-hosted') + run: brew install openssl@3 - name: Build Binary id: build shell: Rscript {0} From 3ded21c33209d4fbeff6b828197e52fb5fdb4176 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 05:02:41 +0200 Subject: [PATCH 26/78] correctly return include dir --- r/tools/nixlibs.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index f582e522c00d8..1fb8873f66143 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -235,8 +235,8 @@ get_macos_openssl_dir <- function(){ } else { openssl_root_dir <- "/usr/local" } - return(paste0(openssl_root_dir, "/include")) } + return(paste0(openssl_root_dir, "/include")) } # (built with newer devtoolset but older glibc (2.17) for broader compatibility,# like manylinux2014) determine_binary_from_stderr <- function(errs) { From 960fbbe3844c4c8ec68a78a99881750cbc14efeb Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 20 Sep 2023 06:09:31 +0200 Subject: [PATCH 27/78] fix repo names --- dev/tasks/macros.jinja | 4 ++-- dev/tasks/r/github.packages.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index c038084625f98..4255fc068a486 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -334,8 +334,8 @@ on: - name: Get macOS {{ arch }} OpenSSL {{ openssl_version }} binary uses: actions/download-artifact@v3 with: - name: r-lib__libarrow__bin__macos-{{arch}}-openssl-{{ openssl_version }} - path: repo/libarrow/bin/macos-{{ arch }}-openssl-{{ openssl_version }} + name: r-lib__libarrow__bin__darwin-{{arch}}-openssl-{{ openssl_version }} + path: repo/libarrow/bin/darwin-{{ arch }}-openssl-{{ openssl_version }} {% endfor %} {% endfor %} {% endif %} diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 139cc69dcb669..8cbf4982411f8 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -102,7 +102,7 @@ jobs: - name: Upload binary artifact uses: actions/upload-artifact@v3 with: - name: r-lib__libarrow__bin__macos-{{ '${{ matrix.platform.arch }}' }}-openssl-{{ '${{ matrix.openssl }}' }} + name: r-lib__libarrow__bin__darwin-{{ '${{ matrix.platform.arch }}' }}-openssl-{{ '${{ matrix.openssl }}' }} path: arrow/r/libarrow/dist/arrow-*.zip linux-cpp: From 2f5cf0722acc4d1e58b28fbae36c42370beec851 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 21 Sep 2023 04:22:27 +0200 Subject: [PATCH 28/78] update snappy version --- cpp/thirdparty/versions.txt | 5 ++--- dev/tasks/r/github.packages.yml | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cpp/thirdparty/versions.txt b/cpp/thirdparty/versions.txt index 52d302592b55c..56163f35d2499 100644 --- a/cpp/thirdparty/versions.txt +++ b/cpp/thirdparty/versions.txt @@ -101,9 +101,8 @@ ARROW_RAPIDJSON_BUILD_VERSION=232389d4f1012dddec4ef84861face2d2ba85709 ARROW_RAPIDJSON_BUILD_SHA256_CHECKSUM=b9290a9a6d444c8e049bd589ab804e0ccf2b05dc5984a19ed5ae75d090064806 ARROW_RE2_BUILD_VERSION=2022-06-01 ARROW_RE2_BUILD_SHA256_CHECKSUM=f89c61410a072e5cbcf8c27e3a778da7d6fd2f2b5b1445cd4f4508bee946ab0f -# 1.1.9 is patched to implement https://github.com/google/snappy/pull/148 if this is bumped, remove the patch -ARROW_SNAPPY_BUILD_VERSION=1.1.9 -ARROW_SNAPPY_BUILD_SHA256_CHECKSUM=75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7 +ARROW_SNAPPY_BUILD_VERSION=1.1.10 +ARROW_SNAPPY_BUILD_SHA256_CHECKSUM=49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90 ARROW_SUBSTRAIT_BUILD_VERSION=v0.27.0 ARROW_SUBSTRAIT_BUILD_SHA256_CHECKSUM=4ed375f69d972a57fdc5ec406c17003a111831d8640d3f1733eccd4b3ff45628 ARROW_S2N_TLS_BUILD_VERSION=v1.3.35 diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 8cbf4982411f8..b6cc34d7b77b5 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -64,14 +64,15 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: "macos-11", arch: "x86_64" } + - { runs_on: ["self-hosted", "macos-10.13"], arch: "x86_64" } - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], arch: "arm64" } openssl: ['3.0', '1.1'] steps: - {{ macros.github_checkout_arrow()|indent }} + {{ macros.github_checkout_arrow(checkout_v="3")|indent }} {{ macros.github_change_r_pkg_version(is_fork, '${{ needs.source.outputs.pkg_version }}')|indent }} - name: Install Deps + if: {{ "${{ !contains(matrix.platform.runs_on, 'macos-10.13') }}" }} run: | brew install sccache ninja brew install openssl@{{ '${{ matrix.openssl }}' }} From ded46f1660aa034702b6176cd16a015b3943af13 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 21 Sep 2023 04:27:53 +0200 Subject: [PATCH 29/78] fix typo --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index b6cc34d7b77b5..0d3061eaa5276 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -69,7 +69,7 @@ jobs: openssl: ['3.0', '1.1'] steps: - {{ macros.github_checkout_arrow(checkout_v="3")|indent }} + {{ macros.github_checkout_arrow(action_v="3")|indent }} {{ macros.github_change_r_pkg_version(is_fork, '${{ needs.source.outputs.pkg_version }}')|indent }} - name: Install Deps if: {{ "${{ !contains(matrix.platform.runs_on, 'macos-10.13') }}" }} From f68ddf3424a96f5ad05de80f8c6ae197f09a045a Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 21 Sep 2023 04:48:17 +0200 Subject: [PATCH 30/78] disable -Werror for snappy --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 85c0337d108be..1fd65f07a5a79 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1307,7 +1307,7 @@ macro(build_snappy) set(SNAPPY_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF - "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") + "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}" "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=-Wno-error") externalproject_add(snappy_ep ${EP_COMMON_OPTIONS} From 93d1a8fb7e2d387c83fc02625ea94c03dd4ba9ac Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 21 Sep 2023 05:48:08 +0200 Subject: [PATCH 31/78] patch snappy --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 4 ++- cpp/cmake_modules/snappy.diff | 30 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 cpp/cmake_modules/snappy.diff diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 1fd65f07a5a79..849b82facf7e5 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1307,14 +1307,16 @@ macro(build_snappy) set(SNAPPY_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF - "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}" "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=-Wno-error") + "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") + find_program(GIT git) externalproject_add(snappy_ep ${EP_COMMON_OPTIONS} BUILD_IN_SOURCE 1 INSTALL_DIR ${SNAPPY_PREFIX} URL ${SNAPPY_SOURCE_URL} URL_HASH "SHA256=${ARROW_SNAPPY_BUILD_SHA256_CHECKSUM}" + PATCH_COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/snappy.diff CMAKE_ARGS ${SNAPPY_CMAKE_ARGS} BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}") diff --git a/cpp/cmake_modules/snappy.diff b/cpp/cmake_modules/snappy.diff new file mode 100644 index 0000000000000..4b9254a387170 --- /dev/null +++ b/cpp/cmake_modules/snappy.diff @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c3062e2..d946037 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,13 +66,6 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") + endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra") + +- # Use -Werror for clang only. +- if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- if(NOT CMAKE_CXX_FLAGS MATCHES "-Werror") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") +- endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror") +- endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- + # Disable C++ exceptions. + string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") +diff --git a/snappy.cc b/snappy.cc +index d414718..5b0d0d6 100644 +--- a/snappy.cc ++++ b/snappy.cc +@@ -83,6 +83,7 @@ + #include + #include + #include ++#include + + namespace snappy { + From 84e364898784d7a38834140d8df5027bfb146769 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 21 Sep 2023 05:56:57 +0200 Subject: [PATCH 32/78] disable werror explicitly again --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 849b82facf7e5..066744648abb0 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1308,6 +1308,9 @@ macro(build_snappy) set(SNAPPY_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + list(APPEND SNAPPY_CMAKE_ARGS "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") + endif() find_program(GIT git) externalproject_add(snappy_ep From 550c936c33142d0151202e7b27684fbb2e88aba2 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 22 Sep 2023 05:35:31 +0200 Subject: [PATCH 33/78] use patch --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 066744648abb0..f0bf7f723f540 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1312,14 +1312,14 @@ macro(build_snappy) list(APPEND SNAPPY_CMAKE_ARGS "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") endif() - find_program(GIT git) + find_program(PATCH patch) externalproject_add(snappy_ep ${EP_COMMON_OPTIONS} BUILD_IN_SOURCE 1 INSTALL_DIR ${SNAPPY_PREFIX} URL ${SNAPPY_SOURCE_URL} URL_HASH "SHA256=${ARROW_SNAPPY_BUILD_SHA256_CHECKSUM}" - PATCH_COMMAND ${GIT} apply ${CMAKE_CURRENT_LIST_DIR}/snappy.diff + PATCH_COMMAND ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.diff CMAKE_ARGS ${SNAPPY_CMAKE_ARGS} BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}") From 0bd9d3b5d2de163d0d6729293be5d1cbbd454ce3 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 26 Sep 2023 06:31:53 +0200 Subject: [PATCH 34/78] disable libcpp availability check --- dev/tasks/r/github.packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 0d3061eaa5276..d36f9d00e6f8a 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -86,6 +86,7 @@ jobs: ARROW_DEPENDENCY_SOURCE: BUNDLED CMAKE_GENERATOR: Ninja LIBARROW_MINIMAL: false + EXTRA_CMAKE_FLAGS: '-DARROW_CXXFLAGS="-D_LIBCPP_DISABLE_AVAILABILITY"' run: | export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) cd arrow From 122bf4ff146083fba50e596a79ffe0e981b40915 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 26 Sep 2023 06:40:10 +0200 Subject: [PATCH 35/78] explicitly start sccache --- dev/tasks/r/github.packages.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index d36f9d00e6f8a..4478812b6f27c 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -88,6 +88,7 @@ jobs: LIBARROW_MINIMAL: false EXTRA_CMAKE_FLAGS: '-DARROW_CXXFLAGS="-D_LIBCPP_DISABLE_AVAILABILITY"' run: | + sccache --start-server export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) cd arrow r/inst/build_arrow_static.sh From e21f51ba2e2357227f2471eababa9f5c72c9d95e Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 02:55:58 +0200 Subject: [PATCH 36/78] Patch to add on macos 10.13 fix patch --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index f0bf7f723f540..e98dae7a80c51 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1309,17 +1309,25 @@ macro(build_snappy) ${EP_COMMON_CMAKE_ARGS} -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - list(APPEND SNAPPY_CMAKE_ARGS "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") + list(APPEND SNAPPY_CMAKE_ARGS + "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") endif() - find_program(PATCH patch) + # if(APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) + # On macOS 10.13 we need to explicitly add to avoid a missing include error + # This can be removed once CRAN no longer checks on macOS 10.13 + find_program(PATCH patch REQUIRED) + set(SNAPPY_PATCH_COMMAND + ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.diff) + # endif() + externalproject_add(snappy_ep ${EP_COMMON_OPTIONS} BUILD_IN_SOURCE 1 INSTALL_DIR ${SNAPPY_PREFIX} URL ${SNAPPY_SOURCE_URL} URL_HASH "SHA256=${ARROW_SNAPPY_BUILD_SHA256_CHECKSUM}" - PATCH_COMMAND ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.diff + PATCH_COMMAND ${SNAPPY_PATCH_COMMAND} CMAKE_ARGS ${SNAPPY_CMAKE_ARGS} BUILD_BYPRODUCTS "${SNAPPY_STATIC_LIB}") From d72b6b67a7b3d3faf181a1847b48b565107aeb72 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 02:39:43 +0200 Subject: [PATCH 37/78] Disable libcpp availability check on macos <11 fix typo fix patch command use potentially empty patch command --- cpp/cmake_modules/SetupCxxFlags.cmake | 13 ++++++++++--- dev/tasks/r/github.packages.yml | 1 - 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 5531415ac2277..c48f18c2058ab 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -456,11 +456,18 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STRE # Don't complain about optimization passes that were not possible set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} -Wno-pass-failed") - # Avoid clang / libc++ error about C++17 aligned allocation on macOS. - # See https://chromium.googlesource.com/chromium/src/+/eee44569858fc650b635779c4e34be5cb0c73186%5E%21/#F0 - # for details. if(APPLE) + # Avoid clang / libc++ error about C++17 aligned allocation on macOS. + # See https://chromium.googlesource.com/chromium/src/+/eee44569858fc650b635779c4e34be5cb0c73186%5E%21/#F0 + # for details. set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -fno-aligned-new") + + if(CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) + # Avoid C++17 std::get 'not available' issue on macOs 10.13 + # This will be required until atleast R 4.4 is released and + # CRAN (hopefully) stops checking on 10.13 + set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -D_LIBCPP_DISABLE_AVAILABILITY") + endif() endif() endif() diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 4478812b6f27c..d63c2b1e0c549 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -86,7 +86,6 @@ jobs: ARROW_DEPENDENCY_SOURCE: BUNDLED CMAKE_GENERATOR: Ninja LIBARROW_MINIMAL: false - EXTRA_CMAKE_FLAGS: '-DARROW_CXXFLAGS="-D_LIBCPP_DISABLE_AVAILABILITY"' run: | sccache --start-server export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) From 2773faae3a96f1bc28ddd05c79a45003912e5961 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 04:52:47 +0200 Subject: [PATCH 38/78] uncomment conditional --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index e98dae7a80c51..1377f2b87b15b 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1313,13 +1313,13 @@ macro(build_snappy) "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") endif() - # if(APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) + if(APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) # On macOS 10.13 we need to explicitly add to avoid a missing include error # This can be removed once CRAN no longer checks on macOS 10.13 find_program(PATCH patch REQUIRED) set(SNAPPY_PATCH_COMMAND ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.diff) - # endif() + endif() externalproject_add(snappy_ep ${EP_COMMON_OPTIONS} From 854a47c36c1332ab42156c33db489c8a3d59b9b5 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 04:53:11 +0200 Subject: [PATCH 39/78] disable libcpp checks for R package too --- r/configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/r/configure b/r/configure index 19eacd2a3754a..6c749404cab5c 100755 --- a/r/configure +++ b/r/configure @@ -254,6 +254,11 @@ set_pkg_vars () { if [ "$ARROW_R_CXXFLAGS" ]; then PKG_CFLAGS="$PKG_CFLAGS $ARROW_R_CXXFLAGS" fi + + if [ "$UNAME" = "Darwin" -a ${OSTYPE:6} -lt 20]; then + # avoid C++17 availability warnings on macOS < 11 + PKG_CFLAGS="$PKG_CFLAGS -D_LIBCPP_DISABLE_AVAILABILITY" + fi } # If we have pkg-config, it will tell us what libarrow needs From ed536b35e02831bcb635161d0e0657e726db940d Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 05:31:10 +0200 Subject: [PATCH 40/78] fix typo --- r/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/configure b/r/configure index 6c749404cab5c..fdc1f427cb326 100755 --- a/r/configure +++ b/r/configure @@ -255,7 +255,7 @@ set_pkg_vars () { PKG_CFLAGS="$PKG_CFLAGS $ARROW_R_CXXFLAGS" fi - if [ "$UNAME" = "Darwin" -a ${OSTYPE:6} -lt 20]; then + if [ "$UNAME" = "Darwin" -a ${OSTYPE:6} -lt 20 ]; then # avoid C++17 availability warnings on macOS < 11 PKG_CFLAGS="$PKG_CFLAGS -D_LIBCPP_DISABLE_AVAILABILITY" fi From b150b8ab4a7fab389fd028b1d539f99dd6482bfd Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 06:03:52 +0200 Subject: [PATCH 41/78] make macos 10.13 check sh compatible --- r/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/configure b/r/configure index fdc1f427cb326..d1f9337c85e1b 100755 --- a/r/configure +++ b/r/configure @@ -255,7 +255,7 @@ set_pkg_vars () { PKG_CFLAGS="$PKG_CFLAGS $ARROW_R_CXXFLAGS" fi - if [ "$UNAME" = "Darwin" -a ${OSTYPE:6} -lt 20 ]; then + if [ "$UNAME" = "Darwin" -a $(expr substr "$OSTYPE" 7 2) -lt 20 ]; then # avoid C++17 availability warnings on macOS < 11 PKG_CFLAGS="$PKG_CFLAGS -D_LIBCPP_DISABLE_AVAILABILITY" fi From 01e8e953a62b9e367a91a3d4860a24683594d986 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 06:51:51 +0200 Subject: [PATCH 42/78] test another approach to version checking --- r/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/configure b/r/configure index d1f9337c85e1b..5f8eef8b4243b 100755 --- a/r/configure +++ b/r/configure @@ -255,7 +255,7 @@ set_pkg_vars () { PKG_CFLAGS="$PKG_CFLAGS $ARROW_R_CXXFLAGS" fi - if [ "$UNAME" = "Darwin" -a $(expr substr "$OSTYPE" 7 2) -lt 20 ]; then + if [ "$UNAME" = "Darwin" ] && [ $(expr `sw_vers -productVersion` : '10\.13' ) -gt 3 ]; then # avoid C++17 availability warnings on macOS < 11 PKG_CFLAGS="$PKG_CFLAGS -D_LIBCPP_DISABLE_AVAILABILITY" fi From 3f555b523547e5350f5e599a66e80a844db87f11 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 27 Sep 2023 19:20:37 +0200 Subject: [PATCH 43/78] fix openssl root dir --- r/tools/nixlibs.R | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 1fb8873f66143..078c3229f7bce 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -203,9 +203,6 @@ test_for_curl_and_openssl <- " " compile_test_program <- function(code) { - # Note: if we wanted to check for openssl on macOS, we'd have to set the brew - # path as a -I directory. But since we (currently) only run this code to - # determine whether we can download a Linux binary, it's not relevant. openssl_dir <- "" if(on_macos) { openssl_root_dir <- get_macos_openssl_dir() @@ -236,7 +233,7 @@ get_macos_openssl_dir <- function(){ openssl_root_dir <- "/usr/local" } } - return(paste0(openssl_root_dir, "/include")) + return(openssl_root_dir) } # (built with newer devtoolset but older glibc (2.17) for broader compatibility,# like manylinux2014) determine_binary_from_stderr <- function(errs) { From 3b760a0c73d46db56bc674d5286a7bf17f381920 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 01:52:12 +0200 Subject: [PATCH 44/78] use cran style openssl --- dev/tasks/r/github.packages.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index d63c2b1e0c549..2211f615255ca 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -231,15 +231,23 @@ jobs: with: working-directory: 'arrow' extra-packages: cpp11 - - name: Install openssl - if: contains(matrix.platform.runs_on, 'self-hosted') - run: brew install openssl@3 + - name: Install CRAN like openssl + if: contains(matrix.platform.runs_on, 'arm64') + run: | + echo "OPENSSL_ROOT_DIR=/opt/R/arm64" >> $GITHUB_ENV + if [ -d "/opt/R/arm64/include/openssl/" ]; then + exit 0 + fi + git clone https://github.com/R-macos/recipes + cd recipes + ./build.sh openssl - name: Build Binary id: build shell: Rscript {0} env: - NOT_CRAN: "true" # actions/setup-r sets this implicitly + NOT_CRAN: "false" # actions/setup-r sets this implicitly ARROW_R_DEV: "true" + LIBARROW_BINARY: "true" # has to be set as long as allowlist not updated run: | on_windows <- tolower(Sys.info()[["sysname"]]) == "windows" @@ -262,9 +270,10 @@ jobs: repos = sub("file://", "file:", getOption("arrow.dev_repo")),, INSTALL_opts = INSTALL_opts ) - + # Test library(arrow) + arrow_info() read_parquet(system.file("v0.7.1.parquet", package = "arrow")) # encode contrib.url for artifact name From fbc4b8792043678f72d14abcd6522bf16450dace Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 01:52:25 +0200 Subject: [PATCH 45/78] disable centos binary test --- dev/tasks/r/github.packages.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 2211f615255ca..c314d507e2444 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -351,8 +351,11 @@ jobs: with: name: r-pkg_centos7 path: arrow_* + test-centos-binary: - needs: test-linux-binary + #arrow binary package not on ppm currently + if: false + needs: test-linux-binaryO runs-on: ubuntu-latest container: "rstudio/r-base:4.2-centos7" steps: @@ -376,9 +379,9 @@ jobs: library(arrow) read_parquet(system.file("v0.7.1.parquet", package = "arrow")) print(arrow_info()) - - test-source: -#TODO add macos (m1)source build + + #TODO test macos source build? + test-linux-source: needs: source name: Test linux source build runs-on: ubuntu-latest From 5bb1965b0da4a9c9411be80ff80c14fee7132f44 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 02:00:42 +0200 Subject: [PATCH 46/78] fix needs errors --- dev/tasks/r/github.packages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index c314d507e2444..47a6e4b2e5d74 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -355,7 +355,7 @@ jobs: test-centos-binary: #arrow binary package not on ppm currently if: false - needs: test-linux-binaryO + needs: test-linux-binary runs-on: ubuntu-latest container: "rstudio/r-base:4.2-centos7" steps: @@ -431,7 +431,7 @@ jobs: upload-binaries: # Only upload binaries if all tests pass. - needs: [r-packages, test-source, test-linux-binary, test-centos-binary] + needs: [r-packages, test-linux-source, test-linux-binary, test-centos-binary] name: Upload artifacts runs-on: ubuntu-latest steps: From 99b0231d3ff514b96273a3a86c97479cd0ad1aa9 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 02:41:54 +0200 Subject: [PATCH 47/78] print test program invocation --- r/tools/nixlibs.R | 1 + 1 file changed, 1 insertion(+) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 078c3229f7bce..434a50713c073 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -217,6 +217,7 @@ compile_test_program <- function(code) { "-xc++", openssl_dir ) + cat("*** Test Program: ", runner) suppressWarnings(system2("echo", sprintf('"%s" | %s -', code, runner), stdout = FALSE, stderr = TRUE)) } From 0bdef9755526022fe54d6f586c28c96dbc3d4567 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 02:42:52 +0200 Subject: [PATCH 48/78] revert - diable windows build --- dev/tasks/r/github.packages.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 47a6e4b2e5d74..79f075b18de18 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -160,6 +160,7 @@ jobs: path: arrow/r/libarrow/dist/arrow-*.zip windows-cpp: + if: false name: C++ Binary Windows RTools (40 only) needs: source runs-on: windows-latest @@ -195,7 +196,7 @@ jobs: fail-fast: false matrix: platform: - - { runs_on: 'windows-latest', name: "Windows"} + #- { runs_on: 'windows-latest', name: "Windows"} - { runs_on: ["self-hosted", "macos-10.13"], name: "macOS High Sierra"} - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], name: "macOS Big Sur" } r_version: From 7b843062249c6278ae50dad74719acda5ea6293a Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 02:43:57 +0200 Subject: [PATCH 49/78] remove centos job from needs --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 79f075b18de18..189ae9fec59d0 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -432,7 +432,7 @@ jobs: upload-binaries: # Only upload binaries if all tests pass. - needs: [r-packages, test-linux-source, test-linux-binary, test-centos-binary] + needs: [r-packages, test-linux-source, test-linux-binary] name: Upload artifacts runs-on: ubuntu-latest steps: From 53308dee38e08c563f6b91d0ea387c2459a6c0c6 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 04:38:57 +0200 Subject: [PATCH 50/78] adapt test program to libc++ --- r/tools/nixlibs.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 434a50713c073..007e1e4d85bfd 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -183,12 +183,14 @@ select_binary <- function(os = tolower(Sys.info()[["sysname"]]), # 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 +test_for_curl_and_openssl <- paste0(ifelse(on_macos, "", +"#include #ifdef _LIBCPP_VERSION #error Using libc++ #endif +"), +" #include #include #if OPENSSL_VERSION_NUMBER < 0x10002000L @@ -200,7 +202,7 @@ test_for_curl_and_openssl <- " #if OPENSSL_VERSION_NUMBER >= 0x30000000L #error Using OpenSSL version 3 #endif -" +") compile_test_program <- function(code) { openssl_dir <- "" From 0b1cdea5b885db1d77af756d6edcaa1bbac77058 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 04:41:50 +0200 Subject: [PATCH 51/78] update artifact list --- dev/tasks/tasks.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index 29e038a922412..9b9aa0de54ec1 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -994,6 +994,10 @@ tasks: - 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-lib__libarrow__bin__darwin-arm64-openssl-1.1-{no_rc_r_version}\.zip + - r-lib__libarrow__bin__darwin-arm64-openssl-3.0-{no_rc_r_version}\.zip + - r-lib__libarrow__bin__darwin-x86_64-openssl-1.1-{no_rc_r_version}\.zip + - r-lib__libarrow__bin__darwin-x86_64-openssl-3.0-{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 From 29396fef0ef4efff952a0e57de0f08c498f69b2d Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 04:42:12 +0200 Subject: [PATCH 52/78] Revert "revert - diable windows build" This reverts commit 0bdef9755526022fe54d6f586c28c96dbc3d4567. --- dev/tasks/r/github.packages.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 189ae9fec59d0..44fe55f785e8e 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -160,7 +160,6 @@ jobs: path: arrow/r/libarrow/dist/arrow-*.zip windows-cpp: - if: false name: C++ Binary Windows RTools (40 only) needs: source runs-on: windows-latest @@ -196,7 +195,7 @@ jobs: fail-fast: false matrix: platform: - #- { runs_on: 'windows-latest', name: "Windows"} + - { runs_on: 'windows-latest', name: "Windows"} - { runs_on: ["self-hosted", "macos-10.13"], name: "macOS High Sierra"} - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], name: "macOS Big Sur" } r_version: From 22a0d9b7a01fb44f62ccd6f6a937a086a9c89e7f Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 04:43:37 +0200 Subject: [PATCH 53/78] move openssl include before system include --- r/tools/nixlibs.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 007e1e4d85bfd..db99568b7a2f9 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -212,13 +212,12 @@ compile_test_program <- function(code) { } runner <- paste( R_CMD_config("CXX17"), + openssl_dir, R_CMD_config("CPPFLAGS"), R_CMD_config("CXX17FLAGS"), R_CMD_config("CXX17STD"), "-E", - "-xc++", - openssl_dir - ) + "-xc++" ) cat("*** Test Program: ", runner) suppressWarnings(system2("echo", sprintf('"%s" | %s -', code, runner), stdout = FALSE, stderr = TRUE)) } From 80f45951ee63431b058a10486da7072a46d4665c Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 05:00:31 +0200 Subject: [PATCH 54/78] remove cran style openssl for now --- dev/tasks/r/github.packages.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 44fe55f785e8e..29f78f598cb6e 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -231,16 +231,6 @@ jobs: with: working-directory: 'arrow' extra-packages: cpp11 - - name: Install CRAN like openssl - if: contains(matrix.platform.runs_on, 'arm64') - run: | - echo "OPENSSL_ROOT_DIR=/opt/R/arm64" >> $GITHUB_ENV - if [ -d "/opt/R/arm64/include/openssl/" ]; then - exit 0 - fi - git clone https://github.com/R-macos/recipes - cd recipes - ./build.sh openssl - name: Build Binary id: build shell: Rscript {0} From cd473bc4ef87cd563894b212809a8da7df9b428a Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 06:01:15 +0200 Subject: [PATCH 55/78] format cmake --- cpp/cmake_modules/SetupCxxFlags.cmake | 12 ++++++------ cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index c48f18c2058ab..7fb0d41dc915b 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -462,12 +462,12 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STRE # for details. set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -fno-aligned-new") - if(CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) - # Avoid C++17 std::get 'not available' issue on macOs 10.13 - # This will be required until atleast R 4.4 is released and - # CRAN (hopefully) stops checking on 10.13 - set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -D_LIBCPP_DISABLE_AVAILABILITY") - endif() + if(CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) + # Avoid C++17 std::get 'not available' issue on macOs 10.13 + # This will be required until atleast R 4.4 is released and + # CRAN (hopefully) stops checking on 10.13 + set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -D_LIBCPP_DISABLE_AVAILABILITY") + endif() endif() endif() diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 1377f2b87b15b..5c7ea3631eb40 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1317,8 +1317,7 @@ macro(build_snappy) # On macOS 10.13 we need to explicitly add to avoid a missing include error # This can be removed once CRAN no longer checks on macOS 10.13 find_program(PATCH patch REQUIRED) - set(SNAPPY_PATCH_COMMAND - ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.diff) + set(SNAPPY_PATCH_COMMAND ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.diff) endif() externalproject_add(snappy_ep From 07a72d722acc53de57b58672864eff36d712b947 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 07:16:13 +0200 Subject: [PATCH 56/78] fix openssl version for libarrow --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 29f78f598cb6e..be5ec91b22c6e 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -88,7 +88,7 @@ jobs: LIBARROW_MINIMAL: false run: | sccache --start-server - export OPENSSL_ROOT_DIR=$(brew --prefix openssl@{{'${{ matrix.openssl }}' }}) + export EXTRA_CMAKE_FLAGS="-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@${{ matrix.openssl }})" cd arrow r/inst/build_arrow_static.sh - name: Bundle libarrow From 29a8264a4e25b867ddfaceca552f6f56f3efbce3 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 07:18:32 +0200 Subject: [PATCH 57/78] remove debug print --- r/tools/nixlibs.R | 1 - 1 file changed, 1 deletion(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index db99568b7a2f9..69846acc0ebf7 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -218,7 +218,6 @@ compile_test_program <- function(code) { R_CMD_config("CXX17STD"), "-E", "-xc++" ) - cat("*** Test Program: ", runner) suppressWarnings(system2("echo", sprintf('"%s" | %s -', code, runner), stdout = FALSE, stderr = TRUE)) } From 243399551cb3327d1c4b187502fab25cbe89a86c Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 07:19:42 +0200 Subject: [PATCH 58/78] add snappy patch to rat excludes --- dev/release/rat_exclude_files.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/release/rat_exclude_files.txt b/dev/release/rat_exclude_files.txt index aebe321d613ab..af084ea215621 100644 --- a/dev/release/rat_exclude_files.txt +++ b/dev/release/rat_exclude_files.txt @@ -24,6 +24,7 @@ cpp/build-support/iwyu/* cpp/cmake_modules/FindPythonLibsNew.cmake cpp/cmake_modules/SnappyCMakeLists.txt cpp/cmake_modules/SnappyConfig.h +cpp/cmake_modules/snappy.diff cpp/examples/parquet/parquet-arrow/cmake_modules/FindArrow.cmake cpp/src/parquet/.parquetcppversion cpp/src/generated/parquet_constants.cpp From d2984ea020d067fa972b9d4ba45a23f08f55b7dd Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 07:24:49 +0200 Subject: [PATCH 59/78] update comment --- r/configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r/configure b/r/configure index 5f8eef8b4243b..c0b7f12c625fa 100755 --- a/r/configure +++ b/r/configure @@ -39,8 +39,8 @@ # # * Installing a released version from source, as from CRAN, with # no other prior setup -# * On macOS, autobrew is used to retrieve libarrow and dependencies -# * On Linux, the nixlibs.R build script will download or build +# * On macOS and Linux, the nixlibs.R build script will download +# or build libarrow and dependencies # * Installing a released version but first installing libarrow. # It will use pkg-config and brew to search for libraries. # * Installing a development version from source as a user. From 4bb76c812873cc33d418ee06bed126765dd74efc Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 07:28:26 +0200 Subject: [PATCH 60/78] escape gha macro --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index be5ec91b22c6e..7ac5c08c169a6 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -88,7 +88,7 @@ jobs: LIBARROW_MINIMAL: false run: | sccache --start-server - export EXTRA_CMAKE_FLAGS="-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@${{ matrix.openssl }})" + export EXTRA_CMAKE_FLAGS="-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@{{ '${{ matrix.openssl }}' }})" cd arrow r/inst/build_arrow_static.sh - name: Bundle libarrow From 60635af72558df38b6527291a828b25cfb9ec94a Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 14:59:23 +0200 Subject: [PATCH 61/78] explicitly set openssl root dir --- dev/tasks/r/github.packages.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 7ac5c08c169a6..0738e1a64548c 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -231,6 +231,12 @@ jobs: with: working-directory: 'arrow' extra-packages: cpp11 + - name: Set CRAN like openssl + if: contains(matrix.platform.runs_on, 'arm64') + run: | + # The arm64 runners contain openssl 1.1.1t in this path that is always included first so we need to override the + # default setting of the brew --prefix as root dir to avoid version conflicts. + echo "OPENSSL_ROOT_DIR=/opt/R/arm64" >> $GITHUB_ENV - name: Build Binary id: build shell: Rscript {0} From 67528a2c3ddb28ffea0201bd2edad6185c4c85c8 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 15:07:20 +0200 Subject: [PATCH 62/78] address review comments --- dev/tasks/r/github.packages.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 0738e1a64548c..136df2ccd31b1 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -98,7 +98,6 @@ jobs: VERSION: {{ '${{ needs.source.outputs.pkg_version }}' }} run: | cd arrow/r/libarrow/dist - # These files were created by the docker user so we have to sudo to get them zip -r $PKG_FILE lib/ include/ - name: Upload binary artifact @@ -135,8 +134,6 @@ jobs: env: UBUNTU: {{ '"${{ matrix.ubuntu }}"' }} {{ macros.github_set_sccache_envvars()|indent(8) }} - MACOSX_DEPLOYMENT_TARGET: "10.13" - EXTRA_CMAKE_FLAGS: "-Dre2_SOURCE=BUNDLED -DSnappy_SOURCE=BUNDLED -DThrift_SOURCE=BUNDLED -DARROW_VERBOSE_THIRDPARTY_BUILD=ON -DCMAKE_VERBOSE_MAKEFILE=ON" run: | sudo sysctl -w kernel.core_pattern="core.%e.%p" ulimit -c unlimited @@ -349,7 +346,7 @@ jobs: path: arrow_* test-centos-binary: - #arrow binary package not on ppm currently + # arrow binary package not on ppm currently see #37922 if: false needs: test-linux-binary runs-on: ubuntu-latest From 6a040aa4c55702999945b8e87c4bf572b2f7ec81 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 28 Sep 2023 16:02:26 +0200 Subject: [PATCH 63/78] fix artifact names --- dev/tasks/tasks.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index 9b9aa0de54ec1..150e20f81df08 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -994,10 +994,10 @@ tasks: - 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-lib__libarrow__bin__darwin-arm64-openssl-1.1-{no_rc_r_version}\.zip - - r-lib__libarrow__bin__darwin-arm64-openssl-3.0-{no_rc_r_version}\.zip - - r-lib__libarrow__bin__darwin-x86_64-openssl-1.1-{no_rc_r_version}\.zip - - r-lib__libarrow__bin__darwin-x86_64-openssl-3.0-{no_rc_r_version}\.zip + - r-lib__libarrow__bin__darwin-arm64-openssl-1.1__arrow-{no_rc_r_version}\.zip + - r-lib__libarrow__bin__darwin-arm64-openssl-3.0__arrow-{no_rc_r_version}\.zip + - r-lib__libarrow__bin__darwin-x86_64-openssl-1.1__arrow-{no_rc_r_version}\.zip + - r-lib__libarrow__bin__darwin-x86_64-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 From c74a8af3d67d0045bd91f5d03e7a59b356d96973 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 29 Sep 2023 02:56:36 +0200 Subject: [PATCH 64/78] add comment about snappy adding Werror on clang --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 5c7ea3631eb40..f6c15f0b87e5d 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1308,6 +1308,9 @@ macro(build_snappy) set(SNAPPY_CMAKE_ARGS ${EP_COMMON_CMAKE_ARGS} -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF "-DCMAKE_INSTALL_PREFIX=${SNAPPY_PREFIX}") + # Snappy unconditionaly enables Werror when building with clang this can lead + # to build failues by way of new compiler warnings. This adds a flag to disable + # Werror to the very end of the invocation to override the snappy internal setting. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") list(APPEND SNAPPY_CMAKE_ARGS "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") From 6df174de739908dfa5cc660f0f9bb5c3ed4d075d Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 29 Sep 2023 03:12:53 +0200 Subject: [PATCH 65/78] use macro to exclude libcpp test instead of paste --- r/tools/nixlibs.R | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 69846acc0ebf7..e578d24ab4d97 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -183,14 +183,14 @@ select_binary <- function(os = tolower(Sys.info()[["sysname"]]), # 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 <- paste0(ifelse(on_macos, "", -"#include +test_for_curl_and_openssl <- +"#ifndef __APPLE__ +#include #ifdef _LIBCPP_VERSION #error Using libc++ #endif +#endif -"), -" #include #include #if OPENSSL_VERSION_NUMBER < 0x10002000L @@ -202,7 +202,7 @@ test_for_curl_and_openssl <- paste0(ifelse(on_macos, "", #if OPENSSL_VERSION_NUMBER >= 0x30000000L #error Using OpenSSL version 3 #endif -") +" compile_test_program <- function(code) { openssl_dir <- "" From 0887b2ea48a48f3c60ab1076eac2740719fd64d5 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 29 Sep 2023 03:25:15 +0200 Subject: [PATCH 66/78] add libstdc++ check for macos --- r/tools/nixlibs.R | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index e578d24ab4d97..661b841720eb8 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -184,11 +184,13 @@ select_binary <- function(os = tolower(Sys.info()[["sysname"]]), # 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 <- -"#ifndef __APPLE__ -#include +"#include +#ifndef __APPLE__ #ifdef _LIBCPP_VERSION #error Using libc++ #endif +#elif __GLIBCXX__ +#error Using libstdc++ #endif #include @@ -246,7 +248,11 @@ determine_binary_from_stderr <- function(errs) { # Else, check for dealbreakers: } else if (!on_macos && any(grepl("Using libc++", errs, fixed = TRUE))) { # Our linux binaries are all built with GNU stdlib so they fail with libc++ - cat("*** Found libc++\n") + cat("*** Linux binaries incompatible with libc++\n") + return(NULL) + } else if (on_macos && any(grepl("Using libstdc++", errs, fixed = TRUE))) { + # Our macos binaries are all built with libc++ so they fail with GNU libstdc++ + cat("*** MacOS binaries incompatible with libstdc++\n") return(NULL) } else if (header_not_found("curl/curl", errs)) { cat("*** libcurl not found\n") From 01b821369694a55603da401edfcd371945699a88 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 29 Sep 2023 03:37:00 +0200 Subject: [PATCH 67/78] add explaining comment --- r/tools/test-nixlibs.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/r/tools/test-nixlibs.R b/r/tools/test-nixlibs.R index 1377e525756da..c9571b58b7bbf 100644 --- a/r/tools/test-nixlibs.R +++ b/r/tools/test-nixlibs.R @@ -21,6 +21,8 @@ # Flag so that we just load the functions and don't evaluate them like we do # when called from configure.R TESTING <- TRUE +# The functions use `on_macos` from the env they were sourced in, so we need tool +# explicitly set it in that environment. nixlibs_env <- environment() source("nixlibs.R", local = nixlibs_env) From 8f9d3e8fdc5daf7d51bc8d68de38c56c06643d33 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 29 Sep 2023 03:37:31 +0200 Subject: [PATCH 68/78] format --- r/tools/nixlibs.R | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 661b841720eb8..11a0c13a32378 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -96,8 +96,10 @@ download_binary <- function(lib) { } } else { if (!quietly) { - cat(sprintf("*** Downloading libarrow binary failed for version %s (%s)\n at %s\n", - VERSION, lib, binary_url)) + cat(sprintf( + "*** Downloading libarrow binary failed for version %s (%s)\n at %s\n", + VERSION, lib, binary_url + )) } libfile <- NULL } @@ -183,13 +185,13 @@ select_binary <- function(os = tolower(Sys.info()[["sysname"]]), # 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 +test_for_curl_and_openssl <- + "#include #ifndef __APPLE__ #ifdef _LIBCPP_VERSION #error Using libc++ #endif -#elif __GLIBCXX__ +#elif __GLIBCXX__ #error Using libstdc++ #endif @@ -208,7 +210,7 @@ test_for_curl_and_openssl <- compile_test_program <- function(code) { openssl_dir <- "" - if(on_macos) { + if (on_macos) { openssl_root_dir <- get_macos_openssl_dir() openssl_dir <- paste0("-I", openssl_root_dir, "/include") } @@ -219,17 +221,18 @@ compile_test_program <- function(code) { R_CMD_config("CXX17FLAGS"), R_CMD_config("CXX17STD"), "-E", - "-xc++" ) + "-xc++" + ) suppressWarnings(system2("echo", sprintf('"%s" | %s -', code, runner), stdout = FALSE, stderr = TRUE)) } -get_macos_openssl_dir <- function(){ +get_macos_openssl_dir <- function() { openssl_root_dir <- Sys.getenv("OPENSSL_ROOT_DIR", NA) if (is.na(openssl_root_dir)) { # try to guess default openssl include dir based on CRAN's build script # https://github.com/R-macos/recipes/blob/master/build.sh#L35 - if(identical(Sys.info()["machine"], "arm64")){ - openssl_root_dir <- "/opt/R/arm64" + if (identical(Sys.info()["machine"], "arm64")) { + openssl_root_dir <- "/opt/R/arm64" } else if (file.exists("/opt/R/x86_64")) { openssl_root_dir <- "/opt/R/x86_64" } else { @@ -265,7 +268,7 @@ determine_binary_from_stderr <- function(errs) { return(NULL) # Else, determine which other binary will work } else if (any(grepl("Using OpenSSL version 1.0", errs))) { - if(on_macos) { + if (on_macos) { cat("*** OpenSSL 1.0 is not supported on macOS\n") return(NULL) } @@ -287,7 +290,7 @@ header_not_found <- function(header, errs) { distro <- function() { # This is not part of distro but needed to enable prebuilt binaries on macos - if(on_macos) { + if (on_macos) { return(list(id = "darwin", arch = tolower(Sys.info()[["machine"]]))) } @@ -530,8 +533,10 @@ build_libarrow <- function(src_dir, dst_dir) { # It failed :( cat("**** Error building Arrow C++.", "\n") if (quietly) { - cat("**** Printing contents of build log because the build failed", - "while ARROW_R_DEV was set to FALSE\n") + cat( + "**** Printing contents of build log because the build failed", + "while ARROW_R_DEV was set to FALSE\n" + ) cat(readLines(build_log_path), sep = "\n") cat("**** Complete build log may still be present at", build_log_path, "\n") } From 7d696731df3b6b2fb7cbf68210199ded25b7ec24 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 29 Sep 2023 03:37:56 +0200 Subject: [PATCH 69/78] Update dev/tasks/macros.jinja Co-authored-by: Jonathan Keane --- dev/tasks/macros.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index 4255fc068a486..b90684304ea7b 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -308,7 +308,7 @@ on: {% endmacro %} {%- macro github_setup_local_r_repo(get_nix, get_win, get_mac=False) -%} -# TODOf improve arg handling +# TODO: improve arg handling - name: Setup local repo shell: bash run: mkdir repo From 4c19ac57a04e5733de28819aec74e9558778a10d Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Fri, 29 Sep 2023 05:36:56 +0200 Subject: [PATCH 70/78] check for header in openssl root dir --- r/tools/nixlibs.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index 11a0c13a32378..f1d47a5ac2233 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -228,12 +228,13 @@ compile_test_program <- function(code) { get_macos_openssl_dir <- function() { openssl_root_dir <- Sys.getenv("OPENSSL_ROOT_DIR", NA) - if (is.na(openssl_root_dir)) { + header <- "openssl/opensslv.h" + if (is.na(openssl_root_dir) || !file.exists(file.path(openssl_root_dir, "include", header))) { # try to guess default openssl include dir based on CRAN's build script # https://github.com/R-macos/recipes/blob/master/build.sh#L35 - if (identical(Sys.info()["machine"], "arm64")) { + if (identical(Sys.info()["machine"], "arm64") && file.exists(file.path("/opt/R/arm64/include", header))) { openssl_root_dir <- "/opt/R/arm64" - } else if (file.exists("/opt/R/x86_64")) { + } else if (identical(Sys.info()["machine"], "x86_64") && file.exists(file.path("/opt/R/x86_64/include", header))) { openssl_root_dir <- "/opt/R/x86_64" } else { openssl_root_dir <- "/usr/local" @@ -241,6 +242,7 @@ get_macos_openssl_dir <- function() { } return(openssl_root_dir) } + # (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"))) { From 6aa5ab31f9ec6b117dbe3b7bb9d5af7dbea67c1e Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 3 Oct 2023 02:07:36 +0200 Subject: [PATCH 71/78] remove libstdc++ check --- r/tools/nixlibs.R | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index f1d47a5ac2233..d82a3b5e902c8 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -186,14 +186,11 @@ select_binary <- function(os = tolower(Sys.info()[["sysname"]]), # 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 -#ifndef __APPLE__ + "#ifndef __APPLE__ +#include #ifdef _LIBCPP_VERSION #error Using libc++ #endif -#elif __GLIBCXX__ -#error Using libstdc++ -#endif #include #include @@ -255,10 +252,6 @@ determine_binary_from_stderr <- function(errs) { # Our linux binaries are all built with GNU stdlib so they fail with libc++ cat("*** Linux binaries incompatible with libc++\n") return(NULL) - } else if (on_macos && any(grepl("Using libstdc++", errs, fixed = TRUE))) { - # Our macos binaries are all built with libc++ so they fail with GNU libstdc++ - cat("*** MacOS binaries incompatible with libstdc++\n") - return(NULL) } else if (header_not_found("curl/curl", errs)) { cat("*** libcurl not found\n") return(NULL) From 2f11d2dc6c02013829eda5823e149639b3868737 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 3 Oct 2023 02:09:30 +0200 Subject: [PATCH 72/78] add missing endif --- r/tools/nixlibs.R | 1 + 1 file changed, 1 insertion(+) diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index d82a3b5e902c8..f71ea4ec97247 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -191,6 +191,7 @@ test_for_curl_and_openssl <- #ifdef _LIBCPP_VERSION #error Using libc++ #endif +#endif #include #include From 2e4d94e9fc4d164e50720a462375185b5d6280dd Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 3 Oct 2023 07:22:23 +0200 Subject: [PATCH 73/78] Apply suggestions from code review Co-authored-by: Sutou Kouhei --- cpp/cmake_modules/SetupCxxFlags.cmake | 4 ++-- cpp/cmake_modules/ThirdpartyToolchain.cmake | 8 ++++++-- dev/tasks/macros.jinja | 4 ++-- dev/tasks/r/github.packages.yml | 5 ++--- r/tools/nixlibs.R | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 7fb0d41dc915b..91cc7340c543f 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -463,10 +463,10 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STRE set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -fno-aligned-new") if(CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) - # Avoid C++17 std::get 'not available' issue on macOs 10.13 + # Avoid C++17 std::get 'not available' issue on macOS 10.13 # This will be required until atleast R 4.4 is released and # CRAN (hopefully) stops checking on 10.13 - set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -D_LIBCPP_DISABLE_AVAILABILITY") + string(APPEND CXX_ONLY_FLAGS " -D_LIBCPP_DISABLE_AVAILABILITY") endif() endif() endif() diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index f6c15f0b87e5d..6fd7b51454a6c 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1312,8 +1312,10 @@ macro(build_snappy) # to build failues by way of new compiler warnings. This adds a flag to disable # Werror to the very end of the invocation to override the snappy internal setting. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - list(APPEND SNAPPY_CMAKE_ARGS - "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") + foreach(CONFIG DEBUG MINSIZEREL RELEASE RELWITHDEBINFO) + list(APPEND SNAPPY_CMAKE_ARGS + "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") + endforeach() endif() if(APPLE AND CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) @@ -1321,6 +1323,8 @@ macro(build_snappy) # This can be removed once CRAN no longer checks on macOS 10.13 find_program(PATCH patch REQUIRED) set(SNAPPY_PATCH_COMMAND ${PATCH} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/snappy.diff) + else() + set(SNAPPY_PATCH_COMMAND) endif() externalproject_add(snappy_ep diff --git a/dev/tasks/macros.jinja b/dev/tasks/macros.jinja index b90684304ea7b..54f676fd49cd9 100644 --- a/dev/tasks/macros.jinja +++ b/dev/tasks/macros.jinja @@ -330,13 +330,13 @@ on: {% endif %} {% if get_mac %} {% for openssl_version in ["1.1", "3.0"] %} - {% for arch in ["x86_64", "arm64"] %} + {% for arch in ["x86_64", "arm64"] %} - name: Get macOS {{ arch }} OpenSSL {{ openssl_version }} binary uses: actions/download-artifact@v3 with: name: r-lib__libarrow__bin__darwin-{{arch}}-openssl-{{ openssl_version }} path: repo/libarrow/bin/darwin-{{ arch }}-openssl-{{ openssl_version }} - {% endfor %} + {% endfor %} {% endfor %} {% endif %} - name: Get src pkg diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 136df2ccd31b1..357f59aad8b08 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -263,7 +263,8 @@ jobs: repos = sub("file://", "file:", getOption("arrow.dev_repo")),, INSTALL_opts = INSTALL_opts ) - + + # Test library(arrow) arrow_info() @@ -285,8 +286,6 @@ jobs: with: name: r-pkg{{ '${{ steps.build.outputs.path }}' }} path: arrow_* - - test-linux-binary: needs: [source, linux-cpp] name: Test binary {{ '${{ matrix.config.image }}' }} diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R index f71ea4ec97247..60deca05cd172 100644 --- a/r/tools/nixlibs.R +++ b/r/tools/nixlibs.R @@ -185,8 +185,8 @@ select_binary <- function(os = tolower(Sys.info()[["sysname"]]), # 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 <- - "#ifndef __APPLE__ +test_for_curl_and_openssl <- " +#ifndef __APPLE__ #include #ifdef _LIBCPP_VERSION #error Using libc++ From 14ea5584d478a586bbd774345802aad721cb42b7 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Tue, 3 Oct 2023 07:48:36 +0200 Subject: [PATCH 74/78] Update r/configure Co-authored-by: Sutou Kouhei --- r/configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/configure b/r/configure index c0b7f12c625fa..d244b1a7c148f 100755 --- a/r/configure +++ b/r/configure @@ -255,7 +255,7 @@ set_pkg_vars () { PKG_CFLAGS="$PKG_CFLAGS $ARROW_R_CXXFLAGS" fi - if [ "$UNAME" = "Darwin" ] && [ $(expr `sw_vers -productVersion` : '10\.13' ) -gt 3 ]; then + if [ "$UNAME" = "Darwin" ] && expr $(sw_vers -productVersion) : '10\.13'; then # avoid C++17 availability warnings on macOS < 11 PKG_CFLAGS="$PKG_CFLAGS -D_LIBCPP_DISABLE_AVAILABILITY" fi From b5239d1b26d3c76cfb9b1e13cf0bb09c19127605 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 4 Oct 2023 22:58:32 +0200 Subject: [PATCH 75/78] remove ws --- dev/tasks/r/github.packages.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 357f59aad8b08..22116d69975fe 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -371,7 +371,7 @@ jobs: library(arrow) read_parquet(system.file("v0.7.1.parquet", package = "arrow")) print(arrow_info()) - + #TODO test macos source build? test-linux-source: needs: source From e6a127eeaf061611e3b8a381dc51406ee6049dfc Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 4 Oct 2023 22:59:04 +0200 Subject: [PATCH 76/78] remove werror hunk from snappy patch --- cpp/cmake_modules/snappy.diff | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/cpp/cmake_modules/snappy.diff b/cpp/cmake_modules/snappy.diff index 4b9254a387170..f86e2bb19780c 100644 --- a/cpp/cmake_modules/snappy.diff +++ b/cpp/cmake_modules/snappy.diff @@ -1,21 +1,3 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c3062e2..d946037 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -66,13 +66,6 @@ else(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") - endif(NOT CMAKE_CXX_FLAGS MATCHES "-Wextra") - -- # Use -Werror for clang only. -- if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") -- if(NOT CMAKE_CXX_FLAGS MATCHES "-Werror") -- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror") -- endif(NOT CMAKE_CXX_FLAGS MATCHES "-Werror") -- endif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") -- - # Disable C++ exceptions. - string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") diff --git a/snappy.cc b/snappy.cc index d414718..5b0d0d6 100644 --- a/snappy.cc From 99cfe8ae468aaa2a7183fa623e0423bf341fa6a3 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Wed, 4 Oct 2023 23:22:29 +0200 Subject: [PATCH 77/78] format --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 6fd7b51454a6c..6d6a2bf7751ee 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -1313,8 +1313,10 @@ macro(build_snappy) # Werror to the very end of the invocation to override the snappy internal setting. if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") foreach(CONFIG DEBUG MINSIZEREL RELEASE RELWITHDEBINFO) - list(APPEND SNAPPY_CMAKE_ARGS - "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error") + list(APPEND + SNAPPY_CMAKE_ARGS + "-DCMAKE_CXX_FLAGS_${UPPERCASE_BUILD_TYPE}=${EP_CXX_FLAGS_${CONFIG}} -Wno-error" + ) endforeach() endif() From eca2134c73063c6ae88d6c7f7a534b6ef14d6295 Mon Sep 17 00:00:00 2001 From: Jacob Wujciak-Jens Date: Thu, 5 Oct 2023 05:48:14 +0200 Subject: [PATCH 78/78] Apply suggestions from code review Co-authored-by: Sutou Kouhei --- cpp/cmake_modules/SetupCxxFlags.cmake | 2 +- dev/tasks/r/github.packages.yml | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index 91cc7340c543f..e90c00612caa3 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -460,7 +460,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STRE # Avoid clang / libc++ error about C++17 aligned allocation on macOS. # See https://chromium.googlesource.com/chromium/src/+/eee44569858fc650b635779c4e34be5cb0c73186%5E%21/#F0 # for details. - set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -fno-aligned-new") + string(APPEND CXX_ONLY_FLAGS " -fno-aligned-new") if(CMAKE_HOST_SYSTEM_VERSION VERSION_LESS 20) # Avoid C++17 std::get 'not available' issue on macOS 10.13 diff --git a/dev/tasks/r/github.packages.yml b/dev/tasks/r/github.packages.yml index 22116d69975fe..760e3b6da448d 100644 --- a/dev/tasks/r/github.packages.yml +++ b/dev/tasks/r/github.packages.yml @@ -57,14 +57,17 @@ jobs: path: arrow/r/arrow_*.tar.gz macos-cpp: - name: C++ Binary macOS OpenSSL {{ '${{ matrix.openssl }}' }} {{ '${{ matrix.platform.arch }}'}} - runs-on: {{ '${{ matrix.platform.runs_on }}'}} + name: C++ Binary macOS OpenSSL {{ '${{ matrix.openssl }}' }} {{ '${{ matrix.platform.arch }}' }} + + runs-on: {{ '${{ matrix.platform.runs_on }}' }} + needs: source strategy: fail-fast: false matrix: platform: - - { runs_on: ["self-hosted", "macos-10.13"], arch: "x86_64" } + - { runs_on: ["self-hosted", "macos-10.13"], arch: "x86_64" } + - { runs_on: ["self-hosted", "macOS", "arm64", "devops-managed"], arch: "arm64" } openssl: ['3.0', '1.1']