diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt index 515802a46cf9..a03178b378bf 100644 --- a/cpp/src/gandiva/CMakeLists.txt +++ b/cpp/src/gandiva/CMakeLists.txt @@ -74,6 +74,10 @@ set(GANDIVA_STATIC_LINK_LIBS LLVM::LLVM_INTERFACE ${RE2_LIBRARY}) +if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) + set (CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ -static-libgcc") +endif() + ADD_ARROW_LIB(gandiva SOURCES ${SRC_FILES} OUTPUTS GANDIVA_LIBRARIES