Bug 2259394
| Summary: | GCC 14 fails to build magpie-wlr by not being able to find members of std namespace | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Neal Gompa <ngompa13> |
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | dmalcolm, fweimer, jakub, jlaw, joshua, jwakely, mcermak, mpolacek, msebor, nickc, nixuser, serebit, sipoyare |
| Target Milestone: | --- | Keywords: | Regression |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Linux | ||
| URL: | https://github.com/BuddiesOfBudgie/magpie/actions/runs/7599200565/job/20695966857 | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2024-01-21 11:31:53 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: | |||
|
Description
Neal Gompa
2024-01-21 05:54:43 UTC
My guess is that <stdlib.h> is no longer included before #define namespace _namespace in src/wlr-wrap-start.hpp, and is now implicitly included when that “namespace” macro definition is active. Since <stdlib.h> The workaround is to include <stdlib.h> before defining “namespace”: diff --git a/src/wlr-wrap-start.hpp b/src/wlr-wrap-start.hpp index 0ef0297..afd17b8 100644 --- a/src/wlr-wrap-start.hpp +++ b/src/wlr-wrap-start.hpp @@ -5,6 +5,7 @@ static_assert(0 == 1, "wlroots include wrap started and not ended"); #define WLROOTS_INCLUDE_WRAP_STARTED #include <pthread.h> +#include <stdlib.h> #include <wayland-server-core.h> #ifdef __clang__ (In reply to Neal Gompa from comment #0) > In upstream Budgie magpie v1 (Wayland compositor) development, the latest > commits fail on Fedora Rawhide with some baffling errors about every method > of the std namespace missing. I don't think so. The first error is: ../src/server.cpp: In member function ‘void Server::focus_view(View*, wlr_surface*)’: ../src/server.cpp:64:39: error: cannot convert ‘std::__cxx11::list<View*>::iterator’ to ‘const char*’ 64 | (void) std::remove(views.begin(), views.end(), view); | ~~~~~~~~~~~^~ | | | std::__cxx11::list<View*>::iterator This happens when the std::remove algorithm from the <algorithm> header is not visible, but the std::remove(const char*) function from <cstdio> is declared. The problem is 100% guaranteed to be that <algorithm> was not included. See https://gcc.gnu.org/gcc-14/porting_to.html#header-dep-changes The second error is: In file included from ../src/xwayland.hpp:9, from ../src/xwayland.cpp:1: ../src/wlr-wrap-start.hpp:16:19: error: ‘_namespace’ does not name a type 16 | #define namespace _namespace | ^~~~~~~~~~ I have no idea what this is trying to do, but it's undefined behaviour to define a macro with the same name as a keyword. This code is bad and should feel bad. (In reply to Jonathan Wakely from comment #2) > (In reply to Neal Gompa from comment #0) > > In upstream Budgie magpie v1 (Wayland compositor) development, the latest > > commits fail on Fedora Rawhide with some baffling errors about every method > > of the std namespace missing. > > I don't think so. > > The first error is: > > > ../src/server.cpp: In member function ‘void Server::focus_view(View*, > wlr_surface*)’: > ../src/server.cpp:64:39: error: cannot convert > ‘std::__cxx11::list<View*>::iterator’ to ‘const char*’ > 64 | (void) std::remove(views.begin(), views.end(), view); > | ~~~~~~~~~~~^~ > | | > | > std::__cxx11::list<View*>::iterator > > > This happens when the std::remove algorithm from the <algorithm> header is > not visible, but the std::remove(const char*) function from <cstdio> is > declared. The problem is 100% guaranteed to be that <algorithm> was not > included. See https://gcc.gnu.org/gcc-14/porting_to.html#header-dep-changes You're correct, that error was caused by <algorithm> not being included. GCC 13 compiled that code just fine with <utility>, but I checked soon after this ticket was created and realized the mistake. > The second error is: > > In file included from ../src/xwayland.hpp:9, > from ../src/xwayland.cpp:1: > ../src/wlr-wrap-start.hpp:16:19: error: ‘_namespace’ does not name a type > 16 | #define namespace _namespace > | ^~~~~~~~~~ > > I have no idea what this is trying to do, but it's undefined behaviour to > define a macro with the same name as a keyword. This code is bad and should > feel bad. Believe me, I wouldn't have written it if it weren't necessary - it's there because the C code that wlr-wrap-start guards against uses "namespace" as a parameter name, so it has to be redefined temporarily to avoid compiler errors. (In reply to Florian Weimer from comment #1) > My guess is that <stdlib.h> is no longer included before > > #define namespace _namespace > > in src/wlr-wrap-start.hpp, and is now implicitly included when that > “namespace” macro definition is active. Since <stdlib.h> > > The workaround is to include <stdlib.h> before defining “namespace”: > > diff --git a/src/wlr-wrap-start.hpp b/src/wlr-wrap-start.hpp > index 0ef0297..afd17b8 100644 > --- a/src/wlr-wrap-start.hpp > +++ b/src/wlr-wrap-start.hpp > @@ -5,6 +5,7 @@ static_assert(0 == 1, "wlroots include wrap started and not > ended"); > #define WLROOTS_INCLUDE_WRAP_STARTED > > #include <pthread.h> > +#include <stdlib.h> > #include <wayland-server-core.h> > > #ifdef __clang__ This fixed it, thanks. (In reply to Campbell Jones from comment #3) > Believe me, I wouldn't have written it if it weren't necessary - it's there > because the C code that wlr-wrap-start guards against uses "namespace" as a > parameter name, so it has to be redefined temporarily to avoid compiler > errors. Oh yuck, that does seem unavoidable though. |