From: Kefu Chai Date: Thu, 7 May 2026 02:59:11 +0000 (+0800) Subject: cmake,debian: enable ceph-mon-client-nvmeof on Debian derivatives X-Git-Tag: v21.0.1~75^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=62cf01d0decf7455b8cb37abfe317008dcf131a3;p=ceph.git cmake,debian: enable ceph-mon-client-nvmeof on Debian derivatives 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 --- diff --git a/debian/ceph-mon-client-nvmeof.install b/debian/ceph-mon-client-nvmeof.install new file mode 100644 index 00000000000..6e6606db8c3 --- /dev/null +++ b/debian/ceph-mon-client-nvmeof.install @@ -0,0 +1 @@ +usr/bin/ceph-nvmeof-monitor-client diff --git a/debian/control b/debian/control index 0f335519d02..189d401f0e8 100644 --- a/debian/control +++ b/debian/control @@ -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) , libpmem-dev , libpmemobj-dev (>= 1.8) , - libprotobuf-dev , + libprotobuf-dev, libxsimd-dev , 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}), diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4cc9f4a726c..0ef03f4baaa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 $) 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 $) + 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 $) + 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() diff --git a/win32_build.sh b/win32_build.sh index 0bca0bb4eeb..dee9a0be83f 100755 --- a/win32_build.sh +++ b/win32_build.sh @@ -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" \