This is an automated email from the ASF dual-hosted git repository. twice pushed a commit to branch twice/disable-lto in repository https://gitbox.apache.org/repos/asf/kvrocks.git
commit d15121cbd624dc8a67cabf4bd22f8362a5f04b95 Author: Twice <[email protected]> AuthorDate: Fri Apr 10 12:11:20 2026 +0800 build: disable LTO by default Disabled link-time optimization (LTO) by default and removed related conditions to simplify CMake configuration. Users need to manually enable LTO by `-DENABLE_LTO=ON` if they want LTO. --- CMakeLists.txt | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a378db524..b074b52a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,16 +30,11 @@ option(ASAN_WITH_LSAN "enable leak sanitizer while address sanitizer is enabled" option(ENABLE_STATIC_LIBSTDCXX "link kvrocks with static library of libstd++ instead of shared library" ON) option(ENABLE_LUAJIT "enable use of luaJIT instead of lua" ON) option(ENABLE_OPENSSL "enable openssl to support tls connection" OFF) -option(ENABLE_LTO "enable link-time optimization" ON) +option(ENABLE_LTO "enable link-time optimization" OFF) set(SYMBOLIZE_BACKEND "" CACHE STRING "symbolization backend library for cpptrace (libbacktrace, libdwarf, or empty)") set(PORTABLE 0 CACHE STRING "build a portable binary (disable arch-specific optimizations)") option(ENABLE_NEW_ENCODING "enable new encoding (#1033) for storing 64bit size and expire time in milliseconds" ON) -# to save build time in debug mode -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set(ENABLE_LTO OFF) -endif() - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0") cmake_policy(SET CMP0135 NEW) endif() @@ -144,7 +139,6 @@ endif() if (CMAKE_HOST_APPLE) set(DISABLE_JEMALLOC ON) - set(ENABLE_LTO OFF) endif () if(NOT DISABLE_JEMALLOC) @@ -298,17 +292,6 @@ else() target_compile_definitions(kvrocks_objs PUBLIC METADATA_ENCODING_VERSION=0) endif() -# disable LTO on ARM due to toolchain stability issues -string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" CMAKE_SYSTEM_PROCESSOR_LOWER) -if(CMAKE_SYSTEM_PROCESSOR_LOWER MATCHES "^(aarch64|arm64|arm)") - set(ENABLE_LTO OFF) -endif() - -# disable LTO on GCC <= 9 due to an ICE -if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10)) - set(ENABLE_LTO OFF) -endif() - if(ENABLE_LTO) include(CheckIPOSupported) check_ipo_supported(RESULT ipo_result OUTPUT ipo_output LANGUAGES CXX)
