From df24ef42b1979bda684f3e272eef2d0b8ea11022 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 11 Nov 2023 07:27:10 +0100 Subject: [PATCH] Publish stripped binary --- cmake/split_debug_symbols.cmake | 2 ++ programs/CMakeLists.txt | 7 +++++++ programs/self-extracting/CMakeLists.txt | 6 +++--- tests/ci/build_check.py | 15 +++++++++++---- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/cmake/split_debug_symbols.cmake b/cmake/split_debug_symbols.cmake index d6821eb6c48..67c2c386f20 100644 --- a/cmake/split_debug_symbols.cmake +++ b/cmake/split_debug_symbols.cmake @@ -1,3 +1,5 @@ +# Generates a separate file with debug symbols while stripping it from the main binary. +# This is needed for Debian packages. macro(clickhouse_split_debug_symbols) set(oneValueArgs TARGET DESTINATION_DIR BINARY_PATH) diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index eb4a898d472..f20e1058b82 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -439,6 +439,13 @@ else() install (TARGETS clickhouse RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse) endif() +# A target to get stripped binary. +# Note: this is different to the above (extract debug symbols to a separate place) +add_custom_target(clickhouse-stripped + COMMAND "${STRIP_PATH}" -o "${CMAKE_CURRENT_BINARY_DIR}/clickhouse-stripped" --strip-debug --remove-section=.comment --remove-section=.note "${CMAKE_CURRENT_BINARY_DIR}/clickhouse" + DEPENDS clickhouse + COMMENT "Stripping clickhouse binary" VERBATIM) + if (ENABLE_TESTS) set (CLICKHOUSE_UNIT_TESTS_TARGETS unit_tests_dbms) add_custom_target (clickhouse-tests ALL DEPENDS ${CLICKHOUSE_UNIT_TESTS_TARGETS}) diff --git a/programs/self-extracting/CMakeLists.txt b/programs/self-extracting/CMakeLists.txt index f3ff0bbcd78..4b6dd07f618 100644 --- a/programs/self-extracting/CMakeLists.txt +++ b/programs/self-extracting/CMakeLists.txt @@ -11,8 +11,8 @@ else () endif () add_custom_target (self-extracting ALL - ${CMAKE_COMMAND} -E remove clickhouse + ${CMAKE_COMMAND} -E remove clickhouse clickhouse-stripped COMMAND ${COMPRESSOR} ${DECOMPRESSOR} clickhouse ../clickhouse - DEPENDS clickhouse compressor + COMMAND ${COMPRESSOR} ${DECOMPRESSOR} clickhouse-stripped ../clickhouse-stripped + DEPENDS clickhouse clickhouse-stripped compressor ) - diff --git a/tests/ci/build_check.py b/tests/ci/build_check.py index 584ece0a736..c18abcf1191 100644 --- a/tests/ci/build_check.py +++ b/tests/ci/build_check.py @@ -212,10 +212,17 @@ def upload_master_static_binaries( elif pr_info.base_ref != "master": return - s3_path = "/".join((pr_info.base_ref, static_binary_name, "clickhouse")) - binary = build_output_path / "clickhouse" - url = s3_helper.upload_build_file_to_s3(binary, s3_path) - print(f"::notice ::Binary static URL: {url}") + # Full binary with debug info: + s3_path_full = "/".join((pr_info.base_ref, static_binary_name, "clickhouse-full")) + binary_full = build_output_path / "clickhouse" + url_full = s3_helper.upload_build_file_to_s3(binary_full, s3_path_full) + print(f"::notice ::Binary static URL (with debug info): {url_full}") + + # Stripped binary without debug info: + s3_path_compact = "/".join((pr_info.base_ref, static_binary_name, "clickhouse")) + binary_compact = build_output_path / "clickhouse-stripped" + url_compact = s3_helper.upload_build_file_to_s3(binary_compact, s3_path_compact) + print(f"::notice ::Binary static URL (compact): {url_compact}") def main():