]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
cmake: fix undefined PY_LDFLAGS in distutils_install_cython_module 67037/head
authorKefu Chai <k.chai@proxmox.com>
Thu, 22 Jan 2026 03:57:37 +0000 (11:57 +0800)
committerKefu Chai <k.chai@proxmox.com>
Thu, 22 Jan 2026 05:50:22 +0000 (13:50 +0800)
commitfadc2b1cc2676a21c255c915892b411fcf76de19
tree353225e1e115b98d55b0701fb1edbc7915b9e267
parent8637e0242cb2fda6363b6bb2097279d02ec429ef
cmake: fix undefined PY_LDFLAGS in distutils_install_cython_module

The distutils_install_cython_module() function was using ${PY_LDFLAGS}
without defining it, causing the linker to fail with:

  /opt/rh/gcc-toolset-13/root/usr/libexec/gcc/x86_64-redhat-linux/13/ld:
  cannot find -lrados: No such file or directory

This bug was introduced in commit d22734f6cb0 which changed:
  set(ENV{LDFLAGS} "-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
to:
  set(ENV{LDFLAGS} "${PY_LDFLAGS}")

However, PY_LDFLAGS was only defined in distutils_add_cython_module(),
not in distutils_install_cython_module(). This meant that during the
install phase, LDFLAGS was set to an empty string, and the linker
couldn't find librados.so and other Ceph libraries in the build
directory.

The bug was exposed by commit 719b74984605b490f23004eb41583a22c934c5fb
which changed rados.pxd to use C preprocessor conditionals (#ifdef
BUILD_DOC) instead of Cython's compile-time IF statements. This meant
the build now required proper linking during the install phase.

Fix by defining PY_LDFLAGS in distutils_install_cython_module():

  set(PY_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")

This keeps CMAKE_SHARED_LINKER_FLAGS as a space-separated string and
appends the library directory flag, avoiding issues with semicolon
conversion.

Fixes: d22734f6cb0
Signed-off-by: Kefu Chai <k.chai@proxmox.com>
cmake/modules/Distutils.cmake