lidavidm commented on code in PR #49585:
URL: https://github.com/apache/arrow/pull/49585#discussion_r3134767726
##########
cpp/src/arrow/flight/CMakeLists.txt:
##########
@@ -371,6 +380,43 @@ if(ARROW_BUILD_BENCHMARKS)
endif(ARROW_BUILD_BENCHMARKS)
+# NOTE-49585: Workaround for issue found in GH-49585. When building Flight
+# targets with the combination of:
+#
+# - WIN32
+# - Debug
+# - /MD linkage
+#
+# You get linker errors like this:
+#
+# 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]
+#
+# If you build in Release mode w/ /MD linkage you don't get these errors.
+if(WIN32
+ AND CMAKE_BUILD_TYPE STREQUAL "Debug"
+ AND ARROW_FLIGHT_TEST_LINKAGE STREQUAL "static")
+ set(FLIGHT_TEST_EXES
+ arrow-flight-internals-test
+ arrow-flight-test
+ flight-test-server
+ arrow-flight-perf-server
+ arrow-flight-benchmark)
+ foreach(test_exe ${FLIGHT_TEST_EXES})
+ if(TARGET ${test_exe})
+ target_link_options(${test_exe} PRIVATE "/FORCE:MULTIPLE")
+ endif()
+ endforeach()
+endif()
+
Review Comment:
This happens despite linking everything statically? Ugh, I guess it is what
it is. (Also: is it just me, or do the preprocessor condition and the comment
there contradict each other? The symbol is only defined when _not_ building DLL)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]