Skip to content

Commit e65c1e2

Browse files
felipecrvkou
andauthored
apacheGH-43218: [C++] Resolve Abseil like any other dependency in the build system (apache#43219)
### Rationale for this change The workarounds around Abseil resolution don't seem necessary anymore and they don't work on all possible configurations of the build. ### What changes are included in this PR? Removal of the `ensure_absl` macro and adding a call to `resolve_dependency` when depending on the Google Cloud SDK (a GCS filesystem dependency) or gRPC (a flight dependency). ### Are these changes tested? Yes, by me trying different build configurations on my macOS and existing builds in CI. * GitHub Issue: apache#43218 Lead-authored-by: Felipe Oliveira Carvalho <[email protected]> Co-authored-by: Sutou Kouhei <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
1 parent 6e438e6 commit e65c1e2

File tree

3 files changed

+30
-32
lines changed

3 files changed

+30
-32
lines changed

ci/docker/fedora-39-cpp.dockerfile

+1-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ RUN /arrow/ci/scripts/install_sccache.sh unknown-linux-musl /usr/local/bin
7777

7878
# PYARROW_TEST_GANDIVA=OFF: GH-39695: We need to make LLVM symbols visible in
7979
# Python process explicitly if we use LLVM 17 or later.
80-
ENV absl_SOURCE=BUNDLED \
81-
ARROW_ACERO=ON \
80+
ENV ARROW_ACERO=ON \
8281
ARROW_AZURE=OFF \
8382
ARROW_BUILD_TESTS=ON \
8483
ARROW_DEPENDENCY_SOURCE=SYSTEM \

cpp/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ endif()
689689

690690
if("${ARROW_TEST_LINKAGE}" STREQUAL "shared")
691691
if(ARROW_BUILD_TESTS AND NOT ARROW_BUILD_SHARED)
692-
message(FATAL_ERROR "If using shared linkage for unit tests, must also \
692+
message(FATAL_ERROR "If using ARROW_TEST_LINKAGE=shared, must also \
693693
pass ARROW_BUILD_SHARED=on")
694694
endif()
695695
# Use shared linking for unit tests if it's available

cpp/cmake_modules/ThirdpartyToolchain.cmake

+28-29
Original file line numberDiff line numberDiff line change
@@ -2874,33 +2874,6 @@ endmacro()
28742874
# ----------------------------------------------------------------------
28752875
# Dependencies for Arrow Flight RPC
28762876

2877-
macro(ensure_absl)
2878-
if(NOT absl_FOUND)
2879-
if(${absl_SOURCE} STREQUAL "AUTO")
2880-
# We can't use resolve_dependency(absl 20211102) to use Abseil
2881-
# 20211102 or later because Abseil's CMake package uses "EXACT"
2882-
# version match strategy. Our CMake configuration will work with
2883-
# Abseil LTS 20211102 or later. So we want to accept Abseil LTS
2884-
# 20211102 or later. We need to update
2885-
# ARROW_ABSL_REQUIRED_LTS_VERSIONS list when new Abseil LTS is
2886-
# released.
2887-
set(ARROW_ABSL_REQUIRED_LTS_VERSIONS 20230125 20220623 20211102)
2888-
foreach(_VERSION ${ARROW_ABSL_REQUIRED_LTS_VERSIONS})
2889-
find_package(absl ${_VERSION})
2890-
if(absl_FOUND)
2891-
break()
2892-
endif()
2893-
endforeach()
2894-
# If we can't find Abseil LTS 20211102 or later, we use bundled
2895-
# Abseil.
2896-
if(NOT absl_FOUND)
2897-
set(absl_SOURCE "BUNDLED")
2898-
endif()
2899-
endif()
2900-
resolve_dependency(absl)
2901-
endif()
2902-
endmacro()
2903-
29042877
macro(build_absl)
29052878
message(STATUS "Building Abseil-cpp from source")
29062879
set(absl_FOUND TRUE)
@@ -3845,7 +3818,6 @@ macro(build_grpc)
38453818
TRUE
38463819
PC_PACKAGE_NAMES
38473820
libcares)
3848-
ensure_absl()
38493821

38503822
message(STATUS "Building gRPC from source")
38513823

@@ -4135,12 +4107,40 @@ macro(build_grpc)
41354107
endif()
41364108
endmacro()
41374109

4110+
if(ARROW_WITH_GOOGLE_CLOUD_CPP OR ARROW_WITH_GRPC)
4111+
set(ARROW_ABSL_REQUIRED_VERSION 20211102)
4112+
# Google Cloud C++ SDK and gRPC require Google Abseil
4113+
if(ARROW_WITH_GOOGLE_CLOUD_CPP)
4114+
set(ARROW_ABSL_CMAKE_PACKAGE_NAME Arrow)
4115+
set(ARROW_ABSL_PC_PACKAGE_NAME arrow)
4116+
else()
4117+
set(ARROW_ABSL_CMAKE_PACKAGE_NAME ArrowFlight)
4118+
set(ARROW_ABSL_PC_PACKAGE_NAME arrow-flight)
4119+
endif()
4120+
resolve_dependency(absl
4121+
ARROW_CMAKE_PACKAGE_NAME
4122+
${ARROW_ABSL_CMAKE_PACKAGE_NAME}
4123+
ARROW_PC_PACKAGE_NAME
4124+
${ARROW_ABSL_PC_PACKAGE_NAME}
4125+
HAVE_ALT
4126+
FALSE
4127+
FORCE_ANY_NEWER_VERSION
4128+
TRUE
4129+
REQUIRED_VERSION
4130+
${ARROW_ABSL_REQUIRED_VERSION})
4131+
endif()
4132+
41384133
if(ARROW_WITH_GRPC)
41394134
if(NOT ARROW_ENABLE_THREADING)
41404135
message(FATAL_ERROR "Can't use gRPC with ARROW_ENABLE_THREADING=OFF")
41414136
endif()
41424137

41434138
set(ARROW_GRPC_REQUIRED_VERSION "1.30.0")
4139+
if(absl_SOURCE STREQUAL "BUNDLED" AND NOT gRPC_SOURCE STREQUAL "BUNDLED")
4140+
# System gRPC can't be used with bundled Abseil
4141+
message(STATUS "Forcing gRPC_SOURCE to BUNDLED because absl_SOURCE is BUNDLED")
4142+
set(gRPC_SOURCE "BUNDLED")
4143+
endif()
41444144
if(NOT Protobuf_SOURCE STREQUAL gRPC_SOURCE)
41454145
# ARROW-15495: Protobuf/gRPC must come from the same source
41464146
message(STATUS "Forcing gRPC_SOURCE to Protobuf_SOURCE (${Protobuf_SOURCE})")
@@ -4259,7 +4259,6 @@ macro(build_google_cloud_cpp_storage)
42594259
message(STATUS "Only building the google-cloud-cpp::storage component")
42604260

42614261
# List of dependencies taken from https://github.com/googleapis/google-cloud-cpp/blob/main/doc/packaging.md
4262-
ensure_absl()
42634262
build_crc32c_once()
42644263

42654264
# Curl is required on all platforms, but building it internally might also trip over S3's copy.

0 commit comments

Comments
 (0)