Package: src:ceph
Version: ceph_20.2.4+ds-1
User: [email protected]
Usertags: python3.15
Tags: patch, ftbfs, forky, sid

Hi!

While rebuilding the python related packages against the Python 3.15rc1
version we found that ceph fails to build from source [1].
The issue is caused because python3.15 is available in the sandbox
builds, and the cmake rules try to build against the latest version
available, but python3-dev only installs the libraries and headers for
the default python3 version.

This can be fixed by setting the WITH_PYTHON3 to match the default
python3 version instead of letting cmake to figure it out. But I
consider this an unnecessary lack of support of the "supported" python
version, so I entered in a bit of a rabbit hole figuring out what are
the options that cmake uses so we could build the missing extensions
versions.

You can see the resulting patch to debian/rules control in the attached
debdiff.

I applied the fix in the sandbox [2] to be able to build the packages
that depend on ceph, please consider applying the proposed changes or,
at least, setting WITH_PYTHON3 to its proper value.

Happy hacking,

[1]: 
https://debusine.debian.net/debian/r-python-python3.15/work-request/1100089/
[2]: https://debusine.debian.net/debian/r-python-python3.15/
--
"Can you imagine what I would do if I could do all I can?" -- Sun Tzu
Saludos /\/\ /\ >< `/
diff -Nru ceph-20.2.4+ds/debian/changelog ceph-20.2.4+ds/debian/changelog
--- ceph-20.2.4+ds/debian/changelog     2026-08-21 17:02:48.000000000 +0200
+++ ceph-20.2.4+ds/debian/changelog     2026-08-24 09:53:23.000000000 +0200
@@ -1,3 +1,15 @@
+ceph (20.2.4+ds-1.1) UNRELEASED; urgency=medium
+
+  [ Daniel Baumann ]
+  * Non-maintainer upload.
+  * Adding #1143748 reference to previous changelog entry.
+
+  [ Maximiliano Curia ]
+  * Build against python3-all-dev
+  * Actually build the python extensions for all the supported versions.
+
+ -- Maximiliano Curia <[email protected]>  Mon, 24 Aug 2026 09:53:23 +0200
+
 ceph (20.2.4+ds-1) sid; urgency=high
 
   * Merging upstream version 20.2.4+ds (Closes: #1144947):
@@ -57,7 +69,8 @@
     version.
   * Moving debian specific patches to debian subdirectory within
     debian/patches.
-  * Cherry-picking patches from upstream to fix FTBFS with gcc-16.
+  * Cherry-picking patches from upstream to fix FTBFS with gcc-16 (Closes:
+    #1143748).
   * Refreshing common-Formatter-Include-cstdint.patch.
   * Cherry-picking patch from upstream to fix FTBFS linking rgw.
 
@@ -2392,7 +2405,7 @@
 
   * Non-maintainer upload.
   * Remove references to other libraries from dependency_libs field
-    (closes: #621208). 
+    (closes: #621208).
 
  -- Luk Claes <[email protected]>  Sat, 28 May 2011 22:28:48 +0200
 
diff -Nru ceph-20.2.4+ds/debian/control ceph-20.2.4+ds/debian/control
--- ceph-20.2.4+ds/debian/control       2026-08-21 17:02:48.000000000 +0200
+++ ceph-20.2.4+ds/debian/control       2026-08-24 09:53:23.000000000 +0200
@@ -112,7 +112,7 @@
  python3-cherrypy3,
  python3-coverage,
  python3-dateutil,
- python3-dev,
+ python3-all-dev,
  python3-grpcio,
  python3-jinja2,
  python3-jmespath,
diff -Nru ceph-20.2.4+ds/debian/rules ceph-20.2.4+ds/debian/rules
--- ceph-20.2.4+ds/debian/rules 2026-08-21 17:02:48.000000000 +0200
+++ ceph-20.2.4+ds/debian/rules 2026-08-24 09:53:23.000000000 +0200
@@ -9,6 +9,13 @@
 export DEB_BUILD_ARCH      ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
 export DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
 
+# cmake builds the cython bindings for a single python3 version, and left to
+# itself it picks the newest one installed. Pin it to the default python3 and
+# build the bindings for the remaining supported versions in dh_auto_build.
+PY3_DEFAULT := $(shell py3versions -dv)
+PY3_OTHERS := $(filter-out $(PY3_DEFAULT),$(shell py3versions -sv))
+CEPH_LIBDIR := $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/lib
+
 # support ccache for faster build
 # cmake uses /usr/bin/c*
 ifeq (yes,$(findstring yes,$(shell test -L /usr/lib/ccache/c++ && test -L 
/usr/lib/ccache/cc && echo -n yes)))
@@ -92,7 +99,7 @@
 extraopts += -DWITH_OCF=ON -DWITH_NSS=ON -DWITH_PYTHON3=ON -DWITH_DEBUG=ON 
-DWITH_LTTNG=OFF
 extraopts += -DWITH_MGR_DASHBOARD_FRONTEND=OFF
 extraopts += -DWITH_PYTHON2=OFF -DMGR_PYTHON_VERSION=3
-extraopts += -DWITH_PYTHON3=3
+extraopts += -DWITH_PYTHON3=$(PY3_DEFAULT)
 extraopts += -DWITH_CEPHFS_JAVA=ON
 extraopts += -DWITH_CEPHFS_SHELL=ON
 extraopts += -DWITH_TESTS=ON
@@ -173,6 +180,7 @@
        rm -f src/liburing/src/liburing.so.* src/liburing/src/queue.ol 
src/liburing/src/queue.os src/liburing/src/register.ol 
src/liburing/src/register.os
        rm -f src/liburing/src/setup.ol src/liburing/src/setup.os 
src/liburing/src/syscall.ol src/liburing/src/syscall.os
        rm -rf src/pybind/mgr/rook/rook_client/ceph
+       rm -rf $(CURDIR)/build.python3* src/pybind/*/*.egg-info
        rm -rf src/cephadm/.pytest_cache
        find . -type d -iname .deps -exec rm -rf {} \; || true
        find . -type d -iname .libs -exec rm -rf {} \; || true
@@ -309,8 +317,25 @@
        # that appears on slower build hosts where the build happens
        # before the headers are built.
        dh_auto_build --buildsystem=cmake -- legacy-option-headers
+       # cmake builds the cython bindings for $(PY3_DEFAULT) only, so build 
them
+       # for $(PY3_OTHERS) here.
+       set -e ; for binding in rados rbd cephfs rgw ; do \
+               dh_auto_build --buildsystem=cmake -- cython_$$binding ; \
+               for v in $(PY3_OTHERS) ; do \
+                       (cd $(CURDIR)/src/pybind/$$binding && \
+                        CPPFLAGS="$(CPPFLAGS) -iquote$(CURDIR)/src/include 
-D'void0=dead_function(void)' -D'__Pyx_check_single_interpreter(ARG)=ARG##0'" \
+                        LDFLAGS="$(LDFLAGS) -L$(CEPH_LIBDIR)" \
+                        CEPH_LIBDIR="$(CEPH_LIBDIR)" \
+                        CYTHON_BUILD_DIR="$(CURDIR)/build.python$$v" \
+                        python$$v setup.py \
+                               build --build-base $(CURDIR)/build.python$$v \
+                               install --root=$(CURDIR)/build.python$$v/root \
+                                       --install-layout=deb \
+                                       --single-version-externally-managed 
--record /dev/null) ; \
+               done ; \
+       done
        # Start the actual build
-       dh_auto_build --buildsystem=cmake 
+       dh_auto_build --buildsystem=cmake
 
 override_dh_auto_configure:
        env | sort
@@ -325,6 +350,10 @@
 
 override_dh_auto_install:
        dh_auto_install --buildsystem=cmake --destdir=$(DESTDIR)
+       # add the bindings built for $(PY3_OTHERS)
+       set -e ; for v in $(PY3_OTHERS) ; do \
+               cp -a $(CURDIR)/build.python$$v/root/. $(DESTDIR)/ ; \
+       done
        if [ ! -f $(DESTDIR)/usr/bin/ceph-dencoder ]; then \
            cp debian/workarounds/ceph-dencoder-oom 
$(DESTDIR)/usr/bin/ceph-dencoder ;\
        fi
@@ -390,7 +419,7 @@
        install -D -m0644 systemd/[email protected]   
debian/cephfs-mirror/usr/lib/systemd/system/[email protected]
        install -D -m0644 systemd/cephfs-mirror.target     
debian/cephfs-mirror/usr/lib/systemd/system/cephfs-mirror.target
        install -D -m0644 systemd/[email protected]    
debian/radosgw/usr/lib/systemd/system/[email protected]
-       echo "Alias=radosgw.service"                    >> 
debian/radosgw/usr/lib/systemd/system/[email protected]  
+       echo "Alias=radosgw.service"                    >> 
debian/radosgw/usr/lib/systemd/system/[email protected]
        install -D -m0644 systemd/ceph-radosgw.target      
debian/radosgw/usr/lib/systemd/system/ceph-radosgw.target
        install -D -m0644 systemd/[email protected] 
debian/rbd-mirror/usr/lib/systemd/system/[email protected]
        install -D -m0644 systemd/ceph-rbd-mirror.target   
debian/rbd-mirror/usr/lib/systemd/system/ceph-rbd-mirror.target

Reply via email to