From db5a6ff6e3a9e4f62724ee1cbba393c6c766dc34 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Wed, 10 Jul 2024 22:00:13 -0300 Subject: [PATCH 1/6] cmake: Improve error message hinting to alternative way of fixing --- cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 2e2a4971840a8..8247043b8bf84 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -689,7 +689,7 @@ endif() if("${ARROW_TEST_LINKAGE}" STREQUAL "shared") if(ARROW_BUILD_TESTS AND NOT ARROW_BUILD_SHARED) - message(FATAL_ERROR "If using shared linkage for unit tests, must also \ + message(FATAL_ERROR "If using ARROW_TEST_LINKAGE=shared, must also \ pass ARROW_BUILD_SHARED=on") endif() # Use shared linking for unit tests if it's available From 0ef397f548580c96a2ff5784e9e0e3a1d5b4fb39 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Wed, 10 Jul 2024 22:11:03 -0300 Subject: [PATCH 2/6] cmake: Use the normal dependency resolution scheme for abseil --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 46 ++++++++------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 8cb3ec83f57db..12fd53bc6980b 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -2874,33 +2874,6 @@ endmacro() # ---------------------------------------------------------------------- # Dependencies for Arrow Flight RPC -macro(ensure_absl) - if(NOT absl_FOUND) - if(${absl_SOURCE} STREQUAL "AUTO") - # We can't use resolve_dependency(absl 20211102) to use Abseil - # 20211102 or later because Abseil's CMake package uses "EXACT" - # version match strategy. Our CMake configuration will work with - # Abseil LTS 20211102 or later. So we want to accept Abseil LTS - # 20211102 or later. We need to update - # ARROW_ABSL_REQUIRED_LTS_VERSIONS list when new Abseil LTS is - # released. - set(ARROW_ABSL_REQUIRED_LTS_VERSIONS 20230125 20220623 20211102) - foreach(_VERSION ${ARROW_ABSL_REQUIRED_LTS_VERSIONS}) - find_package(absl ${_VERSION}) - if(absl_FOUND) - break() - endif() - endforeach() - # If we can't find Abseil LTS 20211102 or later, we use bundled - # Abseil. - if(NOT absl_FOUND) - set(absl_SOURCE "BUNDLED") - endif() - endif() - resolve_dependency(absl) - endif() -endmacro() - macro(build_absl) message(STATUS "Building Abseil-cpp from source") set(absl_FOUND TRUE) @@ -3845,7 +3818,6 @@ macro(build_grpc) TRUE PC_PACKAGE_NAMES libcares) - ensure_absl() message(STATUS "Building gRPC from source") @@ -4135,6 +4107,23 @@ macro(build_grpc) endif() endmacro() +if(ARROW_WITH_GOOGLE_CLOUD_CPP OR ARROW_WITH_GRPC) + # Google Cloud C++ SDK and gRPC require Google Abseil + resolve_dependency(absl + ARROW_CMAKE_PACKAGE_NAME + ArrowFlight + ARROW_PC_PACKAGE_NAME + arrow-flight + HAVE_ALT + FALSE + FORCE_ANY_NEWER_VERSION + TRUE + PC_PACKAGE_NAMES + absl + REQUIRED_VERSION + ${ARROW_ABSL_REQUIRED_VERSION}) +endif() + if(ARROW_WITH_GRPC) if(NOT ARROW_ENABLE_THREADING) message(FATAL_ERROR "Can't use gRPC with ARROW_ENABLE_THREADING=OFF") @@ -4259,7 +4248,6 @@ macro(build_google_cloud_cpp_storage) message(STATUS "Only building the google-cloud-cpp::storage component") # List of dependencies taken from https://github.com/googleapis/google-cloud-cpp/blob/main/doc/packaging.md - ensure_absl() build_crc32c_once() # Curl is required on all platforms, but building it internally might also trip over S3's copy. From 9c07dfa00ac31fabb7181ebb67c91e10fe524aed Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Thu, 11 Jul 2024 13:45:21 -0300 Subject: [PATCH 3/6] cmake: Pass correct package name to resolve_dependency(absl...) And don't pass a pkg-config parameter for absl as there isn't a single package but many. Co-authored-by: Sutou Kouhei --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 12fd53bc6980b..031ee1810871c 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -4109,17 +4109,22 @@ endmacro() if(ARROW_WITH_GOOGLE_CLOUD_CPP OR ARROW_WITH_GRPC) # Google Cloud C++ SDK and gRPC require Google Abseil + if(ARROW_WITH_GOOGLE_CLOUD_CPP) + set(ARROW_ABSL_CMAKE_PACKAGE_NAME Arrow) + set(ARROW_ABSL_PC_PACKAGE_NAME arrow) + else() + set(ARROW_ABSL_CMAKE_PACKAGE_NAME ArrowFlight) + set(ARROW_ABSL_PC_PACKAGE_NAME arrow-flight) + endif() resolve_dependency(absl ARROW_CMAKE_PACKAGE_NAME - ArrowFlight + ${ARROW_ABSL_CMAKE_PACKAGE_NAME} ARROW_PC_PACKAGE_NAME - arrow-flight + ${ARROW_ABSL_PC_PACKAGE_NAME} HAVE_ALT FALSE FORCE_ANY_NEWER_VERSION TRUE - PC_PACKAGE_NAMES - absl REQUIRED_VERSION ${ARROW_ABSL_REQUIRED_VERSION}) endif() From c7530cc9fa72992837fa7938562ed3f9101aca51 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Thu, 11 Jul 2024 13:51:58 -0300 Subject: [PATCH 4/6] cmake: Set ARROW_ABSL_REQUIRED_VERSION explicitly --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index 031ee1810871c..efce11b36dedb 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -4108,6 +4108,7 @@ macro(build_grpc) endmacro() if(ARROW_WITH_GOOGLE_CLOUD_CPP OR ARROW_WITH_GRPC) + set(ARROW_ABSL_REQUIRED_VERSION 20211102) # Google Cloud C++ SDK and gRPC require Google Abseil if(ARROW_WITH_GOOGLE_CLOUD_CPP) set(ARROW_ABSL_CMAKE_PACKAGE_NAME Arrow) From 866bf1fe7496915bb5474bc922038aa424eaf031 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Thu, 11 Jul 2024 18:53:52 -0300 Subject: [PATCH 5/6] docker: Remove absl_SOURCE=BUNDLED from fedora build --- ci/docker/fedora-39-cpp.dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/docker/fedora-39-cpp.dockerfile b/ci/docker/fedora-39-cpp.dockerfile index 8ecaa6c3ca784..33d11823094ce 100644 --- a/ci/docker/fedora-39-cpp.dockerfile +++ b/ci/docker/fedora-39-cpp.dockerfile @@ -77,8 +77,7 @@ RUN /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin # PYARROW_TEST_GANDIVA=OFF: GH-39695: We need to make LLVM symbols visible in # Python process explicitly if we use LLVM 17 or later. -ENV absl_SOURCE=BUNDLED \ - ARROW_ACERO=ON \ +ENV ARROW_ACERO=ON \ ARROW_AZURE=OFF \ ARROW_BUILD_TESTS=ON \ ARROW_DEPENDENCY_SOURCE=SYSTEM \ From 164898f0f66d7304f003749ece18ce3665169780 Mon Sep 17 00:00:00 2001 From: Felipe Oliveira Carvalho Date: Thu, 11 Jul 2024 18:55:49 -0300 Subject: [PATCH 6/6] cmake: Force gRPC_SOURCE to BUNDLED if absl is BUNDLED as well --- cpp/cmake_modules/ThirdpartyToolchain.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake index efce11b36dedb..5b89a831ff7fe 100644 --- a/cpp/cmake_modules/ThirdpartyToolchain.cmake +++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake @@ -4136,6 +4136,11 @@ if(ARROW_WITH_GRPC) endif() set(ARROW_GRPC_REQUIRED_VERSION "1.30.0") + if(absl_SOURCE STREQUAL "BUNDLED" AND NOT gRPC_SOURCE STREQUAL "BUNDLED") + # System gRPC can't be used with bundled Abseil + message(STATUS "Forcing gRPC_SOURCE to BUNDLED because absl_SOURCE is BUNDLED") + set(gRPC_SOURCE "BUNDLED") + endif() if(NOT Protobuf_SOURCE STREQUAL gRPC_SOURCE) # ARROW-15495: Protobuf/gRPC must come from the same source message(STATUS "Forcing gRPC_SOURCE to Protobuf_SOURCE (${Protobuf_SOURCE})")