GH-49538: [C++][FlightRPC][ODBC] Use static linkage in Windows FlightSQL ODBC driver - #49585
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
I have this building locally. Before this PR: After: |
74eb8f6 to
3320df2
Compare
ca55ec8 to
7782c69
Compare
|
|
alinaliBQ
left a comment
There was a problem hiding this comment.
@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.
alinaliBQ
left a comment
There was a problem hiding this comment.
I was able to build and test release ODBC on my Windows machine locally. But I am getting this error on debug:
I have built from scratch and kept getting this error after several tries. I think this error was from a pre-existing issue where static Debug mode on MSVC was not supported.
absl_synchronization.lib(mutex.cc.obj) : error LNK2005: "private: void __cdecl absl::lts_20250814::Mutex::Dtor(void)" (?Dtor
@Mutex@lts_20250814@absl@@AEAAXXZ) already defined in arrow_flight_static.lib(grpc_client.obj) [C:\path\to\arrow\cpp\static-debug-build\src\arrow\flight\sql\arrow-flight-sql-test.vcxproj]
C:\path\to\arrow\cpp\static-debug-build\debug\Debug\arrow-flight-sql-test.exe :
fatal error LNK1169: one or more multiply defined symbols found [C:\path\to\arrow\cpp\static-debug-build\src\arrow\flight\sql\arrow-flight-sql-test.vcxproj]
Building Custom Rule C:/path/to/arrow/cpp/src/arrow/flight/CMakeLists.txt
test_server.cc
absl_synchronization.lib(mutex.cc.obj) : error LNK2005: "private: void __cdecl absl::lts_20250814::Mutex::Dtor(void)" (?Dtor
@Mutex@lts_20250814@absl@@AEAAXXZ) already defined in arrow_flight_static.lib(protocol_grpc_internal.obj) [C:\path\to\arrow\cpp\static-debug-build\src\arrow\flight\flight-test-server.vcxproj]
C:\path\to\arrow\cpp\static-debug-build\debug\Debug\flight-test-server.exe : fatal error
LNK1169: one or more multiply defined symbols found [C:\path\to\arrow\cpp\static-debug-build\src\arrow\flight\flight-test-server.vcxproj]
(and many errors that look similar)
Since #48964 changes absl bundling, maybe rebasing to main will fix this error on debug static builds.
1f8181f to
56ca928
Compare
|
Thanks for testing @alinaliBQ. I just rebased and I'll try a debug build locally and report back. |
4bc2cf6 to
23606fe
Compare
raulcd
left a comment
There was a problem hiding this comment.
The ODBC Windows tests seems to be segfaulting:
54/61 Test #55: arrow-flight-sql-odbc-test ................***Exception: SegFault 0.80 sec
This is not happening on main so it might be related.
|
I can reproduce the crash locally so that's good. It looks like teardown is triggering the normal unload of Three threads are still inside the DLL: Thread details |
Revert "wip: try pinning the driver" This reverts commit 19c8c57. wip: better pinning approach to test Update CMakeLists.txt write actually useful comments
17c0794 to
225cad5
Compare
|
I figured out the issue I was having with the abseil symbols in 746f8c8 so I was able to remove the The segfault looks like what we've seen before in issues such as #49651. I'm not sure but it seems reasonable the stack trace above is showing that there are gRPC threads still in flight when the test suite unloads the driver on teardown, causing the crash. It may be possible to make a refactor to make the tests not crash but I had an agent take a look and it came up with just holding a handle to the driver while the test runs and that seems to fix it: 225cad5 @raulcd @lidavidm does that look okay for a workaround? I'd love to get this into 26.0.0 if we could. |
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.