From 2d2bddf7e964122ff2ce411276114cb88d9f3623 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Mon, 9 Nov 2026 16:22:27 -0700 Subject: [PATCH 1/9] Link Arrow libs dynamically initial commit Default to dynamic linking Default to dynamic linking for ODBC if both shared and static libs are built, i.e., both `ARROW_BUILD_SHARED` and `ARROW_BUILD_STATIC` are set Update comments --- .github/workflows/cpp_extra.yml | 3 ++ compose.yaml | 6 ++-- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 22 +++++++------ .../flight/sql/odbc/odbc_impl/CMakeLists.txt | 32 +++++++++---------- .../flight/sql/odbc/tests/CMakeLists.txt | 14 ++------ 5 files changed, 36 insertions(+), 41 deletions(-) diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index 01bd567b762d..0986569b4d62 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -487,6 +487,7 @@ jobs: path: ${{ steps.ccache-info.outputs.cache-dir }} key: jni-windows + # On Linux, link ODBC dynamically to follow general RPM/DEB guidelines odbc-linux: needs: check-enabled if: needs.check-enabled.outputs.is_enabled == 'true' @@ -561,6 +562,7 @@ jobs: - { architecture: ARM64, macos-version: "26", build-type : debug } - { architecture: ARM64, macos-version: "26", build-type : release } env: + # on macOS, always link ODBC statically to support sandbox env ARROW_BUILD_TESTS: ON ARROW_BUILD_TYPE: ${{ matrix.build-type }} ARROW_DEPENDENCY_SOURCE: BUNDLED @@ -801,6 +803,7 @@ jobs: contents: read packages: write env: + # on Windows, link ODBC statically and compile into 1 DLL to minimize signing ARROW_BUILD_SHARED: OFF ARROW_BUILD_STATIC: ON ARROW_BUILD_TESTS: ON diff --git a/compose.yaml b/compose.yaml index a7831dbd9f93..5d3245c575cc 100644 --- a/compose.yaml +++ b/compose.yaml @@ -518,7 +518,7 @@ services: command: *cpp-command ubuntu-cpp-odbc: - # Arrow Flight SQL ODBC build with BUNDLED dependencies with downloaded dependencies. + # Arrow Flight SQL ODBC build with shared dependencies, like arrow.spec.in <<: *ubuntu-cpp-base environment: <<: [*common, *ccache, *sccache, *cpp] @@ -527,8 +527,8 @@ services: ARROW_BUILD_TYPE: RELEASE ARROW_CSV: "OFF" ARROW_DATASET: "OFF" - ARROW_DEPENDENCY_SOURCE: BUNDLED - ARROW_DEPENDENCY_USE_SHARED: "OFF" + ARROW_DEPENDENCY_SOURCE: AUTO + ARROW_DEPENDENCY_USE_SHARED: "ON" ARROW_FLIGHT_SQL_ODBC: "ON" ARROW_FLIGHT_SQL_ODBC_CONN: "driver={Apache Arrow Flight SQL ODBC Driver};HOST=dremio;port=32010;pwd=admin2025;uid=admin;useEncryption=false;UseWideChar=true;" ARROW_GANDIVA: "OFF" diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index 033a2775b663..ed0a9a335e4d 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -59,34 +59,36 @@ if(WIN32) list(APPEND ARROW_FLIGHT_SQL_ODBC_SRCS odbc.def install/versioninfo.rc) endif() -# Initialize install interface libs (only set in Windows static build) +# Initialize install interface libs (only set on Windows and Linux) set(ARROW_FLIGHT_SQL_ODBC_SHARED_INSTALL_INTERFACE_LIBS "") set(ARROW_FLIGHT_SQL_ODBC_STATIC_INSTALL_INTERFACE_LIBS "") set(ARROW_FLIGHT_SQL_ODBC_SHARED_PRIVATE_LINK_LIBS "") -if(WIN32) - if(ARROW_BUILD_STATIC) - # Static Arrow deps on Windows — self-contained ODBC DLL - set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_flight_sql_static +# On macOS, always link Arrow libraries statically. +# On Windows and Linux, link Arrow libraries dynamically if the shared libraries are +# built, and statically otherwise. +if(NOT APPLE) + if(ARROW_BUILD_SHARED) + set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_flight_sql_shared arrow_odbc_spi_impl) set(ARROW_FLIGHT_SQL_ODBC_STATIC_LINK_LIBS arrow_flight_sql_static) list(APPEND ARROW_FLIGHT_SQL_ODBC_SHARED_INSTALL_INTERFACE_LIBS - ArrowFlight::arrow_flight_sql_static) + ArrowFlight::arrow_flight_sql_shared) list(APPEND ARROW_FLIGHT_SQL_ODBC_STATIC_INSTALL_INTERFACE_LIBS ArrowFlight::arrow_flight_sql_static) else() - set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_flight_sql_shared + # Static Arrow deps — self-contained ODBC library + set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_flight_sql_static arrow_odbc_spi_impl) set(ARROW_FLIGHT_SQL_ODBC_STATIC_LINK_LIBS arrow_flight_sql_static) list(APPEND ARROW_FLIGHT_SQL_ODBC_SHARED_INSTALL_INTERFACE_LIBS - ArrowFlight::arrow_flight_sql_shared) + ArrowFlight::arrow_flight_sql_static) list(APPEND ARROW_FLIGHT_SQL_ODBC_STATIC_INSTALL_INTERFACE_LIBS ArrowFlight::arrow_flight_sql_static) endif() list(APPEND ARROW_FLIGHT_SQL_ODBC_SHARED_PRIVATE_LINK_LIBS ODBC::ODBC ${ODBCINST}) else() - # Unix/macOS: driver dynamically links arrow_flight_sql so the driver and test - # binary share the same grpc/arrow_flight runtime. + # macOS: arrow_odbc_spi_impl always links Arrow statically. set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_odbc_spi_impl) set(ARROW_FLIGHT_SQL_ODBC_STATIC_LINK_LIBS ODBC::ODBC ${ODBCINST}) endif() diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt index 17d2ee1ffeea..6a76431f5643 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt @@ -130,26 +130,29 @@ if(WIN32) win_system_dsn.cc) endif() -if(WIN32) +# On macOS, always link Arrow libraries statically. +# On Windows and Linux, link Arrow libraries dynamically if the shared libraries are +# built, and statically otherwise. +if(NOT APPLE) find_package(ODBC REQUIRED) target_include_directories(arrow_odbc_spi_impl PUBLIC ${ODBC_INCLUDE_DIR}) - if(ARROW_BUILD_STATIC) + if(ARROW_BUILD_SHARED) target_link_libraries(arrow_odbc_spi_impl - PUBLIC arrow_flight_sql_static - arrow_compute_static + PUBLIC arrow_flight_sql_shared + arrow_compute_shared Boost::locale arrow::simdjson ${ODBCINST}) else() target_link_libraries(arrow_odbc_spi_impl - PUBLIC arrow_flight_sql_shared - arrow_compute_shared + PUBLIC arrow_flight_sql_static + arrow_compute_static Boost::locale arrow::simdjson ${ODBCINST}) endif() else() - # Unix + # macOS - always link Arrow statically to support sandbox env target_include_directories(arrow_odbc_spi_impl SYSTEM BEFORE PUBLIC ${ODBC_INCLUDE_DIR}) target_link_libraries(arrow_odbc_spi_impl PUBLIC arrow_flight_sql_static @@ -157,11 +160,6 @@ else() Boost::locale Boost::headers arrow::simdjson) - - if(NOT APPLE) - # Explicitly link to unix-odbc on Linux - target_link_libraries(arrow_odbc_spi_impl PUBLIC ${ODBCINST}) - endif() endif() # CLI @@ -173,18 +171,18 @@ target_link_libraries(arrow_odbc_spi_impl_cli arrow_odbc_spi_impl) # Unit tests -# On Windows, dynamic linking ODBC is supported. -# On unix systems, static linking ODBC is supported, thus the library linking is static. +# On Windows and Linux, dynamic linking ODBC is supported. +# On macOS, static linking ODBC is supported, thus the library linking is static. # Use STATIC_LINK_LIBS when Flight tests require static linkage to avoid mixing static/shared Arrow -if(WIN32 AND ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static") +if(NOT APPLE AND ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static") set(ODBC_SPI_IMPL_TEST_STATIC_LIBS arrow_odbc_spi_impl arrow_flight_testing_static ${ARROW_TEST_STATIC_LINK_LIBS}) set(ODBC_SPI_IMPL_TEST_EXTRA_LIBS "") -elseif(WIN32) +elseif(NOT APPLE) set(ODBC_SPI_IMPL_TEST_STATIC_LIBS "") set(ODBC_SPI_IMPL_TEST_EXTRA_LIBS arrow_odbc_spi_impl arrow_flight_testing_shared) else() - # Unix - always static + # macOS - always static set(ODBC_SPI_IMPL_TEST_STATIC_LIBS arrow_odbc_spi_impl arrow_flight_testing_static ${ARROW_TEST_STATIC_LINK_LIBS}) set(ODBC_SPI_IMPL_TEST_EXTRA_LIBS "") diff --git a/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt index f3c345e2449f..8a62a45fa047 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt @@ -57,21 +57,13 @@ elseif(WIN32) set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_LIBS arrow_odbc_spi_impl ${ARROW_FLIGHT_SQL_ODBC_TEST_LIBS} arrow_flight_sql_odbc_static ${ARROW_TEST_STATIC_LINK_LIBS}) -elseif(APPLE) - # GH-49651: Link the ODBC driver dynamically on macOS. +else() + # GH-49651: Link the ODBC driver dynamically on macOS and Linux. The tests call the + # driver functions directly, so they need the driver library. set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_MODE STATIC_LINK_LIBS) set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_LIBS ${ARROW_FLIGHT_SQL_ODBC_TEST_LIBS} arrow_flight_sql_odbc_shared ${ARROW_TEST_SHARED_LINK_LIBS}) -else() - # GH-49651: Link the ODBC driver statically on Linux to avoid a segfault. - set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_MODE STATIC_LINK_LIBS) - set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_LIBS - ${ARROW_FLIGHT_SQL_ODBC_TEST_LIBS} - arrow_flight_sql_odbc_static - ${ARROW_TEST_STATIC_LINK_LIBS} - arrow_odbc_spi_impl - ${ARROW_PROTOBUF_LIBPROTOBUF}) endif() add_arrow_test(flight_sql_odbc_test From 4fc3773fb5eed2798ba00487fb08290e1925caa1 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Mon, 9 Nov 2026 17:12:58 -0700 Subject: [PATCH 2/9] Fix Linux ODBC build issues ODBC has boost locale dependency --- ci/docker/ubuntu-24.04-cpp.dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/docker/ubuntu-24.04-cpp.dockerfile b/ci/docker/ubuntu-24.04-cpp.dockerfile index 545a6e4cf147..e9d670d7eb9a 100644 --- a/ci/docker/ubuntu-24.04-cpp.dockerfile +++ b/ci/docker/ubuntu-24.04-cpp.dockerfile @@ -75,6 +75,7 @@ RUN apt-get update -y -q && \ git \ libbenchmark-dev \ libboost-filesystem-dev \ + libboost-locale-dev \ libbrotli-dev \ libbz2-dev \ libc-ares-dev \ From 2abaeaa3c28ba237d22f332f06342b5143e99ccb Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Fri, 6 Nov 2026 13:39:46 -0700 Subject: [PATCH 3/9] Add dependency check Verify that Arrow libraries are dynamically linked --- .github/workflows/cpp_extra.yml | 11 +++++++++++ compose.yaml | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index 0986569b4d62..57dcf6d28b57 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -530,6 +530,17 @@ jobs: sudo sysctl -w vm.mmap_rnd_bits=28 source ci/scripts/util_enable_core_dumps.sh archery docker run ubuntu-cpp-odbc + - name: Check ODBC Dependency + run: | + # The ODBC driver should link Arrow libraries dynamically on Linux + lib="$(pwd)/build/cpp/release/libarrow_flight_sql_odbc.so" + ldd "${lib}" + for arrow_lib in libarrow libarrow_compute libarrow_flight libarrow_flight_sql; do + ldd "${lib}" | grep -Fq "${arrow_lib}.so" || { + echo "Error: ${arrow_lib} is not dynamically linked to ${lib}" + exit 1 + } + done - name: Save Docker Volumes if: ${{ !cancelled() }} continue-on-error: true diff --git a/compose.yaml b/compose.yaml index 5d3245c575cc..908c54d8a193 100644 --- a/compose.yaml +++ b/compose.yaml @@ -542,11 +542,12 @@ services: depends_on: dremio: condition: service_healthy + # Use `/arrow/build` so build artifacts are visible on the CI host command: > /bin/bash -c " - /arrow/ci/scripts/cpp_build.sh /arrow /build && + /arrow/ci/scripts/cpp_build.sh /arrow /arrow/build && sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so && - /arrow/ci/scripts/cpp_test.sh /arrow /build" + /arrow/ci/scripts/cpp_test.sh /arrow /arrow/build" ubuntu-cpp-minimal: # Arrow build with minimal components/dependencies From 4e105a6e7ef9ce39a939386816a585abbdd23f55 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Fri, 13 Nov 2026 15:36:17 -0700 Subject: [PATCH 4/9] Fix comment --- cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt index 6a76431f5643..78d7540014bc 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt @@ -171,8 +171,7 @@ target_link_libraries(arrow_odbc_spi_impl_cli arrow_odbc_spi_impl) # Unit tests -# On Windows and Linux, dynamic linking ODBC is supported. -# On macOS, static linking ODBC is supported, thus the library linking is static. +# On macOS, only static linking ODBC is supported, thus the library linking is static. # Use STATIC_LINK_LIBS when Flight tests require static linkage to avoid mixing static/shared Arrow if(NOT APPLE AND ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static") set(ODBC_SPI_IMPL_TEST_STATIC_LIBS arrow_odbc_spi_impl arrow_flight_testing_static From 40b801e702e33538058c088fd01f2164dab10ae4 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Mon, 16 Nov 2026 16:07:30 -0700 Subject: [PATCH 5/9] work on comments from kou - Remove `Check ODBC Dependency` for Linux ODBC - Use `if(APPLE)` instead of `if(NOT APPLE)` --- .github/workflows/cpp_extra.yml | 11 ------- .../flight/sql/odbc/odbc_impl/CMakeLists.txt | 32 +++++++++---------- 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index 57dcf6d28b57..0986569b4d62 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -530,17 +530,6 @@ jobs: sudo sysctl -w vm.mmap_rnd_bits=28 source ci/scripts/util_enable_core_dumps.sh archery docker run ubuntu-cpp-odbc - - name: Check ODBC Dependency - run: | - # The ODBC driver should link Arrow libraries dynamically on Linux - lib="$(pwd)/build/cpp/release/libarrow_flight_sql_odbc.so" - ldd "${lib}" - for arrow_lib in libarrow libarrow_compute libarrow_flight libarrow_flight_sql; do - ldd "${lib}" | grep -Fq "${arrow_lib}.so" || { - echo "Error: ${arrow_lib} is not dynamically linked to ${lib}" - exit 1 - } - done - name: Save Docker Volumes if: ${{ !cancelled() }} continue-on-error: true diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt index 78d7540014bc..5a60a1042957 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt @@ -133,7 +133,16 @@ endif() # On macOS, always link Arrow libraries statically. # On Windows and Linux, link Arrow libraries dynamically if the shared libraries are # built, and statically otherwise. -if(NOT APPLE) +if(APPLE) + # macOS - always link Arrow statically to support sandbox env + target_include_directories(arrow_odbc_spi_impl SYSTEM BEFORE PUBLIC ${ODBC_INCLUDE_DIR}) + target_link_libraries(arrow_odbc_spi_impl + PUBLIC arrow_flight_sql_static + arrow_compute_static + Boost::locale + Boost::headers + arrow::simdjson) +else() find_package(ODBC REQUIRED) target_include_directories(arrow_odbc_spi_impl PUBLIC ${ODBC_INCLUDE_DIR}) if(ARROW_BUILD_SHARED) @@ -151,15 +160,6 @@ if(NOT APPLE) arrow::simdjson ${ODBCINST}) endif() -else() - # macOS - always link Arrow statically to support sandbox env - target_include_directories(arrow_odbc_spi_impl SYSTEM BEFORE PUBLIC ${ODBC_INCLUDE_DIR}) - target_link_libraries(arrow_odbc_spi_impl - PUBLIC arrow_flight_sql_static - arrow_compute_static - Boost::locale - Boost::headers - arrow::simdjson) endif() # CLI @@ -173,18 +173,18 @@ target_link_libraries(arrow_odbc_spi_impl_cli arrow_odbc_spi_impl) # On macOS, only static linking ODBC is supported, thus the library linking is static. # Use STATIC_LINK_LIBS when Flight tests require static linkage to avoid mixing static/shared Arrow -if(NOT APPLE AND ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static") +if(APPLE) + # macOS - always static set(ODBC_SPI_IMPL_TEST_STATIC_LIBS arrow_odbc_spi_impl arrow_flight_testing_static ${ARROW_TEST_STATIC_LINK_LIBS}) set(ODBC_SPI_IMPL_TEST_EXTRA_LIBS "") -elseif(NOT APPLE) - set(ODBC_SPI_IMPL_TEST_STATIC_LIBS "") - set(ODBC_SPI_IMPL_TEST_EXTRA_LIBS arrow_odbc_spi_impl arrow_flight_testing_shared) -else() - # macOS - always static +elseif(ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static") set(ODBC_SPI_IMPL_TEST_STATIC_LIBS arrow_odbc_spi_impl arrow_flight_testing_static ${ARROW_TEST_STATIC_LINK_LIBS}) set(ODBC_SPI_IMPL_TEST_EXTRA_LIBS "") +else() + set(ODBC_SPI_IMPL_TEST_STATIC_LIBS "") + set(ODBC_SPI_IMPL_TEST_EXTRA_LIBS arrow_odbc_spi_impl arrow_flight_testing_shared) endif() add_arrow_test(odbc_spi_impl_test From d9877580ee2dd6958014da8b97810d2916993ac2 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" Date: Mon, 16 Nov 2026 17:06:46 -0700 Subject: [PATCH 6/9] Add ODBC Dependency check for Windows ODBC --- .github/workflows/cpp_extra.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index 0986569b4d62..ad0b36b923dd 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -843,6 +843,14 @@ jobs: uses: ./.github/actions/odbc-windows with: github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Check ODBC Dependency + shell: cmd + run: | + # ODBC dependency should not include other Arrow libraries + call "%VS_INSTALL_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64 || exit /b 1 + dumpbin /dependents build\cpp\%ARROW_BUILD_TYPE%\arrow_flight_sql_odbc.dll > odbc_dependents.txt || exit /b 1 + type odbc_dependents.txt + bash -c "if grep -i '^ *arrow.*\.dll' odbc_dependents.txt; then echo 'Error: Flight SQL ODBC DLL depends on Arrow DLLs'; exit 1; fi" - name: Test shell: cmd run: | From c5c422f8060ab5c7fae2b818a6d4904eaae1a7ba Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Tue, 17 Nov 2026 10:35:29 -0700 Subject: [PATCH 7/9] trigger CI From 2c7062875a4446b3e6bee6724dd2e479d8d144f8 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Tue, 17 Nov 2026 17:02:31 -0700 Subject: [PATCH 8/9] Fix AlmaLinux 8 build issue - Add `boost::headers` back on Linux --- cpp/src/arrow/flight/sql/odbc/CMakeLists.txt | 11 ++++++----- .../arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt index ed0a9a335e4d..08124708940a 100644 --- a/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/CMakeLists.txt @@ -67,7 +67,12 @@ set(ARROW_FLIGHT_SQL_ODBC_SHARED_PRIVATE_LINK_LIBS "") # On macOS, always link Arrow libraries statically. # On Windows and Linux, link Arrow libraries dynamically if the shared libraries are # built, and statically otherwise. -if(NOT APPLE) +if(APPLE) + # macOS: arrow_odbc_spi_impl always links Arrow statically. + # ODBC libraries are linked through STATIC_LINK_LIBS. + set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_odbc_spi_impl) + set(ARROW_FLIGHT_SQL_ODBC_STATIC_LINK_LIBS ODBC::ODBC ${ODBCINST}) +else() if(ARROW_BUILD_SHARED) set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_flight_sql_shared arrow_odbc_spi_impl) @@ -87,10 +92,6 @@ if(NOT APPLE) ArrowFlight::arrow_flight_sql_static) endif() list(APPEND ARROW_FLIGHT_SQL_ODBC_SHARED_PRIVATE_LINK_LIBS ODBC::ODBC ${ODBCINST}) -else() - # macOS: arrow_odbc_spi_impl always links Arrow statically. - set(ARROW_FLIGHT_SQL_ODBC_SHARED_LINK_LIBS arrow_odbc_spi_impl) - set(ARROW_FLIGHT_SQL_ODBC_STATIC_LINK_LIBS ODBC::ODBC ${ODBCINST}) endif() add_arrow_lib(arrow_flight_sql_odbc diff --git a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt index 5a60a1042957..77003fd3589c 100644 --- a/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/odbc_impl/CMakeLists.txt @@ -144,12 +144,13 @@ if(APPLE) arrow::simdjson) else() find_package(ODBC REQUIRED) - target_include_directories(arrow_odbc_spi_impl PUBLIC ${ODBC_INCLUDE_DIR}) + target_include_directories(arrow_odbc_spi_impl SYSTEM BEFORE PUBLIC ${ODBC_INCLUDE_DIR}) if(ARROW_BUILD_SHARED) target_link_libraries(arrow_odbc_spi_impl PUBLIC arrow_flight_sql_shared arrow_compute_shared Boost::locale + Boost::headers arrow::simdjson ${ODBCINST}) else() @@ -157,6 +158,7 @@ else() PUBLIC arrow_flight_sql_static arrow_compute_static Boost::locale + Boost::headers arrow::simdjson ${ODBCINST}) endif() From 4bfde2c9d0932cfe66626281ba1c5ae3045951e9 Mon Sep 17 00:00:00 2001 From: "Alina (Xi) Li" <96995091+alinaliBQ@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:02:22 -0700 Subject: [PATCH 9/9] Work on kou's comments - revert `Use `/arrow/build`` in compose.yaml - remove C++ Extra CI comments - Remove `Check ODBC Dependency` for MSVC --- .github/workflows/cpp_extra.yml | 11 ----------- compose.yaml | 5 ++--- .../arrow/flight/sql/odbc/tests/CMakeLists.txt | 17 ++++++++++++++--- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cpp_extra.yml b/.github/workflows/cpp_extra.yml index ad0b36b923dd..01bd567b762d 100644 --- a/.github/workflows/cpp_extra.yml +++ b/.github/workflows/cpp_extra.yml @@ -487,7 +487,6 @@ jobs: path: ${{ steps.ccache-info.outputs.cache-dir }} key: jni-windows - # On Linux, link ODBC dynamically to follow general RPM/DEB guidelines odbc-linux: needs: check-enabled if: needs.check-enabled.outputs.is_enabled == 'true' @@ -562,7 +561,6 @@ jobs: - { architecture: ARM64, macos-version: "26", build-type : debug } - { architecture: ARM64, macos-version: "26", build-type : release } env: - # on macOS, always link ODBC statically to support sandbox env ARROW_BUILD_TESTS: ON ARROW_BUILD_TYPE: ${{ matrix.build-type }} ARROW_DEPENDENCY_SOURCE: BUNDLED @@ -803,7 +801,6 @@ jobs: contents: read packages: write env: - # on Windows, link ODBC statically and compile into 1 DLL to minimize signing ARROW_BUILD_SHARED: OFF ARROW_BUILD_STATIC: ON ARROW_BUILD_TESTS: ON @@ -843,14 +840,6 @@ jobs: uses: ./.github/actions/odbc-windows with: github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Check ODBC Dependency - shell: cmd - run: | - # ODBC dependency should not include other Arrow libraries - call "%VS_INSTALL_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64 || exit /b 1 - dumpbin /dependents build\cpp\%ARROW_BUILD_TYPE%\arrow_flight_sql_odbc.dll > odbc_dependents.txt || exit /b 1 - type odbc_dependents.txt - bash -c "if grep -i '^ *arrow.*\.dll' odbc_dependents.txt; then echo 'Error: Flight SQL ODBC DLL depends on Arrow DLLs'; exit 1; fi" - name: Test shell: cmd run: | diff --git a/compose.yaml b/compose.yaml index 908c54d8a193..5d3245c575cc 100644 --- a/compose.yaml +++ b/compose.yaml @@ -542,12 +542,11 @@ services: depends_on: dremio: condition: service_healthy - # Use `/arrow/build` so build artifacts are visible on the CI host command: > /bin/bash -c " - /arrow/ci/scripts/cpp_build.sh /arrow /arrow/build && + /arrow/ci/scripts/cpp_build.sh /arrow /build && sudo /arrow/cpp/src/arrow/flight/sql/odbc/install/unix/install_odbc.sh /usr/local/lib/libarrow_flight_sql_odbc.so && - /arrow/ci/scripts/cpp_test.sh /arrow /arrow/build" + /arrow/ci/scripts/cpp_test.sh /arrow /build" ubuntu-cpp-minimal: # Arrow build with minimal components/dependencies diff --git a/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt b/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt index 8a62a45fa047..b0ad70532b18 100644 --- a/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt +++ b/cpp/src/arrow/flight/sql/odbc/tests/CMakeLists.txt @@ -57,13 +57,24 @@ elseif(WIN32) set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_LIBS arrow_odbc_spi_impl ${ARROW_FLIGHT_SQL_ODBC_TEST_LIBS} arrow_flight_sql_odbc_static ${ARROW_TEST_STATIC_LINK_LIBS}) -else() - # GH-49651: Link the ODBC driver dynamically on macOS and Linux. The tests call the - # driver functions directly, so they need the driver library. +elseif(APPLE OR ARROW_BUILD_SHARED) + # GH-49651: Link the ODBC driver dynamically on macOS and on Linux when the shared + # libraries are built. The tests call the driver functions directly, so they need the + # driver library. set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_MODE STATIC_LINK_LIBS) set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_LIBS ${ARROW_FLIGHT_SQL_ODBC_TEST_LIBS} arrow_flight_sql_odbc_shared ${ARROW_TEST_SHARED_LINK_LIBS}) +else() + # GH-49651: Link the ODBC driver statically on Linux without the shared libraries to + # avoid a segfault. + set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_MODE STATIC_LINK_LIBS) + set(ARROW_FLIGHT_SQL_ODBC_TEST_LINK_LIBS + ${ARROW_FLIGHT_SQL_ODBC_TEST_LIBS} + arrow_flight_sql_odbc_static + ${ARROW_TEST_STATIC_LINK_LIBS} + arrow_odbc_spi_impl + ${ARROW_PROTOBUF_LIBPROTOBUF}) endif() add_arrow_test(flight_sql_odbc_test