Bug 2336567
Summary: | dnf5 failed to build with GCC 15 (" #warning "<cstdbool> is deprecated in C++17, remove the #include" [-Werror=cpp]" via ruby.h) | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Dave Malcolm <dmalcolm> |
Component: | ruby | Assignee: | Jarek Prokop <jprokop> |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | medium | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | jaruga, jkolarik, jprokop, jwakely, mtasaka, nsella, pkratoch, ppisar, pvalena, rpm-software-management, ruby-packagers-sig, vondruch |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | ruby-3.4.1-22.fc42 | Doc Type: | If docs needed, set a value |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2025-01-27 12:05:20 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 2333037, 2340083 |
Description
Dave Malcolm
2025-01-09 15:46:46 UTC
Looks like anything that includes ruby.h will get this warning; I wonder if it's new with GCC 15? Jonathan: did something change in the C++ stdlib that might have triggered this as a new warning? Yes, it's new in GCC 15. <cstdbool> is the C++-only version of C <stdbool.h> which is completely pointless in C++ because bool/true/false are always defined as keywords in C++. Including <cstdbool> in C++ code is useless and should be removed from any code silly enough to do it. https://github.com/ruby/ruby/blob/5fab31b15e32622c4b71d1d347a41937e9f9c212/include/ruby/internal/stdbool.h#L28-L32 This is just silly. It should just include <stdbool.h> and be done with it. Or remove this entire file and stop trying to bodge stdbool for pre-C99 systems. dnf5 builds with -Werror which is the work of the devil. The package maintainers should remove that, or deal with failures like this themselves. # rpm -qf /usr/include/ruby/internal/stdbool.h ruby-devel-3.4.1-19.fc42.x86_64 Moving to ruby component to remove the pointless and deprecated inclusion of <cstdbool>. To reproduce currently Required packages: ruby-devel g++ >= 15.0.0 I couldn't find g++ 15 anywhere reasonably, so I just borrowed the repo used in the copr and in a Fedora Rawhide container executed: ~~~ # echo "[gcc_15] name=pre-release GCC 15 Repo baseurl=https://fedorapeople.org/~dmalcolm/gcc/gcc-15-mass-prebuild/$basearch type=rpm-md skip_if_unavailable=True gpgcheck=0 repo_gpgcheck=0 enabled=1 enabled_metadata=1" > /etc/yum.repos.d/gcc_15.repo ~~~ With the repo added ~~~ # dnf install --assumeyes g++ ruby-devel ~~~ Minimal file required to trigger this: ~~~ $ cat main.cpp #include <ruby.h> int main(void) { return 0; } ~~~ Then just compile it to get the warning with GCC 15 installed: ~~~ # g++ main.cpp In file included from /usr/include/ruby/internal/stdbool.h:30, from /usr/include/ruby/backward/2/bool.h:22, from /usr/include/ruby/defines.h:74, from /usr/include/ruby/ruby.h:25, from /usr/include/ruby.h:38, from reproducer.cpp:1: /usr/include/c++/15/cstdbool:48:6: warning: #warning "<cstdbool> is deprecated in C++17, remove the #include" [-Wcpp] 48 | # warning "<cstdbool> is deprecated in C++17, remove the #include" | ^~~~~~~ ~~~ You can also add `-Werror` to fail the compilation intentionally when the warning is present and receive a non-zero status in that case. Jarek reported this issue on the upstream Ruby on the Ruby bug ticket.[1] Then it seems it was fixed on the upstream Ruby master branch by this commit.[2] Thanks! [1] https://bugs.ruby-lang.org/issues/21024 [2] https://github.com/ruby/ruby/commit/1b3037081ef9fc121b83e213d997a069acd5904b (In reply to Jun Aruga from comment #7) > Jarek reported this issue on the upstream Ruby on the Ruby bug ticket.[1] > Then it seems it was fixed on the upstream Ruby master branch by this > commit.[2] That's great, thanks. > Thanks! > > [1] https://bugs.ruby-lang.org/issues/21024 A comment there says "That patch will break C++-11 and C++-14." -- how? I think that's wrong, so I commented on the PR. > A comment there says "That patch will break C++-11 and C++-14." -- how? I > think that's wrong, so I commented on the PR. As I commented as the upstream PR [1],I think the "That patch" in the comment doesn't mean the upstream PR, but means the `0001-Stop-including-cstdbool-in-include-ruby-internal-std.patch` attached by Jarek on the above Ruby bug ticket. The patch file is deleting the part of the `include <cstdbool>`. So, the "That patch (0001-Stop-including-cstdbool-in-include-ruby-internal-std.patch file) will break C++-11 and C++-14." means sense to me. [1] https://github.com/ruby/ruby/pull/12551/commits/1b3037081ef9fc121b83e213d997a069acd5904b#r1913540808 No, it doesn't make sense. #include <cstdbool> is useless in all versions of C++, so the include can be removed for all versions. It won't break anything. I'd say removing it in previous Ruby versions is a nice-to-have, but I took the liberty to request/do backport upstream for Ruby 3.4 and port the patch downstream to Fedora Rawhide where GCC is now version 15. I might have selfish motivation of wanting to have all-green CI on my libdnf5 github PR :). FEDORA-2025-2d1d8ca6d0 (ruby-3.4.1-22.fc42) has been submitted as an update to Fedora 42. https://bodhi.fedoraproject.org/updates/FEDORA-2025-2d1d8ca6d0 FEDORA-2025-2d1d8ca6d0 (ruby-3.4.1-22.fc42) has been pushed to the Fedora 42 stable repository. If problem still persists, please make note of it in this bug report. Thanks. I confirm it fixes the problem for DNF5. |