Skip to content

Commit 9dcb81b

Browse files
feat(cmake): reuse Arrow's bundled AWS SDK for SigV4 (no system SDK for S3+SigV4)
1 parent 04c06ca commit 9dcb81b

4 files changed

Lines changed: 35 additions & 8 deletions

File tree

.github/workflows/aws_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ jobs:
9494
shell: bash
9595
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
9696
- name: Cache vcpkg packages
97-
if: ${{ matrix.sigv4 == 'ON' }}
97+
if: ${{ matrix.sigv4 == 'ON' && matrix.s3 == 'OFF' }}
9898
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
9999
id: vcpkg-cache
100100
with:
101101
path: /usr/local/share/vcpkg/installed
102102
key: vcpkg-x64-linux-aws-sdk-cpp-s3-${{ matrix.s3 }}-sigv4-${{ matrix.sigv4 }}-${{ hashFiles('.github/workflows/aws_test.yml') }}
103103
- name: Install AWS SDK via vcpkg
104-
if: ${{ matrix.sigv4 == 'ON' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
104+
if: ${{ matrix.sigv4 == 'ON' && matrix.s3 == 'OFF' && steps.vcpkg-cache.outputs.cache-hit != 'true' }}
105105
shell: bash
106106
# Retry to ride out transient GitHub/mirror download failures (504s).
107107
run: |
@@ -132,7 +132,7 @@ jobs:
132132
- name: Build and test Iceberg
133133
shell: bash
134134
env:
135-
CMAKE_TOOLCHAIN_FILE: ${{ matrix.sigv4 == 'ON' && '/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake' || '' }}
135+
CMAKE_TOOLCHAIN_FILE: ${{ matrix.sigv4 == 'ON' && matrix.s3 == 'OFF' && '/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake' || '' }}
136136
run: ci/scripts/build_iceberg.sh "$(pwd)" OFF OFF ${{ matrix.s3 }} ${{ matrix.sigv4 }}
137137

138138
# Exercise the Meson build with SigV4 enabled (resolves aws-cpp-sdk-core via

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ option(ICEBERG_SQL_POSTGRESQL "Build the PostgreSQL connector for the SQL catalo
5454
option(ICEBERG_SQL_MYSQL "Build the MySQL connector for the SQL catalog" OFF)
5555
option(ICEBERG_S3 "Build with S3 support" OFF)
5656
option(ICEBERG_SIGV4 "Build SigV4 authentication support (requires AWS SDK)" OFF)
57+
set(ICEBERG_AWSSDK_SOURCE
58+
"AUTO"
59+
CACHE STRING
60+
"AWS SDK source for SigV4: AUTO (reuse Arrow's bundled AWS SDK when \
61+
ICEBERG_S3 is ON, otherwise SYSTEM), SYSTEM (find an installed AWS SDK), or \
62+
BUNDLED (reuse Arrow's bundled AWS SDK; requires ICEBERG_S3)")
63+
set_property(CACHE ICEBERG_AWSSDK_SOURCE PROPERTY STRINGS AUTO SYSTEM BUNDLED)
5764
option(ICEBERG_ENABLE_ASAN "Enable Address Sanitizer" OFF)
5865
option(ICEBERG_ENABLE_UBSAN "Enable Undefined Behavior Sanitizer" OFF)
5966

cmake_modules/IcebergThirdpartyToolchain.cmake

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@
2020
set(ICEBERG_SYSTEM_DEPENDENCIES)
2121
set(ICEBERG_ARROW_INSTALL_INTERFACE_LIBS)
2222

23+
if(ICEBERG_SIGV4)
24+
set(ICEBERG_AWSSDK_SOURCE_RESOLVED "${ICEBERG_AWSSDK_SOURCE}")
25+
if(ICEBERG_AWSSDK_SOURCE_RESOLVED STREQUAL "AUTO")
26+
if(ICEBERG_S3)
27+
set(ICEBERG_AWSSDK_SOURCE_RESOLVED "BUNDLED")
28+
else()
29+
set(ICEBERG_AWSSDK_SOURCE_RESOLVED "SYSTEM")
30+
endif()
31+
endif()
32+
if(ICEBERG_AWSSDK_SOURCE_RESOLVED STREQUAL "BUNDLED" AND NOT ICEBERG_S3)
33+
message(FATAL_ERROR "ICEBERG_AWSSDK_SOURCE=BUNDLED requires ICEBERG_S3=ON: "
34+
"the bundled AWS SDK is provided by Arrow's S3 support.")
35+
endif()
36+
message(STATUS "AWS SDK source for SigV4: ${ICEBERG_AWSSDK_SOURCE_RESOLVED}")
37+
endif()
38+
2339
# ----------------------------------------------------------------------
2440
# Versions and URLs for toolchain builds
2541
#
@@ -110,9 +126,7 @@ function(resolve_arrow_dependency)
110126
set(ARROW_RUNTIME_SIMD_LEVEL "NONE")
111127
set(ARROW_POSITION_INDEPENDENT_CODE ON)
112128
set(ARROW_DEPENDENCY_SOURCE "BUNDLED")
113-
# With SigV4 also on, make Arrow's S3 reuse the system AWS SDK (the one SigV4
114-
# finds) instead of bundling its own, so only one AWS SDK is linked (no ODR).
115-
if(ICEBERG_S3 AND ICEBERG_SIGV4)
129+
if(ICEBERG_S3 AND ICEBERG_SIGV4 AND ICEBERG_AWSSDK_SOURCE_RESOLVED STREQUAL "SYSTEM")
116130
set(AWSSDK_SOURCE "SYSTEM")
117131
endif()
118132
set(ARROW_WITH_ZLIB ON)
@@ -638,6 +652,10 @@ endif()
638652
# AWS SDK for C++
639653

640654
function(resolve_aws_sdk_dependency)
655+
if(ICEBERG_AWSSDK_SOURCE_RESOLVED STREQUAL "BUNDLED")
656+
message(STATUS "SigV4 reuses Arrow's bundled AWS SDK (aws-cpp-sdk-core)")
657+
return()
658+
endif()
641659
find_package(AWSSDK REQUIRED COMPONENTS core)
642660
list(APPEND ICEBERG_SYSTEM_DEPENDENCIES AWSSDK)
643661
set(ICEBERG_SYSTEM_DEPENDENCIES

src/iceberg/catalog/rest/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ list(APPEND
5858
if(ICEBERG_SIGV4)
5959
list(APPEND ICEBERG_REST_STATIC_BUILD_INTERFACE_LIBS aws-cpp-sdk-core)
6060
list(APPEND ICEBERG_REST_SHARED_BUILD_INTERFACE_LIBS aws-cpp-sdk-core)
61-
list(APPEND ICEBERG_REST_STATIC_INSTALL_INTERFACE_LIBS aws-cpp-sdk-core)
62-
list(APPEND ICEBERG_REST_SHARED_INSTALL_INTERFACE_LIBS aws-cpp-sdk-core)
61+
if(ICEBERG_AWSSDK_SOURCE_RESOLVED STREQUAL "SYSTEM")
62+
list(APPEND ICEBERG_REST_STATIC_INSTALL_INTERFACE_LIBS aws-cpp-sdk-core)
63+
list(APPEND ICEBERG_REST_SHARED_INSTALL_INTERFACE_LIBS aws-cpp-sdk-core)
64+
endif()
6365
endif()
6466

6567
add_iceberg_lib(iceberg_rest

0 commit comments

Comments
 (0)