Skip to content

GH-55432: [C++][FlightRPC][ODBC] Link Arrow libraries dynamically to ODBC - #55604

Open
alinaliBQ wants to merge 4 commits into
apache:mainfrom
dremio:gh-55432-link-arrow-dyn
Open

alinaliBQ wants to merge 4 commits into
apache:mainfrom
dremio:gh-55432-link-arrow-dyn

Conversation

@alinaliBQ

@alinaliBQ alinaliBQ commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Rationale for this change

See discussion in GH-55432

What changes are included in this PR?

  • Remove static link default setting for Linux ODBC (macOS ODBC remains static default to workaround sandbox environment)
  • Change Linux ODBC CI to enable dynamic linking
  • Add libboost-locale-dev to ci/docker/ubuntu-24.04-cpp.dockerfile as it is required dependency for ODBC. It is now required because we are no longer building the boost as bundle dependency in the CI

Are these changes tested?

Yes. I tested with local docker to ensure Linux ODBC still works. Also tested in CI.

Are there any user-facing changes?

Yes, the ODBC driver will be linked dynamically to Arrow libraries on Arrow according to settings on arrow.spec.in.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

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
ODBC has boost locale dependency
Verify that Arrow libraries are dynamically linked
@alinaliBQ
alinaliBQ marked this pull request as ready for review November 13, 2026 22:58
@alinaliBQ

Copy link
Copy Markdown
Collaborator Author

Hi @kou @lidavidm PR is ready for review, the CI failures don't look related

@kou kou added the CI: Extra: Package: Linux Run extra Linux Packages CI label Nov 15, 2026
Comment on lines +533 to +543
- 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this check here. Using shared library is important in deb/RPM packages not normal builds.

# 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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about using if(APPLE) ... else() ... endif() instead of if(NOT APPLE) ... else() ... endif() for readability? I want to avoid a negative condition such as if(NOT ...) as much as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants