~ruther/guix-local

6b371df5d4dee4b357b839f7fb6eb75a420777ec — Maxim Cournoyer 2 months ago d564b1c
gnu: ceph: Update to 20.3.0 and reinstate parallel build.

* gnu/packages/storage.scm (ceph): Update to 20.3.0.
[source]: Switch to git.
<patches>: Remove ceph-disable-cpu-optimizations.patch and
ceph-fix-for-newer-boost.patch patches, which no longer apply.  Add
ceph-fix-cmake.patch.
<snippet>: Update snippet.
[outputs]: Delete field.
[#:parallel-build?]: Delete argument.
[#:configure-flags]: Streamline, due to removing the lib separate output.  Add
"-DENABLE_GIT_VERSION=OFF", "-DCEPHADM_BUNDLED_DEPENDENCIES=none",
"-DWITH_SYSTEM_FMT=ON", "-DWITH_SYSTEM_LIBURING=ON", "-DWITH_SYSTEM_ZSTD=ON",
"-DWITH_MGR=OFF" and "-DWITH_RADOSGW=OFF".
[target-x86-64?]: Add "-DWITH_SYSTEM_QATLIB=ON" and "-DWITH_SYSTEM_QATZIP=ON".
[#:phases] {unbundle-blake3, relax-fmt-requirement, fix-zstd-include}
{set-source-file-times-to-1980, build-legacy-option-header}: New phases.
{set-install-environment}: Delete phase.
{patch-source}: Streamline and update phase.
[native-inputs]: Remove gperf, git-minimal.
[inputs]: Sort.  Replace boost with boost-1.88.  Replace fmt-8 with fmt-11.
Replace rocksdb with rocksdb-for-ceph.
Replace fuse-2 by fuse.  Add libcap, libnbd, liburing, lmdb and zstd:lib.
<[target-x86-64?]>: Add qatlib and qatzip.
* gnu/packages/patches/ceph-fix-cmake.patch: New file.
* gnu/packages/patches/ceph-disable-cpu-optimizations.patch: Delete file.
* gnu/packages/patches/ceph-fix-for-newer-boost.patch: Likewise.
* gnu/local.mk (dist_patch_DATA): Update accordingly.

Fixes: #1918
Change-Id: Ifd7af71bd87c19c8c6b96349e06c365be976347a
5 files changed, 199 insertions(+), 262 deletions(-)

M gnu/local.mk
D gnu/packages/patches/ceph-disable-cpu-optimizations.patch
A gnu/packages/patches/ceph-fix-cmake.patch
D gnu/packages/patches/ceph-fix-for-newer-boost.patch
M gnu/packages/storage.scm
M gnu/local.mk => gnu/local.mk +1 -2
@@ 1087,8 1087,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/cdparanoia-fpic.patch			\
  %D%/packages/patches/cdrkit-libre-cross-compile.patch	\
  %D%/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch 	\
  %D%/packages/patches/ceph-disable-cpu-optimizations.patch	\
  %D%/packages/patches/ceph-fix-for-newer-boost.patch		\
  %D%/packages/patches/ceph-fix-cmake.patch                     \
  %D%/packages/patches/cf-tool-add-languages.patch		\
  %D%/packages/patches/chmlib-inttypes.patch			\
  %D%/packages/patches/cl-asdf-config-directories.patch		\

D gnu/packages/patches/ceph-disable-cpu-optimizations.patch => gnu/packages/patches/ceph-disable-cpu-optimizations.patch +0 -43
@@ 1,43 0,0 @@
Disable CPU optimizations not supported by all x86_64 systems.

--- a/cmake/modules/SIMDExt.cmake	2017-03-23 22:22:58.254071694 +0100
+++ b/cmake/modules/SIMDExt.cmake	2017-03-23 22:23:22.446848845 +0100
@@ -5,11 +5,6 @@
 # HAVE_ARM_NEON
 # HAVE_INTEL_SSE
 # HAVE_INTEL_SSE2
-# HAVE_INTEL_SSE3
-# HAVE_INTEL_SSSE3
-# HAVE_INTEL_PCLMUL
-# HAVE_INTEL_SSE4_1
-# HAVE_INTEL_SSE4_2
 #
 # SIMD_COMPILE_FLAGS
 #
@@ -85,26 +80,6 @@
       if(HAVE_INTEL_SSE2)
         set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse2")
       endif()
-      CHECK_C_COMPILER_FLAG(-msse3 HAVE_INTEL_SSE3)
-      if(HAVE_INTEL_SSE3)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse3")
-      endif()
-      CHECK_C_COMPILER_FLAG(-mssse3 HAVE_INTEL_SSSE3)
-      if(HAVE_INTEL_SSSE3)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mssse3")
-      endif()
-      CHECK_C_COMPILER_FLAG(-mpclmul HAVE_INTEL_PCLMUL)
-      if(HAVE_INTEL_PCLMUL)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -mpclmul")
-      endif()
-      CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_INTEL_SSE4_1)
-      if(HAVE_INTEL_SSE4_1)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.1")
-      endif()
-      CHECK_C_COMPILER_FLAG(-msse4.2 HAVE_INTEL_SSE4_2)
-      if(HAVE_INTEL_SSE4_2)
-        set(SIMD_COMPILE_FLAGS "${SIMD_COMPILE_FLAGS} -msse4.2")
-      endif()
     endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64|AMD64")
   endif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686|amd64|x86_64|AMD64")
 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(powerpc|ppc)64le")

A gnu/packages/patches/ceph-fix-cmake.patch => gnu/packages/patches/ceph-fix-cmake.patch +22 -0
@@ 0,0 1,22 @@
Upstream-status: Not forwarded yet.

diff -u /tmp/guix-build-ceph-20.3.0.drv-0/source/CMakeLists.txt /tmp/guix-build-ceph-20.3.0.drv-0/source/CMakeLists.txt.orig
--- a/CMakeLists.txt	2025-12-19 13:14:44.050684729 +0900
+++ b/CMakeLists.txt	2025-12-19 13:15:06.218810041 +0900
@@ -356,12 +356,12 @@
   find_package(QatDrv REQUIRED COMPONENTS qat_s usdm_drv_s)
   set(HAVE_QAT TRUE)
 elseif(WITH_QATLIB)
-  if(NOT WITH_SYSTEM_QAT)
+  if(NOT WITH_SYSTEM_QATLIB)
     include(BuildQAT)
     build_qat()
   endif()
   find_package(QAT REQUIRED)
-  if(NOT WITH_SYSTEM_QAT)
+  if(NOT WITH_SYSTEM_QATLIB)
     add_dependencies(QAT::qat qatlib_ext)
     add_dependencies(QAT::usdm qatlib_ext)
   endif()

Diff finished.  Fri Dec 19 13:15:39 2025

D gnu/packages/patches/ceph-fix-for-newer-boost.patch => gnu/packages/patches/ceph-fix-for-newer-boost.patch +0 -50
@@ 1,50 0,0 @@
Adjust to newer Boost interface.

--- a/src/rgw/rgw_asio_client.cc	1970-01-01 01:00:01.000000000 +0100
+++ b/src/rgw/rgw_asio_client.cc	2024-09-11 08:33:21.723548804 +0200
@@ -39,11 +39,11 @@
     const auto& value = header->value();
 
     if (field == beast::http::field::content_length) {
-      env.set("CONTENT_LENGTH", value.to_string());
+      env.set("CONTENT_LENGTH", std::string(value));
       continue;
     }
     if (field == beast::http::field::content_type) {
-      env.set("CONTENT_TYPE", value.to_string());
+      env.set("CONTENT_TYPE", std::string(value));
       continue;
     }
 
@@ -62,26 +62,26 @@
     }
     *dest = '\0';
 
-    env.set(buf, value.to_string());
+    env.set(buf, std::string(value));
   }
 
   int major = request.version() / 10;
   int minor = request.version() % 10;
   env.set("HTTP_VERSION", std::to_string(major) + '.' + std::to_string(minor));
 
-  env.set("REQUEST_METHOD", request.method_string().to_string());
+  env.set("REQUEST_METHOD", std::string(request.method_string()));
 
   // split uri from query
   auto uri = request.target();
   auto pos = uri.find('?');
   if (pos != uri.npos) {
     auto query = uri.substr(pos + 1);
-    env.set("QUERY_STRING", query.to_string());
+    env.set("QUERY_STRING", std::string(query));
     uri = uri.substr(0, pos);
   }
-  env.set("SCRIPT_URI", uri.to_string());
+  env.set("SCRIPT_URI", std::string(uri));
 
-  env.set("REQUEST_URI", request.target().to_string());
+  env.set("REQUEST_URI", std::string(request.target()));
 
   char port_buf[16];
   snprintf(port_buf, sizeof(port_buf), "%d", local_endpoint.port());

M gnu/packages/storage.scm => gnu/packages/storage.scm +176 -167
@@ 87,198 87,207 @@
(define-public ceph
  (package
    (name "ceph")
    (version "17.2.9")
    (version "20.3.0")
    (source (origin
              (method url-fetch)
              (uri (string-append "https://download.ceph.com/tarballs/ceph-"
                                  version ".tar.gz"))
              (method git-fetch)
              (uri (git-reference
                     (url "https://github.com/ceph/ceph")
                     (commit (string-append "v" version))
                     ;; There are many source bundled libraries, and the build
                     ;; system does not yet support using dependencies from
                     ;; the system for all of them.
                     (recursive? #t)))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "04m4zxp9hjvppl679ilnr90zr6ij08wr4ralr0whzldy0fskc8hp"))
              (patches
               (search-patches
                "ceph-disable-cpu-optimizations.patch"
                "ceph-fix-for-newer-boost.patch" ))
                "08k7f1nj3g1mb7h8vgw71xgpslz0dhqwr6ldzxs3naf2f73x0mh8"))
              (patches (search-patches "ceph-fix-cmake.patch"))
              (modules '((guix build utils)))
              (snippet
               ;; Delete bundled libraries where feasible.
               '(for-each delete-file-recursively
                          '(;; TODO: Unbundle these:
                            "src/arrow"
                          '( ;; TODO: Unbundle these:
                            ;;"src/isa-l"
                            ;;"src/lua"
                            ;;"src/xxHash"
                            ;;"src/zstd"
                            ;;"src/civetweb"
                            "src/BLAKE3"
                            "src/arrow"
                            "src/c-ares"
                            "src/fmt"
                            "src/googletest"
                            "src/rapidjson"
                            "src/jaegertracing"
                            "src/qatlib"
                            "src/qatzip"
                            "src/spdk"
                            "src/rocksdb"
                            "src/boost"
                            "src/utf8proc")))))
                            "src/utf8proc"
                            "src/zstd"
                            "systemd")))))
    (build-system cmake-build-system)
    (arguments
     (list
      #:parallel-build? #f ;because mgr_legacy_options.h is not built in time
      #:configure-flags
      '(let* ((out (assoc-ref %outputs "out"))
              (lib (assoc-ref %outputs "lib"))
              (libdir (string-append lib "/lib")))
         (list (string-append "-DCMAKE_INSTALL_PREFIX=" out)
               (string-append "-DCMAKE_INSTALL_LIBDIR=" libdir)
               (string-append "-DCMAKE_INSTALL_INCLUDEDIR="
                              lib "/include")
               ;; We need both libdir and libdir/ceph in RUNPATH.
               (string-append "-DCMAKE_INSTALL_RPATH="
                              libdir ";" libdir "/ceph")
               (string-append "-DCMAKE_INSTALL_SYSCONFDIR=" out "/etc")
               (string-append "-DCMAKE_INSTALL_DATADIR=" lib "/share")
               (string-append "-DCMAKE_INSTALL_MANDIR=" out "/share/man")
               (string-append "-DCMAKE_INSTALL_DOCDIR=" out "/share/ceph/doc")
               (string-append "-DCMAKE_INSTALL_LIBEXECDIR=" out "/libexec")
               (string-append "-DKEYUTILS_INCLUDE_DIR="
                              (assoc-ref %build-inputs "keyutils") "/include")
               (string-append "-DXFS_INCLUDE_DIR="
                              (assoc-ref %build-inputs "xfsprogs") "/include")
               "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
               "-DBUILD_SHARED_LIBS=ON"
               "-DWITH_SYSTEM_ARROW=ON"
               "-DWITH_SYSTEM_BOOST=ON"
               "-DWITH_SYSTEM_ROCKSDB=ON"
               "-DWITH_SYSTEM_UTF8PROC=ON"
      #~(list (string-append "-DCMAKE_INSTALL_RPATH="
                             #$output "/lib" ";" #$output "/lib/ceph")
              "-DENABLE_GIT_VERSION=OFF"
              "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
              "-DBUILD_SHARED_LIBS=ON"
              "-DCEPHADM_BUNDLED_DEPENDENCIES=none"
              "-DWITH_SYSTEM_ARROW=ON"
              "-DWITH_SYSTEM_BOOST=ON"
              "-DWITH_SYSTEM_FMT=ON"
              #$@(if (target-x86-64?)
                     #~("-DWITH_SYSTEM_QATLIB=ON"
                        "-DWITH_SYSTEM_QATZIP=ON")
                     #~())
              "-DWITH_SYSTEM_LIBURING=ON"
              "-DWITH_SYSTEM_ROCKSDB=ON"
              "-DWITH_SYSTEM_UTF8PROC=ON"
              "-DWITH_SYSTEM_ZSTD=ON"

               ;; TODO: Enable these when available in Guix.
               "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv
               "-DWITH_BABELTRACE=OFF"
               "-DWITH_LTTNG=OFF"
               "-DWITH_SPDK=OFF"
               "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
              ;; TODO: Enable these when available in Guix.
              "-DWITH_MGR=OFF"        ;requires python-rook-client
              "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv
              "-DWITH_BABELTRACE=OFF"
              "-DWITH_JAEGER=OFF"     ;requires bundled opentelemetry-cpp
              "-DWITH_LTTNG=OFF"
              "-DWITH_RADOSGW=OFF"    ;requires bundled libkmip and rgw
              "-DWITH_SPDK=OFF"
              "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF"

               ;; Use jemalloc instead of tcmalloc.
               "-DALLOCATOR=jemalloc"
              ;; Use jemalloc instead of tcmalloc.
              "-DALLOCATOR=jemalloc"

               ;; Don't install systemd unit files.
               "-DWITH_SYSTEMD=OFF"
              ;; Don't install systemd unit files.
              "-DWITH_SYSTEMD=OFF"

               ;; Do not bother building the tests; we are not currently running
               ;; them, and they do not build with system googletest as of 14.2.5.
               "-DWITH_TESTS=OFF"))
       ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See
       ;; <https://bugs.gnu.org/29674> for details. Disable tests until
       ;; resolved.
       #:tests? #f
       #:phases
       `(modify-phases %standard-phases
              ;; Do not bother building the tests; we are not currently running
              ;; them, and they do not build with system googletest as of 14.2.5.
              "-DWITH_TESTS=OFF")
      ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See
      ;; <https://bugs.gnu.org/29674> for details. Disable tests until
      ;; resolved.
      #:tests? #f
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'unbundle-blake3
            (lambda _
              ;; Unbundle Blake3.
              (substitute* "src/CMakeLists.txt"
                (("add_subdirectory.*BLAKE3.*") ""))))
          (add-after 'unpack 'relax-fmt-requirement
            (lambda _
              (substitute* "src/CMakeLists.txt"
                (("11.1.4 REQUIRED")
                 "<12 REQUIRED"))))
          (add-after 'unpack 'fix-zstd-include
            (lambda _
              ;; See <https://tracker.ceph.com/issues/63194>.
              (substitute* "src/compressor/zstd/ZstdCompressor.h"
                (("#include \"zstd/lib/zstd.h\"")
                 "#include \"zstd.h\""))))
          (add-after 'unpack 'set-source-file-times-to-1980
            (lambda _
              (let ((circa-1980 (* 10 366 24 60 60)))
                (for-each (lambda (f) (utime f circa-1980 circa-1980))
                          (find-files "src")))))
          (add-before 'build 'build-legacy-option-header
            (lambda _
              ;; Building this target in parallel causes races (see:
              ;; <https://tracker.ceph.com/issues/63402>), so build it before
              ;; the main build without parallelism.
              (invoke "make" "legacy-option-headers")))
          (add-after 'unpack 'patch-source
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out"))
                    (lib (assoc-ref outputs "lib")))

                (substitute* "src/rgw/store/dbstore/sqlite/CMakeLists.txt"
                  (("add_library\\(sqlite_db \\$")
                   "add_library(sqlite_db STATIC $"))
                (substitute* "src/rgw/store/dbstore/CMakeLists.txt"
                  (("add_library\\(dbstore \\$")
                   "add_library(dbstore STATIC $")
                  (("add_library\\(dbstore_lib \\$")
                   "add_library(dbstore_lib STATIC $"))

                (substitute* "cmake/modules/Distutils.cmake"
                  ;; Prevent creation of Python eggs.
                  (("setup.py install")
                   "setup.py install --single-version-externally-managed --root=/")
                  ;; Inject the -rpath linker argument when linking
                  ;; Python C libraries so RUNPATH gets set up correctly.
                  (("LDFLAGS=(.*)\n" _ flags)
                   (string-append "LDFLAGS=\\\"" flags
                                  " -Wl,-rpath=" lib "/lib\\\"\n")))

                ;; Statically link libcrc32 because it does not get installed,
                ;; yet several libraries end up referring to it.
                (substitute* "src/common/CMakeLists.txt"
                  (("add_library\\(crc32")
                   "add_library(crc32 STATIC"))

                (substitute* "udev/50-rbd.rules"
                  (("/usr/bin/ceph-rbdnamer")
                   (string-append out "/bin/ceph-rbdnamer"))))))
          (add-before 'install 'set-install-environment
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (py3sitedir
                      (string-append out "/lib/python"
                                     ,(version-major+minor
                                       (package-version python))
                                     "/site-packages")))
                ;; The Python install scripts refuses to function if
                ;; the install directory is not on PYTHONPATH.
                (setenv "PYTHONPATH" py3sitedir))))
            (lambda _
              (substitute* "cmake/modules/Distutils.cmake"
                ;; Prevent creation of Python eggs.
                (("setup.py install")
                 "setup.py install --single-version-externally-managed --root=/")
                ;; Inject the -rpath linker argument when linking
                ;; Python C libraries so RUNPATH gets set up correctly.
                (("LDFLAGS=(.*)\n" _ flags)
                 (string-append "LDFLAGS=\\\"" flags
                                " -Wl,-rpath=" #$output "/lib\\\"\n")))
              (substitute* "udev/50-rbd.rules"
                (("/usr/bin/ceph-rbdnamer")
                 (string-append #$output "/bin/ceph-rbdnamer")))))
          (add-after 'install 'wrap-python-scripts
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
                     (scripts '("bin/ceph" "bin/cephfs-top" "sbin/ceph-volume"))
            (lambda* (#:key inputs #:allow-other-keys)
              (let* ((scripts '("bin/ceph" "bin/cephfs-top" "sbin/ceph-volume"))
                     (dependencies (map (lambda (input)
                                          (assoc-ref inputs input))
                                        '("python-prettytable" "python-pyyaml")))
                     (sitedir (lambda (package)
                                (string-append package
                                               "/lib/python"
                                               ,(version-major+minor
                                                 (package-version python))
                                               "/site-packages")))
                     (PYTHONPATH (string-join (map sitedir (cons out dependencies))
                                              ":")))
                (for-each (lambda (executable)
                            (wrap-program (string-append out "/" executable)
                              `("GUIX_PYTHONPATH" ":" prefix (,PYTHONPATH))))
                     (site (lambda (package)
                             (string-append package
                                            "/lib/python"
                                            #$(version-major+minor
                                               (package-version
                                                (this-package-input "python")))
                                            "/site-packages")))
                     (PYTHONPATH (string-join
                                  (map site (cons #$output dependencies))
                                  ":")))
                (for-each (lambda (s)
                            (wrap-program (string-append #$output "/" s)
                              `("GUIX_PYTHONPATH" prefix (,PYTHONPATH))))
                          scripts)))))))
    (outputs
     '("out" "lib"))
    (native-inputs
     (list git-minimal gperf pkg-config python-cython python-sphinx yasm))
    (inputs
     (list `(,apache-thrift "lib")
           `(,apache-thrift "include")
           `(,apache-arrow-for-ceph "lib")
           bash-minimal
           boost
           curl
           cryptsetup-minimal
           eudev
           expat
           fcgi
           fmt-8
           fuse-2
           icu4c
           jemalloc
           keyutils
           leveldb
           libaio
           libatomic-ops
           libcap-ng
           libnl
           librdkafka
           lua
           lz4
           oath-toolkit
           openldap
           openssl
           ncurses
           nss
           python-prettytable           ;used by ceph_daemon.py
           python-pyyaml                ;from python-common/setup.py
     (list pkg-config
           python
           rapidjson
           rdma-core
           rocksdb
           snappy
           sqlite
           utf8proc
           util-linux
           `(,util-linux "lib")
           xfsprogs
           zlib))
           python-cython
           python-sphinx
           yasm))
    (inputs
     (append
      (if (target-x86-64?)
          (list qatlib qatzip)
          '())
      (list `(,apache-thrift "lib")
            `(,apache-thrift "include")
            `(,apache-arrow "lib")
            `(,util-linux "lib")
            bash-minimal
            boost-1.88
            cryptsetup-minimal
            curl
            eudev
            expat
            fcgi
            fmt-11
            fuse
            icu4c
            jemalloc
            keyutils
            leveldb
            libaio
            libatomic-ops
            libcap                      ;for src/extblkdev
            libcap-ng
            libblake3
            libnbd
            libnl
            librdkafka
            liburing
            lmdb
            lua
            lz4
            ncurses
            nss
            oath-toolkit
            openldap
            openssl
            python
            python-prettytable          ;used by ceph_daemon.py
            python-pyyaml               ;from python-common/setup.py
            rapidjson
            rdma-core
            rocksdb-for-ceph
            snappy
            sqlite
            utf8proc
            util-linux
            xfsprogs
            zlib
            `(,zstd "lib"))))
    (home-page "https://ceph.com/")
    (synopsis "Distributed object store and file system")
    (description


@@ 291,10 300,10 @@ storage protocols (S3, NFS, and others) through the RADOS gateway.")
    ;; not use the GPL code. The source archive includes a number of files
    ;; carrying other licenses; consult COPYING for more information. Note
    ;; that COPYING does not cover third-party bundled software.
    (license (list license:lgpl2.1 license:gpl2  ;some files are 'or later'
                   license:cc-by-sa3.0           ;documentation
                   license:bsd-3                 ;isa-l,jerasure,++
                   license:expat))))             ;civetweb,java bindings
    (license (list license:lgpl2.1 license:gpl2 ;some files are 'or later'
                   license:cc-by-sa3.0          ;documentation
                   license:bsd-3                ;isa-l,jerasure,++
                   license:expat))))            ;java bindings

(define-public libnbd
  (package