-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FTBFS on GCC 14 (boo#1222493) #516
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 <[email protected]> (cherry picked from commit f9aea91)
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 <[email protected]> (cherry picked from commit a49d154)
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 <[email protected]> (cherry picked from commit 0eace4e)
without this change, clang16 fails to compile, due to conversion from "bool" to "int". see error: https://paste.sh/QybPVNdh#OtffZeqJKcsqUVMupPYD11Kl Signed-off-by: yuval Lifshitz <[email protected]> (cherry picked from commit c67fb73)
Without this, the build fails on GCC 14: [ 3456s] /home/abuild/rpmbuild/BUILD/ceph-16.2.15-68-gbb20a17289a/src/rapidjson/include/rapidjson/document.h: In member function ‘rapidjson::GenericStringRef<CharType>& rapidjson::GenericStringRef<CharType>::operator=(const rapidjson::GenericStringRef<CharType>&)’: [ 3456s] /home/abuild/rpmbuild/BUILD/ceph-16.2.15-68-gbb20a17289a/src/rapidjson/include/rapidjson/document.h:319:82: error: assignment of read-only member ‘rapidjson::GenericStringRef<CharType>::length’ [ 3456s] 319 | GenericStringRef& operator=(const GenericStringRef& rhs) { s = rhs.s; length = rhs.length; } [ 3456s] | ~~~~~~~^~~~~~~~~~~~ [ 3456s] make[2]: *** [src/rgw/CMakeFiles/rgw_common.dir/build.make:1774: src/rgw/CMakeFiles/rgw_common.dir/rgw_crypt.cc.o] Error 1 [ 3456s] make[1]: *** [CMakeFiles/Makefile2:8011: src/rgw/CMakeFiles/rgw_common.dir/all] Error 2 The copy assignment operator was disabled in upstream rapidjson a very, very, very long time ago: Tencent/rapidjson@862c39b This method of patching a submodule is pretty heinous, even for me. The alternative would be to fork ceph's (very) old rapidjson to the SUSE org, apply this patch to that fork, and update ceph's .gitmodules file to point to that instead of the ceph one. Signed-off-by: Tim Serong <[email protected]>
tserong
force-pushed
the
wip-ses7p-fix-ftbfs-gcc14
branch
from
April 9, 2024 09:50
55e91c0
to
40d5950
Compare
mgfritch
approved these changes
Apr 9, 2024
bazaah
added a commit
to bazaah/aur-ceph
that referenced
this pull request
May 25, 2024
Backports a few fixes for GCC 14 that some of the upstream's distro builds have encountered. This takes from the SUSE's leap stream, though we had to cut out parts, so it isn't a "real" backport. References: SUSE/ceph#516
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a backport of:
Plus, unexpectedly (see my comments in the commit message):
At the time of writing, test builds are succeeding for openSUSE Leap 15.3, 15.4, and Tumbleweed at https://build.opensuse.org/package/show/home:tserong:branches:filesystems:ceph/ceph.
I've successfully done a local build against gcc 14 by running
osc build --noservice --ccache --vm-type=chroot --disable-debuginfo --clean --alternative-project home:rguenther:nextgcc ceph.spec
.