]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake,debian: enable ceph-mon-client-nvmeof on Debian derivatives 68817/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 7 May 2026 02:59:11 +0000 (10:59 +0800)
committerKefu Chai <k.chai@proxmox.com>
Fri, 8 May 2026 13:28:41 +0000 (21:28 +0800)
5843c6b04ba gated the build on /etc/redhat-release because gRPC devel
libs weren't packaged on Debian yet. They are now (libgrpc++-dev,
protobuf-compiler-grpc), so we can finally bring Debian derivatives on
par with Fedora/RHEL and ship the NVMe-oF gateway monitor client there
too.

This change:

- drops the /etc/redhat-release sniff and unconditionally enables
  WITH_NVMEOF_GATEWAY_MONITOR_CLIENT.
- adds libgrpc++-dev and protobuf-compiler-grpc to debian/control's
  Build-Depends, plus a ceph-mon-client-nvmeof / -dbg pair so the
  binary actually gets packaged.
- adds a pkg-config fallback for gRPC discovery. Jammy's libgrpc++-dev
  (1.30.2) ships no cmake config files [1], so find_package(gRPC CONFIG
  REQUIRED) fails at configure time. Noble's libgrpc++-dev (1.51.1)
  does ship them [2], as do RHEL/Rocky packages. We now try cmake config
  first (QUIET) and fall back to pkg_check_modules(IMPORTED_TARGET
  grpc++) when it isn't found.
- patches PkgConfig::GRPCPP to carry protobuf::libprotobuf as an
  interface dependency. grpc++.pc omits protobuf from its Requires, so
  gateway.pb.cc (which calls GOOGLE_PROTOBUF_VERIFY_VERSION) would fail
  to link on the pkg-config path. The cmake-config gRPC::grpc++ declares
  this dependency properly; we match that behaviour with
  target_link_libraries(PkgConfig::GRPCPP INTERFACE protobuf::libprotobuf).
- applies HAVE_ABSEIL only on the cmake-config path (Noble, RHEL/Rocky),
  where gRPC links system absl. Without it, opentelemetry-cpp's private
  absl (inline namespace otel_v1) collides with system absl (inline
  namespace debian7) in any TU that includes both tracer.h and
  grpcpp/grpcpp.h, giving "reference to base_internal is ambiguous".
  On the pkg-config path (Jammy's gRPC 1.30.2) libabsl-dev is not
  installed, so HAVE_ABSEIL must be skipped there.

[1] https://packages.ubuntu.com/jammy/amd64/libgrpc-dev/filelist
[2] https://packages.ubuntu.com/noble/amd64/libgrpc-dev/filelist

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
debian/ceph-mon-client-nvmeof.install [new file with mode: 0644]
debian/control
src/CMakeLists.txt
win32_build.sh

diff --git a/debian/ceph-mon-client-nvmeof.install b/debian/ceph-mon-client-nvmeof.install
new file mode 100644 (file)
index 0000000..6e6606d
--- /dev/null
@@ -0,0 +1 @@
+usr/bin/ceph-nvmeof-monitor-client
index 0f335519d02491db5113ff5902e750d47ad6aa62..189d401f0e8c7ae93a5a2a512b202204b957a441 100644 (file)
@@ -72,6 +72,8 @@ Build-Depends: automake,
                libxml2-dev,
                librabbitmq-dev,
                libre2-dev,
+               libgrpc++-dev,
+               protobuf-compiler-grpc,
                libutf8proc-dev (>= 2.2.0),
                librdkafka-dev (>= 1.1.0),
                libthrift-dev (>= 0.13.0),
@@ -85,7 +87,7 @@ Build-Depends: automake,
                libndctl-dev (>= 63) <pkg.ceph.pmdk>,
                libpmem-dev <pkg.ceph.pmdk>,
                libpmemobj-dev (>= 1.8) <pkg.ceph.pmdk>,
-               libprotobuf-dev <pkg.ceph.crimson>,
+               libprotobuf-dev,
                libxsimd-dev <!pkg.ceph.arrow>,
                ninja-build,
                nlohmann-json3-dev,
@@ -417,6 +419,33 @@ Description: debugging symbols for ceph-mon
  .
  This package contains the debugging symbols for ceph-mon.
 
+Package: ceph-mon-client-nvmeof
+Architecture: linux-any
+Depends: librados2 (= ${binary:Version}),
+         ${misc:Depends},
+         ${shlibs:Depends},
+Description: NVMe-oF Gateway Monitor Client for Ceph
+ Ceph is a massively scalable, open-source, distributed
+ storage system that runs on commodity hardware and delivers object,
+ block and file system storage.
+ .
+ This package contains the NVMe-oF Gateway Monitor Client. It distributes
+ Paxos ANA info to the NVMe-oF Gateway and provides beacons to the
+ ceph-mon daemon.
+
+Package: ceph-mon-client-nvmeof-dbg
+Architecture: linux-any
+Section: debug
+Priority: extra
+Depends: ceph-mon-client-nvmeof (= ${binary:Version}),
+         ${misc:Depends},
+Description: debugging symbols for ceph-mon-client-nvmeof
+ Ceph is a massively scalable, open-source, distributed
+ storage system that runs on commodity hardware and delivers object,
+ block and file system storage.
+ .
+ This package contains the debugging symbols for ceph-mon-client-nvmeof.
+
 Package: ceph-osd
 Architecture: linux-any
 Depends: ceph-osd-classic (= ${binary:Version}),
index 4cc9f4a726ce5f2bd48632c75b7616883d209502..0ef03f4baaab577509f761d0a79799afae73522e 100644 (file)
@@ -1015,12 +1015,7 @@ if(WITH_FUSE)
 endif(WITH_FUSE)
 
 # NVMEOF GATEWAY MONITOR CLIENT
-# Supported on RPM-based platforms only, depends on grpc devel libraries/tools
-if(EXISTS "/etc/redhat-release" OR EXISTS "/etc/fedora-release")
-  option(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT "build nvmeof gateway monitor client" ON)
-else()
-  option(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT "build nvmeof gateway monitor client" OFF)
-endif()
+option(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT "build nvmeof gateway monitor client" ON)
 
 if(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT)
 
@@ -1037,16 +1032,31 @@ if(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT)
     set(_PROTOBUF_PROTOC $<TARGET_FILE:protobuf::protoc>)
   endif()
 
-  # Find gRPC installation
-  # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
-  find_package(gRPC CONFIG REQUIRED)
-  message(STATUS "Using gRPC ${gRPC_VERSION}")
-  set(_GRPC_GRPCPP gRPC::grpc++)
-  if(CMAKE_CROSSCOMPILING)
-    find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin
-      REQUIRED)
+  # Find gRPC - try cmake config first (gRPC >= 1.50 and RHEL/Rocky packages),
+  # fall back to pkg-config for distros without cmake config files (e.g. Ubuntu 22.04).
+  find_package(gRPC CONFIG QUIET)
+  if(gRPC_FOUND)
+    message(STATUS "Using gRPC ${gRPC_VERSION}")
+    set(_GRPC_GRPCPP gRPC::grpc++)
+    if(CMAKE_CROSSCOMPILING)
+      find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin REQUIRED)
+    else()
+      set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
+    endif()
+    # Modern gRPC links system absl; HAVE_ABSEIL makes opentelemetry-cpp do the
+    # same so their two absl inline namespaces don't collide in shared TUs.
+    set(_HAVE_ABSEIL ON)
   else()
-    set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(GRPCPP REQUIRED IMPORTED_TARGET grpc++)
+    message(STATUS "Using gRPC ${GRPCPP_VERSION} (via pkg-config)")
+    set(_GRPC_GRPCPP PkgConfig::GRPCPP)
+    find_program(_GRPC_CPP_PLUGIN_EXECUTABLE grpc_cpp_plugin REQUIRED)
+    # Older gRPC (e.g. Jammy's 1.30.2) uses bundled absl; libabsl-dev not required.
+    set(_HAVE_ABSEIL OFF)
+    # grpc++.pc omits protobuf from Requires; add it so PkgConfig::GRPCPP
+    # carries the same transitive dependency as the cmake-config gRPC::grpc++.
+    target_link_libraries(PkgConfig::GRPCPP INTERFACE protobuf::libprotobuf)
   endif()
 
   # Gateway Proto file
@@ -1111,9 +1121,7 @@ if(WITH_NVMEOF_GATEWAY_MONITOR_CLIENT)
     nvmeof/NVMeofGwMonitorClient.cc)
   add_executable(ceph-nvmeof-monitor-client ${ceph_nvmeof_monitor_client_srcs})
   add_dependencies(ceph-nvmeof-monitor-client ceph-common)
-  # absl is installed as grpc build dependency on RPM based systems
-  # Also isolate this flag to specific targets which needs this package
-  if(EXISTS "/etc/redhat-release" OR EXISTS "/etc/fedora-release")
+  if(_HAVE_ABSEIL)
     target_compile_definitions(ceph-nvmeof-monitor-client PRIVATE HAVE_ABSEIL)
     target_compile_definitions(ceph-mon PRIVATE HAVE_ABSEIL)
   endif()
index 0bca0bb4eebd054c58c3c5ceea372f3aeb51fb04..dee9a0be83fe5ce0c950ed4863d7d6351d55a740 100755 (executable)
@@ -196,6 +196,7 @@ cmake -D CMAKE_PREFIX_PATH=$depsDirs \
       -D ENABLE_SHARED=$ENABLE_SHARED -D WITH_RBD=ON -D BUILD_GMOCK=ON \
       -D WITH_CEPHFS=OFF -D WITH_MANPAGE=OFF \
       -D WITH_MGR_DASHBOARD_FRONTEND=OFF -D WITH_SYSTEMD=OFF -D WITH_TESTS=ON \
+      -D WITH_NVMEOF_GATEWAY_MONITOR_CLIENT=OFF \
       -D LZ4_INCLUDE_DIR=$lz4Include -D LZ4_LIBRARY=$lz4Lib \
       -D Backtrace_INCLUDE_DIR="$backtraceDir/include" \
       -D Backtrace_LIBRARY="$backtraceDir/lib/libbacktrace.a" \