From 34bce67ace38efcd8b773f77405b2ab97eb1cd2c Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Thu, 29 Oct 2026 20:07:44 +0100 Subject: [PATCH 1/9] Fix static linking post-#54905 --- ci/scripts/cpp_test.sh | 22 ++++++++++----- cpp/cmake_modules/ThirdpartyToolchain.cmake | 16 +++++------ cpp/examples/minimal_build/CMakeLists.txt | 27 +++++++++++++++++++ cpp/examples/minimal_build/README.md | 6 +++++ cpp/examples/minimal_build/example.cc | 9 +++++++ cpp/src/arrow/ArrowConfig.cmake.in | 8 +++--- cpp/src/arrow/ArrowGcsConfig.cmake.in | 22 +++++++++++++++ cpp/src/arrow/CMakeLists.txt | 27 +++++++++++++++++++ .../debian/libarrow-gcs-dev.install | 2 +- .../apache-arrow/yum/arrow.spec.in | 2 +- 10 files changed, 122 insertions(+), 19 deletions(-) diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh index 0863afc13a28..d1be11f204e6 100755 --- a/ci/scripts/cpp_test.sh +++ b/ci/scripts/cpp_test.sh @@ -147,18 +147,28 @@ if [ "${ARROW_USE_MESON:-OFF}" = "OFF" ] && \ -S "${source_dir}/examples/minimal_build" \ -B "${build_dir}/examples/minimal_build" \ -DARROW_EXAMPLE_S3_STATIC_CHECK=ON \ + -DARROW_EXAMPLE_GCS_STATIC_CHECK=OFF \ -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" + # Check S3 before discovering GCS dependencies + cmake --build "${build_dir}/examples/minimal_build" + cmake -S "${source_dir}/examples/minimal_build" \ + -B "${build_dir}/examples/minimal_build" \ + -DARROW_EXAMPLE_GCS_STATIC_CHECK=ON cmake --build "${build_dir}/examples/minimal_build" pushd "${source_dir}/examples/minimal_build" # PATH= is for Windows. PATH="${CMAKE_INSTALL_PREFIX:-${ARROW_HOME}}/bin:${PATH}" \ "${build_dir}/examples/minimal_build/arrow-example" - # Test static linking with S3 - s3_example="${build_dir}/examples/minimal_build/arrow-example-s3-static" - if [ -x "${s3_example}" ]; then - PATH="${CMAKE_INSTALL_PREFIX:-${ARROW_HOME}}/bin:${PATH}" \ - "${s3_example}" - fi + # Test static filesystem linking + for static_example in arrow-example-s3-static \ + arrow-example-gcs-static \ + arrow-example-s3-gcs-static; do + example="${build_dir}/examples/minimal_build/${static_example}" + if [ -x "${example}" ]; then + PATH="${CMAKE_INSTALL_PREFIX:-${ARROW_HOME}}/bin:${PATH}" \ + "${example}" + fi + done popd fi diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 123def5b66c5..866544a4e6c2 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -18,11 +18,12 @@ include(ProcessorCount) processorcount(NPROC) -# Accumulate all bundled targets and we will splice them together later as +# Accumulate core bundled targets and we will splice them together later as # libarrow_bundled_dependencies.a so that third party libraries have something # usable to create statically-linked builds with some BUNDLED dependencies, # including allocators like jemalloc and mimalloc set(ARROW_BUNDLED_STATIC_LIBS) +set(ARROW_GCS_BUNDLED_STATIC_LIBS) # Accumulate all system dependencies to provide suitable static link # parameters to the third party libraries. @@ -1942,6 +1943,9 @@ function(build_absl) # When ABSL_ENABLE_INSTALL is ON, the real target is "time" not "absl_time" # Cannot use set_property on alias targets (absl::time is an alias) target_link_libraries(time INTERFACE ${CoreFoundation}) + set(ARROW_PC_LIBS_PRIVATE + "${ARROW_PC_LIBS_PRIVATE} -framework CoreFoundation" + PARENT_SCOPE) endif() list(PREPEND @@ -3860,13 +3864,8 @@ function(build_google_cloud_cpp_storage) # 141MB -> 79MB file(REMOVE_RECURSE "${google_cloud_cpp_SOURCE_DIR}/ci") - list(PREPEND - ARROW_BUNDLED_STATIC_LIBS - google-cloud-cpp::storage - google-cloud-cpp::rest_internal - google-cloud-cpp::common) - set(ARROW_BUNDLED_STATIC_LIBS - ${ARROW_BUNDLED_STATIC_LIBS} + set(ARROW_GCS_BUNDLED_STATIC_LIBS + google-cloud-cpp::storage google-cloud-cpp::rest_internal google-cloud-cpp::common PARENT_SCOPE) list(POP_BACK CMAKE_MESSAGE_INDENT) @@ -4509,3 +4508,4 @@ if(ARROW_FLIGHT_SQL_ODBC) endif() message(STATUS "All bundled static libraries: ${ARROW_BUNDLED_STATIC_LIBS}") +message(STATUS "GCS bundled static libraries: ${ARROW_GCS_BUNDLED_STATIC_LIBS}") diff --git a/cpp/examples/minimal_build/CMakeLists.txt b/cpp/examples/minimal_build/CMakeLists.txt index e1a9217401f2..0b7cf9080b45 100644 --- a/cpp/examples/minimal_build/CMakeLists.txt +++ b/cpp/examples/minimal_build/CMakeLists.txt @@ -67,3 +67,30 @@ elseif(ARROW_EXAMPLE_S3_STATIC_CHECK) message(STATUS "Skipping arrow-example-s3-static: " "requires ARROW_S3 and Arrow::arrow_static") endif() + +option(ARROW_EXAMPLE_GCS_STATIC_CHECK "Verify GCS and static linking" OFF) +if(ARROW_EXAMPLE_GCS_STATIC_CHECK + AND ARROW_GCS + AND TARGET Arrow::arrow_static) + find_package(ArrowGcs REQUIRED) + if(NOT TARGET ArrowGcs::arrow_gcs_static) + message(FATAL_ERROR "ArrowGcs::arrow_gcs_static not found") + endif() + add_executable(arrow-example-gcs-static example.cc) + target_compile_definitions(arrow-example-gcs-static + PRIVATE ARROW_EXAMPLE_GCS_STATIC_CHECK) + target_link_libraries(arrow-example-gcs-static PRIVATE ArrowGcs::arrow_gcs_static) + + if(TARGET ArrowS3::arrow_s3_static) + add_executable(arrow-example-s3-gcs-static example.cc) + target_compile_definitions(arrow-example-s3-gcs-static + PRIVATE ARROW_EXAMPLE_S3_STATIC_CHECK + ARROW_EXAMPLE_GCS_STATIC_CHECK) + target_link_libraries(arrow-example-s3-gcs-static PRIVATE ArrowS3::arrow_s3_static + ArrowGcs::arrow_gcs_static) + endif() + +elseif(ARROW_EXAMPLE_GCS_STATIC_CHECK) + message(STATUS "Skipping GCS static examples: requires ARROW_GCS and Arrow::arrow_static" + ) +endif() diff --git a/cpp/examples/minimal_build/README.md b/cpp/examples/minimal_build/README.md index 3403ce95e5b2..ca76c33cd70e 100644 --- a/cpp/examples/minimal_build/README.md +++ b/cpp/examples/minimal_build/README.md @@ -85,4 +85,10 @@ system. To run this configuration, set docker compose run --rm static-system-dependency ``` +### Static filesystem examples + +Enable `ARROW_EXAMPLE_S3_STATIC_CHECK` or `ARROW_EXAMPLE_GCS_STATIC_CHECK` +to test static linking. Enable both to also test S3 and GCS together. +Run the examples from this directory. + [docker-compose]: https://docs.docker.com/compose/ diff --git a/cpp/examples/minimal_build/example.cc b/cpp/examples/minimal_build/example.cc index f600f9429d6f..3652bc2e4341 100644 --- a/cpp/examples/minimal_build/example.cc +++ b/cpp/examples/minimal_build/example.cc @@ -16,6 +16,9 @@ // under the License. #include +#ifdef ARROW_EXAMPLE_GCS_STATIC_CHECK +# include +#endif #ifdef ARROW_EXAMPLE_S3_STATIC_CHECK # include #endif @@ -63,6 +66,12 @@ Status RunMain(int argc, char** argv) { ARROW_RETURN_NOT_OK(arrow::fs::EnsureS3Finalized()); #endif +#ifdef ARROW_EXAMPLE_GCS_STATIC_CHECK + std::cerr << "* Verify GCS filesystem construction" << std::endl; + ARROW_RETURN_NOT_OK( + arrow::fs::GcsFileSystem::Make(arrow::fs::GcsOptions::Anonymous()).status()); +#endif + return Status::OK(); } diff --git a/cpp/src/arrow/ArrowConfig.cmake.in b/cpp/src/arrow/ArrowConfig.cmake.in index c12b3ce71033..0615b8f0e120 100644 --- a/cpp/src/arrow/ArrowConfig.cmake.in +++ b/cpp/src/arrow/ArrowConfig.cmake.in @@ -132,11 +132,13 @@ if(TARGET Arrow::arrow_static AND NOT TARGET Arrow::arrow_bundled_dependencies) # https://cmake.org/cmake/help/latest/policy/CMP0057.html cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) + if(APPLE AND ("aws-c-common" IN_LIST ARROW_BUNDLED_STATIC_LIBS + OR "absl::time" IN_LIST ARROW_BUNDLED_STATIC_LIBS)) + find_library(CORE_FOUNDATION CoreFoundation) + target_link_libraries(Arrow::arrow_bundled_dependencies INTERFACE ${CORE_FOUNDATION}) + endif() if("aws-c-common" IN_LIST ARROW_BUNDLED_STATIC_LIBS) if(APPLE) - find_library(CORE_FOUNDATION CoreFoundation) - target_link_libraries(Arrow::arrow_bundled_dependencies - INTERFACE ${CORE_FOUNDATION}) find_library(NETWORK Network) target_link_libraries(Arrow::arrow_bundled_dependencies INTERFACE ${NETWORK}) find_library(SECURITY Security) diff --git a/cpp/src/arrow/ArrowGcsConfig.cmake.in b/cpp/src/arrow/ArrowGcsConfig.cmake.in index 9e82b03a1e0a..4367ff4422df 100644 --- a/cpp/src/arrow/ArrowGcsConfig.cmake.in +++ b/cpp/src/arrow/ArrowGcsConfig.cmake.in @@ -27,6 +27,7 @@ @PACKAGE_INIT@ set(ARROW_GCS_SYSTEM_DEPENDENCIES "@ARROW_GCS_SYSTEM_DEPENDENCIES@") +set(ARROW_GCS_BUNDLED_STATIC_LIBS "@ARROW_GCS_BUNDLED_STATIC_LIBS@") include(CMakeFindDependencyMacro) find_dependency(Arrow CONFIG) @@ -37,6 +38,27 @@ endif() include("${CMAKE_CURRENT_LIST_DIR}/ArrowGcsTargets.cmake") +if(TARGET ArrowGcs::arrow_gcs_static + AND ARROW_GCS_BUNDLED_STATIC_LIBS + AND NOT TARGET ArrowGcs::arrow_gcs_bundled_dependencies) + add_library(ArrowGcs::arrow_gcs_bundled_dependencies STATIC IMPORTED) + get_target_property(arrow_gcs_static_configurations ArrowGcs::arrow_gcs_static + IMPORTED_CONFIGURATIONS) + foreach(CONFIGURATION ${arrow_gcs_static_configurations}) + string(TOUPPER "${CONFIGURATION}" CONFIGURATION) + get_target_property(arrow_gcs_static_location ArrowGcs::arrow_gcs_static + IMPORTED_LOCATION_${CONFIGURATION}) + get_filename_component(arrow_gcs_lib_dir "${arrow_gcs_static_location}" DIRECTORY) + set_property(TARGET ArrowGcs::arrow_gcs_bundled_dependencies + APPEND + PROPERTY IMPORTED_CONFIGURATIONS ${CONFIGURATION}) + set_target_properties(ArrowGcs::arrow_gcs_bundled_dependencies + PROPERTIES IMPORTED_LOCATION_${CONFIGURATION} + "${arrow_gcs_lib_dir}/${CMAKE_STATIC_LIBRARY_PREFIX}arrow_gcs_bundled_dependencies${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + endforeach() +endif() + arrow_keep_backward_compatibility(ArrowGcs arrow_gcs) check_required_components(ArrowGcs) diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt index e71d92fdb880..6ceca297be3d 100644 --- a/cpp/src/arrow/CMakeLists.txt +++ b/cpp/src/arrow/CMakeLists.txt @@ -970,10 +970,37 @@ if(ARROW_FILESYSTEM) endif() if(ARROW_GCS) set(ARROW_GCS_STATIC_INSTALL_INTERFACE_LIBS Arrow::arrow_static) + if(ARROW_BUILD_STATIC AND ARROW_GCS_BUNDLED_STATIC_LIBS) + arrow_car(_FIRST_GCS_LIB ${ARROW_GCS_BUNDLED_STATIC_LIBS}) + arrow_cdr(_OTHER_GCS_LIBS ${ARROW_GCS_BUNDLED_STATIC_LIBS}) + arrow_create_merged_static_lib(arrow_gcs_bundled_dependencies + NAME + arrow_gcs_bundled_dependencies + ROOT + ${_FIRST_GCS_LIB} + TO_MERGE + ${_OTHER_GCS_LIBS}) + get_target_property(arrow_gcs_bundled_dependencies_path + arrow_gcs_bundled_dependencies IMPORTED_LOCATION) + install(FILES ${arrow_gcs_bundled_dependencies_path} ${INSTALL_IS_OPTIONAL} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) + string(PREPEND ARROW_GCS_PC_LIBS_PRIVATE " -larrow_gcs_bundled_dependencies") + # Resolve bundled Abseil after SDK + list(PREPEND ARROW_GCS_STATIC_INSTALL_INTERFACE_LIBS + ArrowGcs::arrow_gcs_bundled_dependencies) + endif() if(google_cloud_cpp_storage_SOURCE STREQUAL "SYSTEM") list(APPEND ARROW_GCS_STATIC_INSTALL_INTERFACE_LIBS google-cloud-cpp::storage) elseif(google_cloud_cpp_storage_SOURCE STREQUAL "BUNDLED") list(APPEND ARROW_GCS_STATIC_INSTALL_INTERFACE_LIBS CURL::libcurl) + if(WIN32) + list(APPEND + ARROW_GCS_STATIC_INSTALL_INTERFACE_LIBS + ws2_32 + bcrypt + crypt32) + string(APPEND ARROW_GCS_PC_LIBS_PRIVATE " -lws2_32 -lbcrypt -lcrypt32") + endif() if(absl_SOURCE STREQUAL "SYSTEM") # Bundled google-cloud-cpp with system Abseil needs these for static consumers. list(APPEND diff --git a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-gcs-dev.install b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-gcs-dev.install index ccce70981d2f..432005e7b8b2 100644 --- a/dev/tasks/linux-packages/apache-arrow/debian/libarrow-gcs-dev.install +++ b/dev/tasks/linux-packages/apache-arrow/debian/libarrow-gcs-dev.install @@ -1,4 +1,4 @@ usr/lib/*/cmake/ArrowGcs/ -usr/lib/*/libarrow_gcs.a +usr/lib/*/libarrow_gcs*.a usr/lib/*/libarrow_gcs.so usr/lib/*/pkgconfig/arrow-gcs.pc diff --git a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in index c4a10036ecfe..946198442f66 100644 --- a/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in +++ b/dev/tasks/linux-packages/apache-arrow/yum/arrow.spec.in @@ -387,7 +387,7 @@ Libraries and header files for Apache Arrow GCS filesystem. %doc README.md %license LICENSE.txt NOTICE.txt %{_libdir}/cmake/ArrowGcs/ -%{_libdir}/libarrow_gcs.a +%{_libdir}/libarrow_gcs*.a %{_libdir}/libarrow_gcs.so %{_libdir}/pkgconfig/arrow-gcs.pc %endif From fe52c64c32a3cd3d051a2b6d5dc02a7880462253 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Thu, 29 Oct 2026 20:57:30 +0100 Subject: [PATCH 2/9] Abseil order fix --- cpp/src/arrow/ArrowGcsConfig.cmake.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/src/arrow/ArrowGcsConfig.cmake.in b/cpp/src/arrow/ArrowGcsConfig.cmake.in index 4367ff4422df..7098088b0e29 100644 --- a/cpp/src/arrow/ArrowGcsConfig.cmake.in +++ b/cpp/src/arrow/ArrowGcsConfig.cmake.in @@ -42,6 +42,10 @@ if(TARGET ArrowGcs::arrow_gcs_static AND ARROW_GCS_BUNDLED_STATIC_LIBS AND NOT TARGET ArrowGcs::arrow_gcs_bundled_dependencies) add_library(ArrowGcs::arrow_gcs_bundled_dependencies STATIC IMPORTED) + if("@absl_SOURCE@" STREQUAL "BUNDLED") + target_link_libraries(ArrowGcs::arrow_gcs_bundled_dependencies + INTERFACE Arrow::arrow_bundled_dependencies) + endif() get_target_property(arrow_gcs_static_configurations ArrowGcs::arrow_gcs_static IMPORTED_CONFIGURATIONS) foreach(CONFIGURATION ${arrow_gcs_static_configurations}) From d1528240edaa9ffb75729ffd034a457cc6a82ffa Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Thu, 29 Oct 2026 22:22:02 +0100 Subject: [PATCH 3/9] curl/OpenSSL order fix --- cpp/src/arrow/ArrowConfig.cmake.in | 9 +++++++++ cpp/src/arrow/ArrowGcsConfig.cmake.in | 13 +++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/cpp/src/arrow/ArrowConfig.cmake.in b/cpp/src/arrow/ArrowConfig.cmake.in index 0615b8f0e120..6bbb53a2f76e 100644 --- a/cpp/src/arrow/ArrowConfig.cmake.in +++ b/cpp/src/arrow/ArrowConfig.cmake.in @@ -128,6 +128,15 @@ if(TARGET Arrow::arrow_static AND NOT TARGET Arrow::arrow_bundled_dependencies) ) endforeach() + if(ARROW_BUNDLED_STATIC_LIBS) + get_target_property(arrow_bundled_dependencies_link_libs Arrow::arrow_static + INTERFACE_LINK_LIBRARIES) + list(REMOVE_ITEM arrow_bundled_dependencies_link_libs + Arrow::arrow_bundled_dependencies) + target_link_libraries(Arrow::arrow_bundled_dependencies + INTERFACE ${arrow_bundled_dependencies_link_libs}) + endif() + # CMP0057: Support new if() IN_LIST operator. # https://cmake.org/cmake/help/latest/policy/CMP0057.html cmake_policy(PUSH) diff --git a/cpp/src/arrow/ArrowGcsConfig.cmake.in b/cpp/src/arrow/ArrowGcsConfig.cmake.in index 7098088b0e29..2fc68387a4d2 100644 --- a/cpp/src/arrow/ArrowGcsConfig.cmake.in +++ b/cpp/src/arrow/ArrowGcsConfig.cmake.in @@ -42,10 +42,19 @@ if(TARGET ArrowGcs::arrow_gcs_static AND ARROW_GCS_BUNDLED_STATIC_LIBS AND NOT TARGET ArrowGcs::arrow_gcs_bundled_dependencies) add_library(ArrowGcs::arrow_gcs_bundled_dependencies STATIC IMPORTED) + get_target_property(arrow_gcs_bundled_dependencies_link_libs ArrowGcs::arrow_gcs_static + INTERFACE_LINK_LIBRARIES) + list(REMOVE_ITEM arrow_gcs_bundled_dependencies_link_libs + ArrowGcs::arrow_gcs_bundled_dependencies Arrow::arrow_static) if("@absl_SOURCE@" STREQUAL "BUNDLED") - target_link_libraries(ArrowGcs::arrow_gcs_bundled_dependencies - INTERFACE Arrow::arrow_bundled_dependencies) + list(APPEND arrow_gcs_bundled_dependencies_link_libs + Arrow::arrow_bundled_dependencies) endif() + if(NOT WIN32) + list(APPEND arrow_gcs_bundled_dependencies_link_libs OpenSSL::Crypto) + endif() + target_link_libraries(ArrowGcs::arrow_gcs_bundled_dependencies + INTERFACE ${arrow_gcs_bundled_dependencies_link_libs}) get_target_property(arrow_gcs_static_configurations ArrowGcs::arrow_gcs_static IMPORTED_CONFIGURATIONS) foreach(CONFIGURATION ${arrow_gcs_static_configurations}) From eb35d631e4857ef6ce9869157e6123cf40eba920 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Wed, 11 Nov 2026 19:51:43 +0100 Subject: [PATCH 4/9] Fix R static linking --- r/configure | 6 +++++- r/configure.win | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/r/configure b/r/configure index 87b48d572887..e5fa53d6ab98 100755 --- a/r/configure +++ b/r/configure @@ -370,7 +370,11 @@ add_feature_flags () { if arrow_built_with ARROW_GCS; then PKG_CFLAGS_FEATURES="$PKG_CFLAGS_FEATURES -DARROW_R_WITH_GCS" PKG_CONFIG_NAMES_FEATURES="$PKG_CONFIG_NAMES_FEATURES arrow-gcs" - PKG_LIBS_FEATURES_WITHOUT_PC="-larrow_gcs $PKG_LIBS_FEATURES_WITHOUT_PC" + if [ -n "$(find "$LIB_DIR" -name 'libarrow_gcs_bundled_dependencies.*')" ]; then + PKG_LIBS_FEATURES_WITHOUT_PC="-larrow_gcs -larrow_gcs_bundled_dependencies $PKG_LIBS_FEATURES_WITHOUT_PC" + else + PKG_LIBS_FEATURES_WITHOUT_PC="-larrow_gcs $PKG_LIBS_FEATURES_WITHOUT_PC" + fi # NOTE: arrow_gcs is assumed to have the same -L flag as arrow # so there is no need to add its location to PKG_DIRS fi diff --git a/r/configure.win b/r/configure.win index 44b8ff9c0b39..8541cace14ef 100755 --- a/r/configure.win +++ b/r/configure.win @@ -89,7 +89,8 @@ function configure_binaries() { PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) ' PKG_LIBS="$PKG_LIBS -L${RWINLIB}/lib"'$(R_ARCH)$(CRT) ' PKG_LIBS="$PKG_LIBS -larrow_dataset -larrow_acero -lparquet -larrow_compute -larrow_s3 \ - -larrow_gcs -larrow -larrow_bundled_dependencies \ + -larrow_gcs -larrow_gcs_bundled_dependencies -larrow \ + -larrow_bundled_dependencies \ -lutf8proc -lsnappy -lz -lzstd -llz4 -lbz2 -lole32 \ ${MIMALLOC_LIBS} ${OPENSSL_LIBS} -lre2 ${AWS_LIBS} ${GCS_LIBS}" # ${AZURE_LIBS} From 2e189b372c5d3c5e72a8bb9a976fac835543373d Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Wed, 11 Nov 2026 21:18:58 +0100 Subject: [PATCH 5/9] Fix order of GCS OpenSSL link --- cpp/src/arrow/ArrowGcsConfig.cmake.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/src/arrow/ArrowGcsConfig.cmake.in b/cpp/src/arrow/ArrowGcsConfig.cmake.in index 2fc68387a4d2..7768a307b329 100644 --- a/cpp/src/arrow/ArrowGcsConfig.cmake.in +++ b/cpp/src/arrow/ArrowGcsConfig.cmake.in @@ -51,7 +51,7 @@ if(TARGET ArrowGcs::arrow_gcs_static Arrow::arrow_bundled_dependencies) endif() if(NOT WIN32) - list(APPEND arrow_gcs_bundled_dependencies_link_libs OpenSSL::Crypto) + list(APPEND arrow_gcs_bundled_dependencies_link_libs OpenSSL::SSL OpenSSL::Crypto) endif() target_link_libraries(ArrowGcs::arrow_gcs_bundled_dependencies INTERFACE ${arrow_gcs_bundled_dependencies_link_libs}) From b0b55b0ed362a4b2938d37f6123f4aacbab75a4e Mon Sep 17 00:00:00 2001 From: tadeja Date: Thu, 12 Nov 2026 10:44:36 +0100 Subject: [PATCH 6/9] Remove duplicate arrow_gcs library reference Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- r/configure.win | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/r/configure.win b/r/configure.win index 8541cace14ef..82b8c127f64f 100755 --- a/r/configure.win +++ b/r/configure.win @@ -89,7 +89,9 @@ function configure_binaries() { PKG_LIBS="-L${RWINLIB}/lib"'$(subst gcc,,$(COMPILED_BY))$(R_ARCH) ' PKG_LIBS="$PKG_LIBS -L${RWINLIB}/lib"'$(R_ARCH)$(CRT) ' PKG_LIBS="$PKG_LIBS -larrow_dataset -larrow_acero -lparquet -larrow_compute -larrow_s3 \ - -larrow_gcs -larrow_gcs_bundled_dependencies -larrow \ + -larrow_gcs \$(if \$(wildcard \ + ${RWINLIB}/lib\$(subst gcc,,\$(COMPILED_BY))\$(R_ARCH)/libarrow_gcs_bundled_dependencies.a \ + ${RWINLIB}/lib\$(R_ARCH)\$(CRT)/libarrow_gcs_bundled_dependencies.a),-larrow_gcs_bundled_dependencies) -larrow \ -larrow_bundled_dependencies \ -lutf8proc -lsnappy -lz -lzstd -llz4 -lbz2 -lole32 \ ${MIMALLOC_LIBS} ${OPENSSL_LIBS} -lre2 ${AWS_LIBS} ${GCS_LIBS}" # ${AZURE_LIBS} From 04198cfb9fcc0ad62787f322eda9f032bcec6b1e Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Thu, 12 Nov 2026 11:08:07 +0100 Subject: [PATCH 7/9] Add OpenSSL pkg-config --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 866544a4e6c2..9c1967b4ac2a 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -4452,6 +4452,10 @@ endif() if(ARROW_BUILD_STATIC) if(ARROW_GCS AND google_cloud_cpp_storage_SOURCE STREQUAL "BUNDLED") arrow_append_pc_system_library("libcurl" ARROW_GCS_CURL_PC "-lcurl" ARROW_GCS) + if(NOT WIN32) + arrow_append_pc_system_library("openssl" ARROW_GCS_OPENSSL_PC "-lssl -lcrypto" + ARROW_GCS) + endif() endif() if(ARROW_AZURE AND AZURE_SDK_VENDORED From 57f6da7b56fddc68922f6e42dd03707a74549ccf Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Thu, 12 Nov 2026 13:19:08 +0100 Subject: [PATCH 8/9] Single minimal_build config and update building docs --- ci/scripts/cpp_test.sh | 7 +------ docs/source/developers/cpp/building.rst | 6 +++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh index d1be11f204e6..e64f516e64cd 100755 --- a/ci/scripts/cpp_test.sh +++ b/ci/scripts/cpp_test.sh @@ -147,13 +147,8 @@ if [ "${ARROW_USE_MESON:-OFF}" = "OFF" ] && \ -S "${source_dir}/examples/minimal_build" \ -B "${build_dir}/examples/minimal_build" \ -DARROW_EXAMPLE_S3_STATIC_CHECK=ON \ - -DARROW_EXAMPLE_GCS_STATIC_CHECK=OFF \ + -DARROW_EXAMPLE_GCS_STATIC_CHECK=ON \ -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" - # Check S3 before discovering GCS dependencies - cmake --build "${build_dir}/examples/minimal_build" - cmake -S "${source_dir}/examples/minimal_build" \ - -B "${build_dir}/examples/minimal_build" \ - -DARROW_EXAMPLE_GCS_STATIC_CHECK=ON cmake --build "${build_dir}/examples/minimal_build" pushd "${source_dir}/examples/minimal_build" # PATH= is for Windows. diff --git a/docs/source/developers/cpp/building.rst b/docs/source/developers/cpp/building.rst index b284e2d7c9b2..8e40b047fd53 100644 --- a/docs/source/developers/cpp/building.rst +++ b/docs/source/developers/cpp/building.rst @@ -600,7 +600,7 @@ downloading them (one for each build dir!). Statically Linking ------------------ -When ``-DARROW_BUILD_STATIC=ON``, all build dependencies built as static +When ``-DARROW_BUILD_STATIC=ON``, core build dependencies built as static libraries by the Arrow build system will be merged together to create a static library ``arrow_bundled_dependencies``. In UNIX-like environments (Linux, macOS, MinGW), this is called ``libarrow_bundled_dependencies.a`` and on Windows with @@ -614,6 +614,10 @@ an `example CMake-based build configuration `_ to show you a working example. +With ``-DARROW_GCS=ON``, a bundled google-cloud-cpp goes into a separate +``arrow_gcs_bundled_dependencies`` library. The ``ArrowGcs::arrow_gcs_static`` +CMake target includes it automatically, otherwise link it right after ``arrow_gcs``. + On Linux and macOS, if your application does not link to the ``pthread`` library already, you must include ``-pthread`` in your linker setup. In CMake this can be accomplished with the ``Threads`` built-in package: From 3b04d01166543bad8d135f97e8fbff941d318109 Mon Sep 17 00:00:00 2001 From: Tadeja Kadunc Date: Fri, 13 Nov 2026 11:36:14 +0100 Subject: [PATCH 9/9] Explicit S3 check before target. Reorder fix --- ci/scripts/cpp_test.sh | 2 +- cpp/examples/minimal_build/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/scripts/cpp_test.sh b/ci/scripts/cpp_test.sh index e64f516e64cd..e74a832f0d4d 100755 --- a/ci/scripts/cpp_test.sh +++ b/ci/scripts/cpp_test.sh @@ -146,8 +146,8 @@ if [ "${ARROW_USE_MESON:-OFF}" = "OFF" ] && \ cmake \ -S "${source_dir}/examples/minimal_build" \ -B "${build_dir}/examples/minimal_build" \ - -DARROW_EXAMPLE_S3_STATIC_CHECK=ON \ -DARROW_EXAMPLE_GCS_STATIC_CHECK=ON \ + -DARROW_EXAMPLE_S3_STATIC_CHECK=ON \ -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" cmake --build "${build_dir}/examples/minimal_build" pushd "${source_dir}/examples/minimal_build" diff --git a/cpp/examples/minimal_build/CMakeLists.txt b/cpp/examples/minimal_build/CMakeLists.txt index 0b7cf9080b45..c56ddb0b40ef 100644 --- a/cpp/examples/minimal_build/CMakeLists.txt +++ b/cpp/examples/minimal_build/CMakeLists.txt @@ -81,7 +81,7 @@ if(ARROW_EXAMPLE_GCS_STATIC_CHECK PRIVATE ARROW_EXAMPLE_GCS_STATIC_CHECK) target_link_libraries(arrow-example-gcs-static PRIVATE ArrowGcs::arrow_gcs_static) - if(TARGET ArrowS3::arrow_s3_static) + if(ARROW_EXAMPLE_S3_STATIC_CHECK AND TARGET ArrowS3::arrow_s3_static) add_executable(arrow-example-s3-gcs-static example.cc) target_compile_definitions(arrow-example-s3-gcs-static PRIVATE ARROW_EXAMPLE_S3_STATIC_CHECK