From: Kefu Chai Date: Thu, 18 Dec 2025 08:41:49 +0000 (+0800) Subject: cmake: build static seastar for release builds X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2cf8e4b095c8cdc3d583bcd570f8a5a5a27e459a;p=ceph.git cmake: build static seastar for release builds When BUILD_SHARED_LIBS is set, seastar inherits this setting from the parent CMake project, causing crimson to link against libseastar.so. While this works in development environments, it breaks package installation because libseastar.so is not included in the distribution: ``` can't install ceph-crimson-osd: - nothing provides libseastar.so()(64bit) needed by ceph-crimson-osd-2:20.2.0-2.fc44.x86_64 can't install ceph-osd: - nothing provides libseastar.so()(64bit) needed by ceph-osd-2:20.2.0-2.fc44.x86_64 can't install ceph-test: - nothing provides libseastar.so()(64bit) needed by ceph-test-2:20.2.0-2.fc44.x86_64 ``` Force seastar to build as a static library regardless of the parent project's BUILD_SHARED_LIBS setting. This fixes the packaging issue and provides a modest performance improvement by eliminating PLT/GOT indirection overhead for seastar function calls. Fixes: https://tracker.ceph.com/issues/74138 Signed-off-by: Kefu Chai --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1051d6b7465..7a4a8acc5df 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -472,7 +472,21 @@ if(WITH_CRIMSON) build_dpdk(${CMAKE_BINARY_DIR}/src/dpdk) endif() endif() + set(old_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + # - Debug: shared seastar for faster development iteration + # shared seastar is allowed for faster linking and smaller executables during + # development. + # Note: shared seastar won't be packaged, so this is for developers only + # - RelWithDebInfo/Release/MinSizeRel: static seastar for production packages + # This ensures packages don't depend on libseastar.so, and avoids the performance penalty + # of calling functions in shared library. + set(BUILD_SHARED_LIBS FALSE) + endif() add_subdirectory(seastar) + set(BUILD_SHARED_LIBS ${old_BUILD_SHARED_LIBS}) + unset(old_BUILD_SHARED_LIBS) + # create the directory so cmake won't complain when looking at the imported # target: Seastar exports this directory created at build-time file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/seastar/gen/include")