]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: build static seastar for release builds 66682/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 18 Dec 2025 08:41:49 +0000 (16:41 +0800)
committerKefu Chai <k.chai@proxmox.com>
Thu, 18 Dec 2025 08:58:19 +0000 (16:58 +0800)
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 <k.chai@proxmox.com>
src/CMakeLists.txt

index 1051d6b746507d9096b8642eb3131dc9a87376a1..7a4a8acc5df0d28aa323d665045c59cd86edba92 100644 (file)
@@ -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")