Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-43164: [C++] Fix CMake link order for AWS SDK #43230

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions cpp/src/arrow/filesystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,41 @@ if(ARROW_AZURE)
endif()

if(ARROW_S3)
set(ARROW_S3_TEST_EXTRA_LINK_LIBS)
# arrow_shared/arrow_static is specified implicitly via
# arrow_testing_shared/arrow_testing_static but we specify
# arrow_shared/arrow_static explicitly here to ensure using libarrow
# before libaws* on link. If we use libaws*.a before libarrow,
# static variables storage of AWS SDK for C++ in libaws*.a may be
# mixed with one in libarrow.
if(ARROW_TEST_LINKAGE STREQUAL "shared")
list(APPEND ARROW_S3_TEST_EXTRA_LINK_LIBS arrow_shared)
else()
list(APPEND ARROW_S3_TEST_EXTRA_LINK_LIBS arrow_static)
endif()
list(APPEND
ARROW_S3_TEST_EXTRA_LINK_LIBS
${AWSSDK_LINK_LIBRARIES}
Boost::filesystem
Boost::system)
add_arrow_test(s3fs_test
SOURCES
s3fs_test.cc
s3_test_util.cc
EXTRA_LABELS
filesystem
EXTRA_LINK_LIBS
${AWSSDK_LINK_LIBRARIES}
Boost::filesystem
Boost::system)
${ARROW_S3_TEST_EXTRA_LINK_LIBS})
if(TARGET arrow-s3fs-test)
set(ARROW_S3FS_TEST_COMPILE_DEFINITIONS)
get_target_property(AWS_CPP_SDK_S3_TYPE aws-cpp-sdk-s3 TYPE)
# We need to initialize AWS C++ SDK for direct use (not via
# We need to initialize AWS SDK for C++ for direct use (not via
# arrow::fs::S3FileSystem) in arrow-s3fs-test if we use static AWS
# C++ SDK and hide symbols of them. Because AWS C++ SDK has
# internal static variables that aren't shared in libarrow and
# SDK for C++ and hide symbols of them. Because AWS SDK for C++
# has internal static variables that aren't shared in libarrow and
# arrow-s3fs-test. It means that arrow::fs::InitializeS3() doesn't
# initialize AWS C++ SDK that is directly used in arrow-s3fs-test.
# initialize AWS SDK for C++ that is directly used in
# arrow-s3fs-test.
if(AWS_CPP_SDK_S3_TYPE STREQUAL "STATIC_LIBRARY"
AND CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
list(APPEND ARROW_S3FS_TEST_COMPILE_DEFINITIONS "AWS_CPP_SDK_S3_PRIVATE_STATIC")
Expand Down
Loading