diff --git a/cpp/core/CMakeLists.txt b/cpp/core/CMakeLists.txt index 9530d603f5b..fc71292a622 100644 --- a/cpp/core/CMakeLists.txt +++ b/cpp/core/CMakeLists.txt @@ -162,6 +162,9 @@ add_dependencies(gluten jni_proto) if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") target_link_options( gluten PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) + # Strip the symbol table in Release builds to reduce binary size. + target_link_options(gluten PRIVATE + $<$>:-Wl,-s>) endif() if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0) diff --git a/cpp/velox/CMakeLists.txt b/cpp/velox/CMakeLists.txt index 4ec3f9f0f2e..77d24b44918 100644 --- a/cpp/velox/CMakeLists.txt +++ b/cpp/velox/CMakeLists.txt @@ -258,10 +258,13 @@ if(GLUTEN_VELOX_ENABLE_PARQUET) message(STATUS "Propagating VELOX_ENABLE_PARQUET to Gluten Velox backend") endif() -if(ENABLE_GLUTEN_VCPKG AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") - # Hide some symbols to avoid conflict. +if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + # Hide symbols not needed by JNI callers. target_link_options( velox PRIVATE -Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/symbols.map) + # Strip the symbol table in Release builds to reduce binary size. + target_link_options(velox PRIVATE + $<$>:-Wl,-s>) endif() find_protobuf()