Skip to content

GH-49538: [C++][FlightRPC][ODBC] Use static linkage in Windows FlightSQL ODBC driver#49585

Open
amoeba wants to merge 35 commits intoapache:mainfrom
amoeba:flight-sql-odbc-static
Open

GH-49538: [C++][FlightRPC][ODBC] Use static linkage in Windows FlightSQL ODBC driver#49585
amoeba wants to merge 35 commits intoapache:mainfrom
amoeba:flight-sql-odbc-static

Conversation

@amoeba
Copy link
Copy Markdown
Member

@amoeba amoeba commented Mar 24, 2026

Rationale for this change

The FlightSQL ODBC driver was previously using dynamic linkage for the Arrow deps it relies on. This worked but prevented a challenge for code signing because (I think) we'd have to sign each DLL and signing costs money. We can use static linkage with a dynamically linked MSVC runtime so we only have one DLL to sign.

Ref: #49404

What changes are included in this PR?

Updates to CMake and CI for the build to allow static linkage with dynamic MSVC runtime (x64-windows-static-md).

Are these changes tested?

Yes.

Are there any user-facing changes?

No.

@github-actions
Copy link
Copy Markdown

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

See also:

@amoeba
Copy link
Copy Markdown
Member Author

amoeba commented Mar 24, 2026

I have this building locally. Before this PR:

Dump of file release\arrow_flight_sql_odbc.dll

File Type: DLL

  Image has the following dependencies:

    arrow_flight_sql.dll
    arrow_flight.dll
    WSOCK32.dll
    WS2_32.dll
    CRYPT32.dll
    GDI32.dll
    arrow_compute.dll
    arrow.dll
    abseil_dll.dll
    boost_locale-vc143-mt-x64-1_90.dll
    KERNEL32.dll
    USER32.dll
    COMDLG32.dll
    MSVCP140.dll
    MSVCP140_CODECVT_IDS.dll
    VCRUNTIME140.dll
    VCRUNTIME140_1.dll
    api-ms-win-crt-runtime-l1-1-0.dll
    api-ms-win-crt-heap-l1-1-0.dll
    api-ms-win-crt-string-l1-1-0.dll
    api-ms-win-crt-stdio-l1-1-0.dll
    api-ms-win-crt-locale-l1-1-0.dll
    api-ms-win-crt-convert-l1-1-0.dll
    api-ms-win-crt-filesystem-l1-1-0.dll
    api-ms-win-crt-time-l1-1-0.dll

After:

Dump of file cpp\build\release\arrow_flight_sql_odbc.dll

File Type: DLL

  Image has the following dependencies:

    ADVAPI32.dll
    IPHLPAPI.DLL
    WSOCK32.dll
    GDI32.dll
    WS2_32.dll
    CRYPT32.dll
    KERNEL32.dll
    USER32.dll
    COMDLG32.dll
    bcrypt.dll
    dbghelp.dll

@amoeba amoeba force-pushed the flight-sql-odbc-static branch from 74eb8f6 to 3320df2 Compare March 29, 2026 18:29
@amoeba amoeba force-pushed the flight-sql-odbc-static branch from ca55ec8 to 7782c69 Compare April 11, 2026 05:32
@amoeba amoeba changed the title DRAFT: set up static build of ODBC FlightSQL driver GH-49538: [C++][FlightRPC][ODBC] Use static linkage in Windows FlightSQL ODBC driver Apr 18, 2026
@github-actions
Copy link
Copy Markdown

⚠️ GitHub issue #49538 has been automatically assigned in GitHub to PR creator.

Copy link
Copy Markdown
Member

@lidavidm lidavidm left a comment

Choose a reason for hiding this comment

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

Comment thread cpp/src/arrow/flight/sql/odbc/tests/odbc_test_suite.cc
@github-actions github-actions bot added awaiting merge Awaiting merge awaiting review Awaiting review and removed awaiting review Awaiting review labels Apr 19, 2026
@github-actions github-actions bot added awaiting committer review Awaiting committer review and removed awaiting review Awaiting review awaiting merge Awaiting merge labels Apr 20, 2026
Copy link
Copy Markdown
Collaborator

@alinaliBQ alinaliBQ left a comment

Choose a reason for hiding this comment

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

@amoeba I see the branch is about a week old, could we rebase on the latest main? I see there are no conflicts, but I am curious to see if the test code changes at odbc_impl in this PR can incidentally help with #49767 (not required for this PR)

I have tested the ODBC MSI installer manually, and can confirm I am able to retrieve data from Power BI using the installer and static linkage ODBC.

void ODBCTestBase::TearDownTestSuite() {
if (connected) {
Disconnect();
// TODO(XXX): Without commenting this out, Disconnect() makes this test
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could we link 49808 in the comment?

FYI - During Disconnect, the driver DLL is unloaded. Since Arrow libraries don't support unloading #47608 (comment), segmentation fault can occur.

Suggested change
// TODO(XXX): Without commenting this out, Disconnect() makes this test
// GH-49808 TODO: Without commenting this out, Disconnect() makes this test

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.

3 participants