diff options
author | Patrick Lauer <patrick@gentoo.org> | 2024-07-30 07:49:34 +0000 |
---|---|---|
committer | Patrick Lauer <patrick@gentoo.org> | 2024-07-30 09:05:03 +0000 |
commit | c8481002b920e87cfbffc3ca7908921134d70087 (patch) | |
tree | 84d2b4fc794eaca368797400c8b4c58c2d009899 /sys-cluster | |
parent | gnome-extra/nautilus-dropbox: drop 2020.03.04 (diff) | |
download | gentoo-c8481002b920e87cfbffc3ca7908921134d70087.tar.gz gentoo-c8481002b920e87cfbffc3ca7908921134d70087.tar.bz2 gentoo-c8481002b920e87cfbffc3ca7908921134d70087.zip |
sys-cluster/ceph: Fix build with gcc-14
Bug: https://bugs.gentoo.org/936889
Signed-off-by: Patrick Lauer <patrick@gentoo.org>
Diffstat (limited to 'sys-cluster')
-rw-r--r-- | sys-cluster/ceph/ceph-18.2.1-r3.ebuild | 493 | ||||
-rw-r--r-- | sys-cluster/ceph/files/ceph-18.2.1-gcc14-2.patch | 253 | ||||
-rw-r--r-- | sys-cluster/ceph/files/ceph-18.2.1-gcc14.patch | 141 |
3 files changed, 887 insertions, 0 deletions
diff --git a/sys-cluster/ceph/ceph-18.2.1-r3.ebuild b/sys-cluster/ceph/ceph-18.2.1-r3.ebuild new file mode 100644 index 000000000000..212dd1166fae --- /dev/null +++ b/sys-cluster/ceph/ceph-18.2.1-r3.ebuild @@ -0,0 +1,493 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..12} ) +LUA_COMPAT=( lua5-{3..4} ) + +inherit check-reqs bash-completion-r1 cmake flag-o-matic lua-single \ + python-r1 udev readme.gentoo-r1 toolchain-funcs systemd tmpfiles + +XSIMD_HASH="aeec9c872c8b475dedd7781336710f2dd2666cb2" + +DESCRIPTION="Ceph distributed filesystem" +HOMEPAGE="https://ceph.com/" + +SRC_URI=" + https://download.ceph.com/tarballs/${P}.tar.gz + parquet? ( https://github.com/xtensor-stack/xsimd/archive/${XSIMD_HASH}.tar.gz -> ceph-xsimd-${PV}.tar.gz ) +" + +LICENSE="Apache-2.0 LGPL-2.1 CC-BY-SA-3.0 GPL-2 GPL-2+ LGPL-2+ LGPL-2.1 LGPL-3 GPL-3 BSD Boost-1.0 MIT public-domain" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~ppc64" + +CPU_FLAGS_X86=(avx2 avx512f pclmul sse{,2,3,4_1,4_2} ssse3) + +IUSE=" + babeltrace +cephfs custom-cflags diskprediction dpdk fuse grafana + jemalloc jaeger kafka kerberos ldap lttng +mgr +parquet pmdk rabbitmq + +radosgw rbd-rwl rbd-ssd rdma rgw-lua selinux +ssl spdk +sqlite +system-boost + systemd +tcmalloc test +uring xfs zbd zfs +" + +IUSE+="$(printf "cpu_flags_x86_%s\n" ${CPU_FLAGS_X86[@]})" + +DEPEND=" + ${LUA_DEPS} + ${PYTHON_DEPS} + acct-group/ceph + acct-user/ceph + virtual/libudev:= + app-arch/bzip2:= + app-arch/lz4:= + app-arch/snappy:= + >=app-arch/snappy-1.1.9-r1 + app-arch/zstd:= + app-shells/bash:0 + app-misc/jq:= + dev-cpp/gflags:= + dev-lang/jsonnet:= + dev-libs/libaio:= + dev-libs/libnl:3= + dev-libs/libxml2:= + dev-libs/libevent:= + dev-libs/libutf8proc:= + dev-libs/nss:= + dev-libs/openssl:= + <dev-libs/rocksdb-7.9.3:= + dev-libs/thrift:= + dev-libs/xmlsec:=[openssl] + dev-cpp/yaml-cpp:= + dev-python/natsort[${PYTHON_USEDEP}] + dev-python/pyyaml[${PYTHON_USEDEP}] + net-dns/c-ares:= + net-libs/gnutls:= + sys-auth/oath-toolkit:= + sys-apps/coreutils + sys-apps/hwloc:= + sys-apps/keyutils:= + sys-apps/util-linux:= + sys-libs/libcap-ng:= + sys-libs/ncurses:0= + sys-libs/zlib:= + sys-process/numactl:= + virtual/libcrypt:= + x11-libs/libpciaccess:= + babeltrace? ( dev-util/babeltrace:0/1 ) + fuse? ( sys-fs/fuse:3= ) + jemalloc? ( dev-libs/jemalloc:= ) + !jemalloc? ( >=dev-util/google-perftools-2.6.1:= ) + jaeger? ( + dev-cpp/nlohmann_json:= + dev-cpp/opentelemetry-cpp:=[jaeger] + ) + kafka? ( dev-libs/librdkafka:= ) + kerberos? ( virtual/krb5 ) + ldap? ( net-nds/openldap:= ) + lttng? ( dev-util/lttng-ust:= ) + parquet? ( dev-libs/re2:= ) + pmdk? ( + >=dev-libs/pmdk-1.10.0:= + sys-block/ndctl:= + ) + rabbitmq? ( net-libs/rabbitmq-c:= ) + radosgw? ( + dev-libs/icu:= + dev-libs/expat:= + net-misc/curl:=[curl_ssl_openssl] + ) + rbd-rwl? ( dev-libs/pmdk:= ) + rdma? ( sys-cluster/rdma-core:= ) + spdk? ( dev-util/cunit ) + sqlite? ( dev-db/sqlite:= ) + system-boost? ( dev-libs/boost:=[context,python,${PYTHON_USEDEP},zlib] ) + uring? ( sys-libs/liburing:= ) + xfs? ( sys-fs/xfsprogs:= ) + zbd? ( sys-block/libzbd:= ) + zfs? ( sys-fs/zfs:= ) +" +BDEPEND=" + amd64? ( dev-lang/nasm ) + x86? ( dev-lang/yasm ) + app-alternatives/cpio + dev-debug/valgrind + >=dev-build/cmake-3.5.0 + dev-python/cython[${PYTHON_USEDEP}] + dev-python/setuptools[${PYTHON_USEDEP}] + dev-python/sphinx + dev-util/gperf + dev-util/ragel + sys-apps/coreutils + sys-apps/grep + sys-apps/util-linux + sys-apps/which + app-alternatives/bc + sys-devel/patch + virtual/pkgconfig + jaeger? ( + app-alternatives/yacc + app-alternatives/lex + ) + test? ( + dev-util/cunit + dev-python/coverage[${PYTHON_USEDEP}] + dev-python/virtualenv[${PYTHON_USEDEP}] + dev-python/requests-mock[${PYTHON_USEDEP}] + sys-apps/grep[pcre] + sys-fs/btrfs-progs + ) +" +RDEPEND=" + ${DEPEND} + app-admin/sudo + net-misc/socat + sys-apps/gptfdisk + sys-apps/nvme-cli + >=sys-apps/smartmontools-7.0 + sys-block/parted + sys-fs/cryptsetup + sys-fs/lsscsi + sys-fs/lvm2[lvm] + app-alternatives/awk + dev-python/bcrypt[${PYTHON_USEDEP}] + dev-python/cherrypy[${PYTHON_USEDEP}] + dev-python/python-dateutil[${PYTHON_USEDEP}] + dev-python/flask[${PYTHON_USEDEP}] + dev-python/jinja[${PYTHON_USEDEP}] + dev-python/pecan[${PYTHON_USEDEP}] + dev-python/prettytable[${PYTHON_USEDEP}] + dev-python/pyopenssl[${PYTHON_USEDEP}] + dev-python/requests[${PYTHON_USEDEP}] + dev-python/werkzeug[${PYTHON_USEDEP}] + mgr? ( + dev-python/jsonpatch[${PYTHON_USEDEP}] + dev-python/more-itertools[${PYTHON_USEDEP}] + dev-python/numpy[${PYTHON_USEDEP}] + dev-python/pyjwt[${PYTHON_USEDEP}] + dev-python/routes[${PYTHON_USEDEP}] + diskprediction? ( + >=dev-python/scipy-1.4.0[${PYTHON_USEDEP}] + ) + dev-python/scikit-learn[${PYTHON_USEDEP}] + dev-python/six[${PYTHON_USEDEP}] + ) + selinux? ( sec-policy/selinux-ceph ) +" +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + ${LUA_REQUIRED_USE} + ?? ( jemalloc tcmalloc ) + diskprediction? ( mgr ) + kafka? ( radosgw ) + mgr? ( cephfs ) + rabbitmq? ( radosgw ) + rgw-lua? ( radosgw ) +" + +RESTRICT=" + !test? ( test ) +" + +# tests need root access, and network access +RESTRICT+="test" + +# false positives unless all USE flags are on +CMAKE_WARN_UNUSED_CLI=no + +PATCHES=( + "${FILESDIR}/ceph-12.2.0-use-provided-cpu-flag-values.patch" + "${FILESDIR}/ceph-14.2.0-cflags.patch" + "${FILESDIR}/ceph-12.2.4-boost-build-none-options.patch" + "${FILESDIR}/ceph-17.2.1-no-virtualenvs.patch" + "${FILESDIR}/ceph-13.2.2-dont-install-sysvinit-script.patch" + "${FILESDIR}/ceph-14.2.0-dpdk-cflags.patch" + "${FILESDIR}/ceph-16.2.0-rocksdb-cmake.patch" + "${FILESDIR}/ceph-16.2.0-spdk-tinfo.patch" + "${FILESDIR}/ceph-16.2.0-jaeger-system-boost.patch" + "${FILESDIR}/ceph-16.2.0-liburing.patch" + "${FILESDIR}/ceph-17.2.0-pybind-boost-1.74.patch" + "${FILESDIR}/ceph-17.2.0-findre2.patch" + "${FILESDIR}/ceph-18.2.0-system-opentelemetry.patch" + "${FILESDIR}/ceph-17.2.0-osd_class_dir.patch" + "${FILESDIR}/ceph-17.2.0-gcc12-header.patch" + "${FILESDIR}/ceph-17.2.3-flags.patch" + # https://bugs.gentoo.org/866165 + "${FILESDIR}/ceph-17.2.5-suppress-cmake-warning.patch" + "${FILESDIR}/ceph-17.2.5-gcc13-deux.patch" + "${FILESDIR}/ceph-17.2.5-boost-1.81.patch" + # https://bugs.gentoo.org/901403 + "${FILESDIR}/ceph-17.2.6-link-boost-context.patch" + # https://bugs.gentoo.org/905626 + "${FILESDIR}/ceph-17.2.6-arrow-flatbuffers-c++14.patch" + # https://bugs.gentoo.org/868891 + "${FILESDIR}/ceph-17.2.6-cmake.patch" + "${FILESDIR}/ceph-18.2.0-cyclic-deps.patch" + # https://bugs.gentoo.org/907739 + "${FILESDIR}/ceph-18.2.0-cython3.patch" + # https://bugs.gentoo.org/936889 + "${FILESDIR}/ceph-18.2.1-gcc14.patch" + "${FILESDIR}/ceph-18.2.1-gcc14-2.patch" +) + +check-reqs_export_vars() { + CHECKREQS_DISK_BUILD="6G" + + if use system-boost; then + CHECKREQS_DISK_USR="350M" + else + CHECKREQS_DISK_USR="510M" + fi + + export CHECKREQS_DISK_BUILD CHECKREQS_DISK_USR +} + +pkg_pretend() { + check-reqs_export_vars + check-reqs_pkg_pretend +} + +pkg_setup() { + python_setup + lua_setup + check-reqs_export_vars + check-reqs_pkg_setup +} + +src_prepare() { + cmake_src_prepare + + if use system-boost; then + find "${S}" -name '*.cmake' -or -name 'CMakeLists.txt' -print0 \ + | xargs --null sed -r \ + -e 's|Boost::|boost_|g' \ + -e 's|Boost_|boost_|g' \ + -e 's|[Bb]oost_boost|boost_system|g' \ + -i || die + fi + + if ! use systemd; then + find "${S}"/src/ceph-volume/ceph_volume -name '*.py' -print0 \ + | xargs --null sed \ + -e '/^from ceph_volume.systemd import systemctl/ d' \ + -i || die + fi + + sed -r -e "s:DESTINATION .+\\):DESTINATION $(get_bashcompdir)\\):" \ + -i src/bash_completion/CMakeLists.txt || die + + sed -e "s:objdump -p:$(tc-getOBJDUMP) -p:" -i CMakeLists.txt || die + + # force lua version to use selected version + local lua_version + lua_version=$(ver_cut 1-2 $(lua_get_version)) + sed "s:find_package(Lua [0-9][.][0-9] REQUIRED):find_package(Lua ${lua_version} EXACT REQUIRED):" \ + -i src/CMakeLists.txt + + if use spdk; then + # https://bugs.gentoo.org/871942 + sed -i 's/[#]ifndef HAVE_ARC4RANDOM/#if 0/' src/spdk/lib/iscsi/iscsi.c || die + fi + + # remove tests that need root access + rm src/test/cli/ceph-authtool/cap*.t || die +} + +ceph_src_configure() { + local mycmakeargs=( + -DWITH_BABELTRACE:BOOL=$(usex babeltrace) + -DWITH_BLUESTORE_PMEM:BOOL=$(usex pmdk) + -DWITH_CEPHFS:BOOL=$(usex cephfs) + -DWITH_CEPHFS_SHELL:BOOL=$(usex cephfs) + -DWITH_DPDK:BOOL=$(usex dpdk) + -DWITH_SPDK:BOOL=$(usex spdk) + -DWITH_FUSE:BOOL=$(usex fuse) + -DWITH_LTTNG:BOOL=$(usex lttng) + -DWITH_GSSAPI:BOOL=$(usex kerberos) + -DWITH_GRAFANA:BOOL=$(usex grafana) + -DWITH_MGR:BOOL=$(usex mgr) + -DWITH_MGR_DASHBOARD_FRONTEND:BOOL=OFF + -DWITH_OPENLDAP:BOOL=$(usex ldap) + -DWITH_PYTHON3:STRING=3 + -DWITH_RADOSGW:BOOL=$(usex radosgw) + -DWITH_RADOSGW_AMQP_ENDPOINT:BOOL=$(usex rabbitmq) + -DWITH_RADOSGW_KAFKA_ENDPOINT:BOOL=$(usex kafka) + -DWITH_RADOSGW_LUA_PACKAGES:BOOL=$(usex rgw-lua "$(usex radosgw)" "NO") + -DWITH_RBD_RWL:BOOL=$(usex rbd-rwl) + -DWITH_RBD_SSD_CACHE:BOOL=$(usex rbd-ssd) + -DWITH_SYSTEMD:BOOL=$(usex systemd) + -DWITH_TESTS:BOOL=$(usex test) + -DWITH_LIBURING:BOOL=$(usex uring) + -DWITH_SYSTEM_LIBURING:BOOL=$(usex uring) + -DWITH_LIBCEPHSQLITE:BOOL=$(usex sqlite) + -DWITH_XFS:BOOL=$(usex xfs) + -DWITH_ZBD:BOOL=$(usex zbd) + -DWITH_ZFS:BOOL=$(usex zfs) + -DENABLE_SHARED:BOOL=ON + -DALLOCATOR:STRING=$(usex tcmalloc 'tcmalloc' "$(usex jemalloc 'jemalloc' 'libc')") + -DWITH_SYSTEM_PMDK:BOOL=$(usex pmdk 'YES' "$(usex rbd-rwl '')") + -DWITH_SYSTEM_BOOST:BOOL=$(usex system-boost) + -DWITH_SYSTEM_ROCKSDB:BOOL=ON + -DWITH_SYSTEM_ZSTD:BOOL=ON + -DWITH_RDMA:BOOL=$(usex rdma) + -DCMAKE_INSTALL_DOCDIR:PATH="${EPREFIX}/usr/share/doc/${PN}-${PVR}" + -DCMAKE_INSTALL_SYSCONFDIR:PATH="${EPREFIX}/etc" + # use the bundled libfmt for now since they seem to constantly break their API + -DCMAKE_DISABLE_FIND_PACKAGE_fmt=ON + -Wno-dev + ) + + # this breaks when re-configuring for python impl + if [[ ${EBUILD_PHASE} == configure ]]; then + mycmakeargs+=( + -DWITH_JAEGER:BOOL=$(usex jaeger) + -DWITH_RADOSGW_SELECT_PARQUET:BOOL=$(usex parquet) + ) + else + mycmakeargs+=( + -DWITH_RADOSGW_SELECT_PARQUET:BOOL=OFF + -DWITH_JAEGER:BOOL=OFF + # don't want to warn about unused CLI when reconfiguring for python + -DCMAKE_WARN_UNUSED_CLI:BOOL=OFF + ) + fi + + # conditionally used cmake args + use test && mycmakearts+=( -DWITH_SYSTEM_GTEST:BOOL=$(usex test) ) + use systemd && mycmakeargs+=( -DSYSTEMD_SYSTEM_UNIT_DIR:PATH=$(systemd_get_systemunitdir) ) + + if use amd64 || use x86; then + local flag + for flag in "${CPU_FLAGS_X86[@]}"; do + case "${flag}" in + avx*) + local var=${flag%f} + mycmakeargs+=( + "-DHAVE_NASM_X64_${var^^}:BOOL=$(usex cpu_flags_x86_${flag})" + ) + ;; + *) mycmakeargs+=( + "-DHAVE_INTEL_${flag^^}:BOOL=$(usex cpu_flags_x86_${flag})" + );; + esac + done + fi + + # needed for >=glibc-2.32 + has_version '>=sys-libs/glibc-2.32' && mycmakeargs+=( -DWITH_REENTRANT_STRSIGNAL:BOOL=ON ) + + rm -f "${BUILD_DIR:-${S}}/CMakeCache.txt" \ + || die "failed to remove cmake cache" + + # hopefully this will not be necessary in the next release + use parquet && export ARROW_XSIMD_URL="file:///${DISTDIR}/ceph-xsimd-${PV}.tar.gz" + + # https://bugs.gentoo.org/927066 + filter-lto + + cmake_src_configure + + # bug #630232 + sed -i "s:\"${T//:\\:}/${EPYTHON}/bin/python\":\"${PYTHON}\":" \ + "${BUILD_DIR:-${S}}"/include/acconfig.h \ + || die "sed failed" +} + +src_configure() { + use custom-cflags || strip-flags + ceph_src_configure +} + +src_compile() { + cmake_build all + + # we have to do this here to prevent from building everything multiple times + python_copy_sources + python_foreach_impl python_compile +} + +python_compile() { + local CMAKE_USE_DIR="${S}" + ceph_src_configure + + cmake_build src/pybind/CMakeFiles/cython_modules + cmake_build cephadm +} + +src_install() { + python_foreach_impl python_install + + python_setup + cmake_src_install + + python_optimize + + find "${ED}" -name '*.la' -type f -delete || die + + exeinto /usr/$(get_libdir)/ceph + newexe "${BUILD_DIR}/bin/init-ceph" init-ceph + + insinto /etc/logrotate.d/ + newins "${FILESDIR}"/ceph.logrotate-r2 ${PN} + + keepdir /var/lib/${PN}{,/tmp} /var/log/ceph/stat /var/log/ceph/console + + fowners -R ceph:ceph /var/log/ceph + + newinitd "${FILESDIR}/rbdmap.initd-r1" rbdmap + newinitd "${FILESDIR}/${PN}.initd-r14" ${PN} + newconfd "${FILESDIR}/${PN}.confd-r5" ${PN} + + insinto /etc/sudoers.d + doins sudoers.d/* + + insinto /etc/sysctl.d + newins "${FILESDIR}"/sysctld 90-${PN}.conf + + use tcmalloc && newenvd "${FILESDIR}"/envd-tcmalloc 99${PN}-tcmalloc + + # units aren't installed by the build system unless systemd is enabled + # so no point installing these with the USE flag disabled + if use systemd; then + systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" "ceph-mds@.service" + systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" "ceph-osd@.service" + fi + + udev_dorules udev/*.rules + newtmpfiles "${FILESDIR}"/ceph-tmpfilesd ${PN}.conf + + readme.gentoo_create_doc + + # bug #630232 + sed -i -r "s:${T//:/\\:}/${EPYTHON}:/usr:" "${ED}"/usr/bin/ceph{,-crash} \ + || die "sed failed" + + python_fix_shebang "${ED}"/usr/{,s}bin/ + + # python_fix_shebang apparently is not idempotent + local shebang_regex='(/usr/lib/python-exec/python[0-9]\.[0-9]/python)[0-9]\.[0-9]' + grep -r -E -l --null "${shebang_regex}" "${ED}"/usr/{s,}bin/ \ + | xargs --null --no-run-if-empty -- sed -i -r "s:${shebang_regex}:\1:" || die + + local -a rados_classes=( "${ED}/usr/$(get_libdir)/rados-classes"/* ) + dostrip -x "${rados_classes[@]#${ED}}" +} + +python_install() { + local CMAKE_USE_DIR="${S}" + DESTDIR="${ED}" cmake_build src/pybind/install + DESTDIR="${ED}" cmake_build src/cephadm/install + + python_optimize +} + +pkg_postinst() { + readme.gentoo_print_elog + tmpfiles_process ${PN}.conf + udev_reload +} + +pkg_postrm() { + udev_reload +} diff --git a/sys-cluster/ceph/files/ceph-18.2.1-gcc14-2.patch b/sys-cluster/ceph/files/ceph-18.2.1-gcc14-2.patch new file mode 100644 index 000000000000..334de92fec08 --- /dev/null +++ b/sys-cluster/ceph/files/ceph-18.2.1-gcc14-2.patch @@ -0,0 +1,253 @@ +From f9aea9105b6c1a8d7bff0ec0675f84f2ffb1db6f Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Wed, 20 Dec 2023 14:16:19 +0100 +Subject: [PATCH 1/2] tracing: Fix C type errors in librados tracing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes type errors like this: + +In file included from /usr/include/lttng/tracepoint-event.h:69, + from …-build/include/tracing/librados.h:4143, + from …/src/tracing/librados.c:6 +: +…-build/include/tracing/librados.h: + In function ‘lttng_ust__event_probe__librados___rados_mon_command_exit’: +…-build/include/tracing/librados.h:477:9: error: initialization of ‘size_t’ {aka ‘long unsigned int’} from ‘size_t *’ {aka ‘long unsigned int *’} makes integer from pointer without a cast + 477 | ceph_ctf_integerp(size_t, outslen, outslen) + | ^~~~~~~~~~~~~~~~~ + +GCC 14 will likely treat these type mismatches as an error +and fail the build. + +Signed-off-by: Florian Weimer <fweimer@redhat.com> +--- + src/tracing/librados.tp | 4 ++-- + src/tracing/tracing-common.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/tracing/librados.tp b/src/tracing/librados.tp +index 8b5e78ef15d65..8e116124b83d5 100644 +--- a/src/tracing/librados.tp ++++ b/src/tracing/librados.tp +@@ -2628,7 +2628,7 @@ TRACEPOINT_EVENT(librados, rados_watch3_enter, + TP_FIELDS( + ctf_integer_hex(rados_ioctx_t, ioctx, ioctx) + ctf_string(oid, oid) +- ctf_integer_hex(uint64_t, phandle, phandle) ++ ctf_integer_hex(uint64_t*, phandle, phandle) + ctf_integer_hex(rados_watchcb2_t, callback, callback) + ctf_integer(uint32_t, timeout, timeout) + ctf_integer_hex(void*, arg, arg) +@@ -2658,7 +2658,7 @@ TRACEPOINT_EVENT(librados, rados_aio_watch2_enter, + ctf_integer_hex(rados_ioctx_t, ioctx, ioctx) + ctf_string(oid, oid) + ctf_integer_hex(rados_completion_t, completion, completion) +- ctf_integer_hex(uint64_t, phandle, phandle) ++ ctf_integer_hex(uint64_t*, phandle, phandle) + ctf_integer_hex(rados_watchcb2_t, callback, callback) + ctf_integer(uint32_t, timeout, timeout) + ctf_integer_hex(void*, arg, arg) +diff --git a/src/tracing/tracing-common.h b/src/tracing/tracing-common.h +index 3e07f9de8e85c..03449ab588615 100644 +--- a/src/tracing/tracing-common.h ++++ b/src/tracing/tracing-common.h +@@ -21,7 +21,7 @@ + // type should be an integer type + // val should have type type* + #define ceph_ctf_integerp(type, field, val) \ +- ctf_integer(type, field, (val) == NULL ? 0 : (val)) \ ++ ctf_integer(type, field, (val) == NULL ? 0 : *(val)) \ + ctf_integer(uint8_t, field##_isnull, (val) == NULL) + + // val should have type char* + +From a49d154f4a8e493baf2296a15c7b5c56cd25e993 Mon Sep 17 00:00:00 2001 +From: Florian Weimer <fweimer@redhat.com> +Date: Wed, 20 Dec 2023 14:59:19 +0100 +Subject: [PATCH 2/2] pybind: Fix C type errors in Cython-generated Python + bindings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Several Ceph APIs use bool * types, which correspond to +libcpp.bool * types in Cython. The bint type has an incorrect +size 4 and cannot be used as a replacement. + +This prevents a compilation failure with future compilers: + +…-build/src/pybind/rbd/rbd.c: In function ‘__pyx_pf_3rbd_3RBD_104namespace_exists’: +…-build/src/pybind/rbd/rbd.c:42165:76: error: passing argument 3 of ‘rbd_namespace_exists’ from incompatible pointer type +42165 | __pyx_v_ret = rbd_namespace_exists(__pyx_v__ioctx, __pyx_v__name, (&__pyx_v__exists)); + | ~^~~~~~~~~~~~~~~~~ + | | + | int * +In file included from …-build/src/pybind/rbd/rbd.c:1268: +…/src/include/rbd/librbd.h:1496:45: note: expected ‘_Bool *’ but argument is of type ‘int *’ + 1496 | bool *exists); + | ^ + +Signed-off-by: Florian Weimer <fweimer@redhat.com> +--- + src/pybind/rbd/c_rbd.pxd | 5 +++-- + src/pybind/rbd/mock_rbd.pxi | 9 +++++++-- + src/pybind/rbd/rbd.pyx | 9 +++++---- + src/pybind/rgw/mock_rgw.pxi | 9 +++++++-- + src/pybind/rgw/rgw.pyx | 3 ++- + 5 files changed, 24 insertions(+), 11 deletions(-) + +diff --git a/src/pybind/rbd/c_rbd.pxd b/src/pybind/rbd/c_rbd.pxd +index 885f7bd46abde..bda23bbc4735f 100644 +--- a/src/pybind/rbd/c_rbd.pxd ++++ b/src/pybind/rbd/c_rbd.pxd +@@ -2,6 +2,7 @@ + + from libc.stdint cimport * + from ctime cimport time_t, timespec ++cimport libcpp + + cdef extern from "rados/librados.h": + enum: +@@ -525,7 +526,7 @@ cdef extern from "rbd/librbd.h" nogil: + int rbd_snap_unprotect(rbd_image_t image, const char *snap_name) + int rbd_snap_is_protected(rbd_image_t image, const char *snap_name, + int *is_protected) +- int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists) ++ int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists) + int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit) + int rbd_snap_set_limit(rbd_image_t image, uint64_t limit) + int rbd_snap_get_timestamp(rbd_image_t image, uint64_t snap_id, timespec *timestamp) +@@ -711,7 +712,7 @@ cdef extern from "rbd/librbd.h" nogil: + int rbd_namespace_list(rados_ioctx_t io, char *namespace_names, + size_t *size) + int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name, +- bint *exists) ++ libcpp.bool *exists) + + int rbd_pool_init(rados_ioctx_t, bint force) + +diff --git a/src/pybind/rbd/mock_rbd.pxi b/src/pybind/rbd/mock_rbd.pxi +index 11872bd8146de..364f965fbad43 100644 +--- a/src/pybind/rbd/mock_rbd.pxi ++++ b/src/pybind/rbd/mock_rbd.pxi +@@ -3,6 +3,11 @@ + from libc.stdint cimport * + from ctime cimport time_t, timespec + ++# Make the bool type available as libcpp.bool, for both C and C++. ++cimport libcpp ++cdef extern from "<stdbool.h>": ++ pass ++ + cdef nogil: + enum: + _LIBRADOS_SNAP_HEAD "LIBRADOS_SNAP_HEAD" +@@ -637,7 +642,7 @@ cdef nogil: + int rbd_snap_is_protected(rbd_image_t image, const char *snap_name, + int *is_protected): + pass +- int rbd_snap_exists(rbd_image_t image, const char *snapname, bint *exists): ++ int rbd_snap_exists(rbd_image_t image, const char *snapname, libcpp.bool *exists): + pass + int rbd_snap_get_limit(rbd_image_t image, uint64_t *limit): + pass +@@ -896,7 +901,7 @@ cdef nogil: + size_t *size): + pass + int rbd_namespace_exists(rados_ioctx_t io, const char *namespace_name, +- bint *exists): ++ libcpp.bool *exists): + pass + int rbd_pool_init(rados_ioctx_t io, bint force): + pass +diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx +index fcb2fb3470600..f59ba23f0fe21 100644 +--- a/src/pybind/rbd/rbd.pyx ++++ b/src/pybind/rbd/rbd.pyx +@@ -23,6 +23,7 @@ from libc cimport errno + from libc.stdint cimport * + from libc.stdlib cimport malloc, realloc, free + from libc.string cimport strdup, memset ++cimport libcpp + + try: + from collections.abc import Iterable +@@ -1935,12 +1936,12 @@ class RBD(object): + cdef: + rados_ioctx_t _ioctx = convert_ioctx(ioctx) + const char *_name = name +- bint _exists = False ++ libcpp.bool _exists = False + with nogil: + ret = rbd_namespace_exists(_ioctx, _name, &_exists) + if ret != 0: + raise make_ex(ret, 'error verifying namespace') +- return bool(_exists != 0) ++ return _exists + + def namespace_list(self, ioctx): + """ +@@ -3679,12 +3680,12 @@ cdef class Image(object): + name = cstr(name, 'name') + cdef: + char *_name = name +- bint _exists = False ++ libcpp.bool _exists = False + with nogil: + ret = rbd_snap_exists(self.image, _name, &_exists) + if ret != 0: + raise make_ex(ret, 'error getting snapshot exists for %s' % self.name) +- return bool(_exists != 0) ++ return _exists + + @requires_not_closed + def get_snap_limit(self): +diff --git a/src/pybind/rgw/mock_rgw.pxi b/src/pybind/rgw/mock_rgw.pxi +index ca893a5bb8a16..806d4df75de05 100644 +--- a/src/pybind/rgw/mock_rgw.pxi ++++ b/src/pybind/rgw/mock_rgw.pxi +@@ -1,5 +1,10 @@ + # cython: embedsignature=True + ++# Make the bool type available as libcpp.bool, for both C and C++. ++cimport libcpp ++cdef extern from "<stdbool.h>": ++ pass ++ + cdef nogil: + ctypedef void* librgw_t + +@@ -111,8 +116,8 @@ cdef nogil: + + int rgw_readdir(rgw_fs *fs, + rgw_file_handle *parent_fh, uint64_t *offset, +- bint (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000, +- void *cb_arg, bint *eof, uint32_t flags) except? -9000: ++ libcpp.bool (*cb)(const char *name, void *arg, uint64_t offset, stat *st, uint32_t st_mask, uint32_t flags) nogil except? -9000, ++ void *cb_arg, libcpp.bool *eof, uint32_t flags) except? -9000: + pass + + int rgw_getattr(rgw_fs *fs, +diff --git a/src/pybind/rgw/rgw.pyx b/src/pybind/rgw/rgw.pyx +index 9bbcdfff586a8..d210a70bbb8e3 100644 +--- a/src/pybind/rgw/rgw.pyx ++++ b/src/pybind/rgw/rgw.pyx +@@ -7,6 +7,7 @@ from cpython cimport PyObject, ref, exc, array + from libc.stdint cimport * + from libc.stdlib cimport malloc, realloc, free + from cstat cimport stat ++cimport libcpp + + IF BUILD_DOC: + include "mock_rgw.pxi" +@@ -373,7 +374,7 @@ cdef class LibRGWFS(object): + cdef: + rgw_file_handle *_dir_handler = <rgw_file_handle*>dir_handler.handler + uint64_t _offset = offset +- bint _eof ++ libcpp.bool _eof + uint32_t _flags = flags + with nogil: + ret = rgw_readdir(self.fs, _dir_handler, &_offset, &readdir_cb, diff --git a/sys-cluster/ceph/files/ceph-18.2.1-gcc14.patch b/sys-cluster/ceph/files/ceph-18.2.1-gcc14.patch new file mode 100644 index 000000000000..129f50e2857b --- /dev/null +++ b/sys-cluster/ceph/files/ceph-18.2.1-gcc14.patch @@ -0,0 +1,141 @@ +From 0eace4ea9ea42412d4d6a16d24a8660642e41173 Mon Sep 17 00:00:00 2001 +From: Radoslaw Zarzynski <rzarzyns@redhat.com> +Date: Wed, 24 Jan 2024 17:22:44 +0000 +Subject: [PATCH] common/dout: fix FTBFS on GCC 14 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The following problem has been reported by Kaleb Keithley: + +``` +/builddir/build/BUILD/ceph-18.2.1/src/osd/osd_types.h: In lambda function: +/builddir/build/BUILD/ceph-18.2.1/src/common/dout.h:184:73: error: call to non-‘constexpr’ function ‘virtual unsigned int DoutPrefixProvider::get_subsys() const’ + 184 | dout_impl(pdpp->get_cct(), ceph::dout::need_dynamic(pdpp->get_subsys()), v) \ + | ~~~~~~~~~~~~~~~~^~ +/builddir/build/BUILD/ceph-18.2.1/src/common/dout.h:155:58: note: in definition of macro ‘dout_impl’ + 155 | return (cctX->_conf->subsys.template should_gather<sub, v>()); \ + | ^~~ +/builddir/build/BUILD/ceph-18.2.1/src/osd/osd_types.h:3617:3: note: in expansion of macro ‘ldpp_dout’ + 3617 | ldpp_dout(dpp, 10) << "build_prior all_probe " << all_probe << dendl; + | ^~~~~~~~~ +``` + +For details of the problem and the idea behind the fix, +please refer to the comment this commit brings to `dout.h`. + +The minimized replicator that the facilitated Goldbot-based +investigation: + +```cpp +namespace ceph::dout { + +template<typename T> +struct dynamic_marker_t { + T value; + // constexpr ctor isn't needed as it's an aggregate type + constexpr operator T() const { return value; } +}; + +template<typename T> +constexpr dynamic_marker_t<T> need_dynamic(T&& t) { + return dynamic_marker_t<T>{ std::forward<T>(t) }; +} + +template<typename T> +struct is_dynamic : public std::false_type {}; + +template<typename T> +struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {}; + +} // ceph::dout + +struct subsys_t { + template <unsigned SubV, int LvlV> + bool should_gather() const { + return true; + } + bool should_gather(const unsigned sub, int level) const { + return false; + } +}; + +static subsys_t subsys; + + do { \ + const bool should_gather = [&](const auto cctX) { \ + if constexpr (ceph::dout::is_dynamic<decltype(sub)>::value || \ + ceph::dout::is_dynamic<decltype(v)>::value) { \ + std::cout << "the dynamic path" << std::endl; \ + return subsys.should_gather(sub, v); \ + } else { \ + /* The parentheses are **essential** because commas in angle \ + * brackets are NOT ignored on macro expansion! A language's \ + * limitation, sorry. */ \ + std::cout << "the static path" << std::endl; \ + /*return subsys.should_gather(sub, v);*/ \ + return (subsys.template should_gather<sub, v>()); \ + } \ + }(cct); \ + } while (0) + + if (decltype(auto) pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for 'this' */ \ + dout_impl(42, sub, v) + + if (decltype(auto) pdpp = (dpp); pdpp) /* workaround -Wnonnull-compare for 'this' */ \ + dout_impl(42, ceph::dout::need_dynamic(42), v) + +int main() { + std::random_device dev; + std::mt19937 rng(dev()); + std::uniform_int_distribution<std::mt19937::result_type> dist6(1,6); // distribution in range [1, 6] + + int sub = dist6(rng); + ldpp_dout("mocked out", sub); + //ldpp_subdout("mocked out", 4, 3); +} +``` + +Fixes: https://tracker.ceph.com/issues/64050 +Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com> +--- + src/common/dout.h | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/src/common/dout.h b/src/common/dout.h +index 4cd60efff8fef..6516060c5438e 100644 +--- a/src/common/dout.h ++++ b/src/common/dout.h +@@ -144,17 +144,27 @@ struct is_dynamic<dynamic_marker_t<T>> : public std::true_type {}; + #else + #define dout_impl(cct, sub, v) \ + do { \ +- const bool should_gather = [&](const auto cctX) { \ +- if constexpr (ceph::dout::is_dynamic<decltype(sub)>::value || \ +- ceph::dout::is_dynamic<decltype(v)>::value) { \ ++ const bool should_gather = [&](const auto cctX, auto sub_, auto v_) { \ ++ /* The check is performed on `sub_` and `v_` to leverage the C++'s \ ++ * guarantee on _discarding_ one of blocks of `if constexpr`, which \ ++ * includes also the checks for ill-formed code (`should_gather<>` \ ++ * must not be feed with non-const expresions), BUT ONLY within \ ++ * a template (thus the generic lambda) and under the restriction \ ++ * it's dependant on a parameter of this template). \ ++ * GCC prior to v14 was not enforcing these restrictions. */ \ ++ if constexpr (ceph::dout::is_dynamic<decltype(sub_)>::value || \ ++ ceph::dout::is_dynamic<decltype(v_)>::value) { \ + return cctX->_conf->subsys.should_gather(sub, v); \ + } else { \ ++ constexpr auto sub_helper = static_cast<decltype(sub_)>(sub); \ ++ constexpr auto v_helper = static_cast<decltype(v_)>(v); \ + /* The parentheses are **essential** because commas in angle \ + * brackets are NOT ignored on macro expansion! A language's \ + * limitation, sorry. */ \ +- return (cctX->_conf->subsys.template should_gather<sub, v>()); \ ++ return (cctX->_conf->subsys.template should_gather<sub_helper, \ ++ v_helper>()); \ + } \ +- }(cct); \ ++ }(cct, sub, v); \ + \ + if (should_gather) { \ + ceph::logging::MutableEntry _dout_e(v, sub); \ |