From e237918f3eee9cbc0b02b1a943bbaa5a12c2e1e1 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Wed, 16 May 2018 22:29:40 +0200 Subject: [PATCH] ARROW-2561: [C++] Fix double free in cuda-test under code coverage As far as I can understand, the problem is due to both shared and static linking with libarrow. Some static std::string in libarrow.so would be destroyed twice at shutdown. Linking entirely statically seems to fix the issue. Author: Antoine Pitrou Closes #2048 from pitrou/ARROW-2561 and squashes the following commits: 7a9d1b5e Add comment and do not mention arrow_shared in static link libs 0b40b802 ARROW-2561: Fix double free in cuda-test under code coverage --- cpp/src/arrow/gpu/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/src/arrow/gpu/CMakeLists.txt b/cpp/src/arrow/gpu/CMakeLists.txt index be474131e3c72..7192c43c8fd7a 100644 --- a/cpp/src/arrow/gpu/CMakeLists.txt +++ b/cpp/src/arrow/gpu/CMakeLists.txt @@ -33,7 +33,6 @@ set(ARROW_GPU_SRCS ) set(ARROW_GPU_SHARED_LINK_LIBS - arrow_shared ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY} ) @@ -42,8 +41,9 @@ ADD_ARROW_LIB(arrow_gpu SOURCES ${ARROW_GPU_SRCS} DEPENDENCIES metadata_fbs SHARED_LINK_FLAGS "" - SHARED_LINK_LIBS ${ARROW_GPU_SHARED_LINK_LIBS} - STATIC_LINK_LIBS "" + SHARED_LINK_LIBS arrow_shared ${ARROW_GPU_SHARED_LINK_LIBS} + # Static arrow_gpu must also link against CUDA shared libs + STATIC_LINK_LIBS ${ARROW_GPU_SHARED_LINK_LIBS} ) # CUDA build version @@ -72,7 +72,8 @@ install( DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig/") set(ARROW_GPU_TEST_LINK_LIBS - arrow_gpu_shared + # ARROW-2561: Must link statically against arrow and arrow_gpu to avoid double free + arrow_gpu_static ${ARROW_TEST_LINK_LIBS}) if (ARROW_BUILD_TESTS)