Bug 273097

Summary: WebSocketChannel.h build failure with -Werror=overloaded-virtual on GCC 13
Product: WebKit Reporter: Fujii Hironori <Hironori.Fujii>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: cadubentzen, csaavedra, darin, kkinnunen, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Description Fujii Hironori 2024-04-22 17:40:43 PDT
GTK port reports a compile warning.

fujii@fujihiro-ubuntu $ ./Tools/Scripts/webkit-flatpak --version
277469@main
fujii@fujihiro-ubuntu $ ./Tools/Scripts/git-webkit info
Title: [view-transitions] View transition pseudo elements should be anonymous.
Author: Matt Woodrow <mattwoodrow@apple.com>
Date: Tue Apr 23 05:51:50 2024
Hash: 124d36f180e3
Identifier: 277834@main
fujii@fujihiro-ubuntu $ ./Tools/Scripts/build-webkit --gtk --release
Building flatpak based environment
+  cmake --build /app/webkit/WebKitBuild/GTK/Release --config Release -- 
[0/2] Re-checking globbed directories...
(...)
[58/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/ParkingLot.cpp.o
[59/439] Building CXX object Source/WebKit/CMakeFiles/WebKit.dir/__/__/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp.o
FAILED: Source/WebKit/CMakeFiles/WebKit.dir/__/__/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp.o 
/usr/bin/ccache /usr/bin/c++ -DBUILDING_GTK__=1 -DBUILDING_WEBKIT=1 -DBUILDING_WITH_CMAKE=1 -DBUILDING_WebKit -DBWRAP_EXECUTABLE=\"/usr/bin/bwrap\" -DDATADIR=\"/usr/local/share\" -DDBUS_PROXY_EXECUTABLE=\"/usr/bin/xdg-dbus-proxy\" -DGETTEXT_PACKAGE=\"WebKitGTK-6.0\" -DHAVE_CONFIG_H=1 -DJSC_GLIB_API_ENABLED -DLIBDIR=\"/usr/local/lib\" -DLOCALEDIR=\"/usr/local/share/locale\" -DPAS_BMALLOC=1 -DPKGLIBDIR=\"/usr/local/lib/webkitgtk-6.0\" -DPKGLIBEXECDIR=\"/usr/local/libexec/webkitgtk-6.0\" -DSTATICALLY_LINKED_WITH_PAL -DSTATICALLY_LINKED_WITH_WebCore -DUSE_SYSTEM_EGL -DWebKit_EXPORTS -I/app/webkit/WebKitBuild/GTK/Release/WebKitGTK/Headers -I/app/webkit/WebKitBuild/GTK/Release/WebKitGTK/Headers/webkitgtk-6.0 -I/app/webkit/WebKitBuild/GTK/Release/WebKitGTK/Headers/webkitgtk-web-process-extension -I/app/webkit/WebKitBuild/GTK/Release/WebKitGTK/DerivedSources/webkit -I/app/webkit/WebKitBuild/GTK/Release/WebKitGTK/DerivedSources -I/app/webkit/WebKitBuild/GTK/Release -I/app/webkit/WebKitBuild/GTK/Release/PAL/Headers -I/app/webkit/WebKitBuild/GTK/Release/WebCore/PrivateHeaders -I/app/webkit/WebKitBuild/GTK/Release/DerivedSources/ForwardingHeaders -I/app/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit -I/app/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/include -I/app/webkit/Source/WebKit -I/app/webkit/Source/WebKit/GPUProcess -I/app/webkit/Source/WebKit/GPUProcess/ShapeDetection -I/app/webkit/Source/WebKit/GPUProcess/graphics -I/app/webkit/Source/WebKit/GPUProcess/graphics/WebGPU -I/app/webkit/Source/WebKit/GPUProcess/media -I/app/webkit/Source/WebKit/GPUProcess/webrtc -I/app/webkit/Source/WebKit/ModelProcess -I/app/webkit/Source/WebKit/NetworkProcess -I/app/webkit/Source/WebKit/NetworkProcess/Classifier -I/app/webkit/Source/WebKit/NetworkProcess/Cookies -I/app/webkit/Source/WebKit/NetworkProcess/CustomProtocols -I/app/webkit/Source/WebKit/NetworkProcess/Downloads -I/app/webkit/Source/WebKit/NetworkProcess/FileAPI -I/app/webkit/Source/WebKit/NetworkProcess/IndexedDB -I/app/webkit/Source/WebKit/NetworkProcess/Notifications -I/app/webkit/Source/WebKit/NetworkProcess/PrivateClickMeasurement -I/app/webkit/Source/WebKit/NetworkProcess/ServiceWorker -I/app/webkit/Source/WebKit/NetworkProcess/SharedWorker -I/app/webkit/Source/WebKit/NetworkProcess/cache -I/app/webkit/Source/WebKit/NetworkProcess/storage -I/app/webkit/Source/WebKit/NetworkProcess/watchos -I/app/webkit/Source/WebKit/NetworkProcess/webrtc -I/app/webkit/Source/WebKit/NetworkProcess/webtransport -I/app/webkit/Source/WebKit/Platform -I/app/webkit/Source/WebKit/Platform/IPC -I/app/webkit/Source/WebKit/PluginProcess -I/app/webkit/Source/WebKit/Shared -I/app/webkit/Source/WebKit/Shared/API -I/app/webkit/Source/WebKit/Shared/API/c -I/app/webkit/Source/WebKit/Shared/ApplePay -I/app/webkit/Source/WebKit/Shared/Authentication -I/app/webkit/Source/WebKit/Shared/CoreIPCSupport -I/app/webkit/Source/WebKit/Shared/Databases -I/app/webkit/Source/WebKit/Shared/Databases/IndexedDB -I/app/webkit/Source/WebKit/Shared/Extensions -I/app/webkit/Source/WebKit/Shared/FileAPI -I/app/webkit/Source/WebKit/Shared/Gamepad -I/app/webkit/Source/WebKit/Shared/Notifications -I/app/webkit/Source/WebKit/Shared/RemoteLayerTree -I/app/webkit/Source/WebKit/Shared/WebGPU -I/app/webkit/Source/WebKit/Shared/WebsiteData -I/app/webkit/Source/WebKit/Shared/XR -I/app/webkit/Source/WebKit/UIProcess -I/app/webkit/Source/WebKit/UIProcess/API -I/app/webkit/Source/WebKit/UIProcess/API/C -I/app/webkit/Source/WebKit/UIProcess/API/cpp -I/app/webkit/Source/WebKit/UIProcess/Authentication -I/app/webkit/Source/WebKit/UIProcess/Automation -I/app/webkit/Source/WebKit/UIProcess/Downloads -I/app/webkit/Source/WebKit/UIProcess/Gamepad -I/app/webkit/Source/WebKit/UIProcess/GPU -I/app/webkit/Source/WebKit/UIProcess/Inspector -I/app/webkit/Source/WebKit/UIProcess/Inspector/Agents -I/app/webkit/Source/WebKit/UIProcess/Launcher -I/app/webkit/Source/WebKit/UIProcess/Media -I/app/webkit/Source/WebKit/UIProcess/Model -I/app/webkit/Source/WebKit/UIProcess/Network -I/app/webkit/Source/WebKit/UIProcess/Network/CustomProtocols -I/app/webkit/Source/WebKit/UIProcess/Notifications -I/app/webkit/Source/WebKit/UIProcess/Plugins -I/app/webkit/Source/WebKit/UIProcess/RemoteLayerTree -I/app/webkit/Source/WebKit/UIProcess/UserContent -I/app/webkit/Source/WebKit/UIProcess/WebAuthentication -I/app/webkit/Source/WebKit/UIProcess/WebAuthentication/Mock -I/app/webkit/Source/WebKit/UIProcess/WebsiteData -I/app/webkit/Source/WebKit/UIProcess/XR -I/app/webkit/Source/WebKit/WebProcess -I/app/webkit/Source/WebKit/WebProcess/ApplePay -I/app/webkit/Source/WebKit/WebProcess/ApplicationCache -I/app/webkit/Source/WebKit/WebProcess/Automation -I/app/webkit/Source/WebKit/WebProcess/Cache -I/app/webkit/Source/WebKit/WebProcess/Databases -I/app/webkit/Source/WebKit/WebProcess/Databases/IndexedDB -I/app/webkit/Source/WebKit/WebProcess/EncryptedMedia -I/app/webkit/Source/WebKit/WebProcess/FileAPI -I/app/webkit/Source/WebKit/WebProcess/FullScreen -I/app/webkit/Source/WebKit/WebProcess/Gamepad -I/app/webkit/Source/WebKit/WebProcess/Geolocation -I/app/webkit/Source/WebKit/WebProcess/GPU -I/app/webkit/Source/WebKit/WebProcess/GPU/ShapeDetection -I/app/webkit/Source/WebKit/WebProcess/GPU/graphics -I/app/webkit/Source/WebKit/WebProcess/GPU/graphics/WebGPU -I/app/webkit/Source/WebKit/WebProcess/GPU/media -I/app/webkit/Source/WebKit/WebProcess/GPU/webrtc -I/app/webkit/Source/WebKit/WebProcess/IconDatabase -I/app/webkit/Source/WebKit/WebProcess/InjectedBundle -I/app/webkit/Source/WebKit/WebProcess/InjectedBundle/API -I/app/webkit/Source/WebKit/WebProcess/InjectedBundle/API/c -I/app/webkit/Source/WebKit/WebProcess/InjectedBundle/DOM -I/app/webkit/Source/WebKit/WebProcess/Inspector -I/app/webkit/Source/WebKit/WebProcess/Launching -I/app/webkit/Source/WebKit/WebProcess/MediaCache -I/app/webkit/Source/WebKit/WebProcess/MediaStream -I/app/webkit/Source/WebKit/WebProcess/Model -I/app/webkit/Source/WebKit/WebProcess/Network -I/app/webkit/Source/WebKit/WebProcess/Network/webrtc -I/app/webkit/Source/WebKit/WebProcess/Notifications -I/app/webkit/Source/WebKit/WebProcess/OriginData -I/app/webkit/Source/WebKit/WebProcess/Plugins -I/app/webkit/Source/WebKit/WebProcess/Plugins/Netscape -I/app/webkit/Source/WebKit/WebProcess/ResourceCache -I/app/webkit/Source/WebKit/WebProcess/Speech -I/app/webkit/Source/WebKit/WebProcess/Storage -I/app/webkit/Source/WebKit/WebProcess/UserContent -I/app/webkit/Source/WebKit/WebProcess/WebCoreSupport -I/app/webkit/Source/WebKit/WebProcess/WebPage -I/app/webkit/Source/WebKit/WebProcess/WebPage/RemoteLayerTree -I/app/webkit/Source/WebKit/WebProcess/WebStorage -I/app/webkit/Source/WebKit/WebProcess/XR -I/app/webkit/Source -I/app/webkit/WebKitLibraries -I/app/webkit/WebKitBuild/GTK/Release/JavaScriptCoreGLib/DerivedSources/jsc -I/app/webkit/Source/WebKit/NetworkProcess/glib -I/app/webkit/Source/WebKit/NetworkProcess/gtk -I/app/webkit/Source/WebKit/NetworkProcess/soup -I/app/webkit/Source/WebKit/Platform/IPC/glib -I/app/webkit/Source/WebKit/Platform/IPC/unix -I/app/webkit/Source/WebKit/Platform/classifier -I/app/webkit/Source/WebKit/Platform/generic -I/app/webkit/Source/WebKit/Shared/API/c/gtk -I/app/webkit/Source/WebKit/Shared/API/glib -I/app/webkit/Source/WebKit/Shared/CoordinatedGraphics -I/app/webkit/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor -I/app/webkit/Source/WebKit/Shared/glib -I/app/webkit/Source/WebKit/Shared/gtk -I/app/webkit/Source/WebKit/Shared/linux -I/app/webkit/Source/WebKit/Shared/skia -I/app/webkit/Source/WebKit/Shared/soup -I/app/webkit/Source/WebKit/UIProcess/API/C/cairo -I/app/webkit/Source/WebKit/UIProcess/API/C/glib -I/app/webkit/Source/WebKit/UIProcess/API/C/gtk -I/app/webkit/Source/WebKit/UIProcess/API/glib -I/app/webkit/Source/WebKit/UIProcess/API/gtk -I/app/webkit/Source/WebKit/UIProcess/CoordinatedGraphics -I/app/webkit/Source/WebKit/UIProcess/Inspector/glib -I/app/webkit/Source/WebKit/UIProcess/Inspector/gtk -I/app/webkit/Source/WebKit/UIProcess/Notifications/glib -I/app/webkit/Source/WebKit/UIProcess/geoclue -I/app/webkit/Source/WebKit/UIProcess/glib -I/app/webkit/Source/WebKit/UIProcess/gstreamer -I/app/webkit/Source/WebKit/UIProcess/gtk -I/app/webkit/Source/WebKit/UIProcess/linux -I/app/webkit/Source/WebKit/UIProcess/soup -I/app/webkit/Source/WebKit/WebProcess/InjectedBundle/API/glib -I/app/webkit/Source/WebKit/WebProcess/InjectedBundle/API/gtk -I/app/webkit/Source/WebKit/WebProcess/Inspector/gtk -I/app/webkit/Source/WebKit/WebProcess/glib -I/app/webkit/Source/WebKit/WebProcess/gtk -I/app/webkit/Source/WebKit/WebProcess/soup -I/app/webkit/Source/WebKit/WebProcess/WebCoreSupport/gtk -I/app/webkit/Source/WebKit/WebProcess/WebCoreSupport/soup -I/app/webkit/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics -I/app/webkit/Source/WebKit/WebProcess/WebPage/gtk -I/app/webkit/Source/WebKit/WebProcess/WebPage/dmabuf -I/app/webkit/WebKitBuild/GTK/Release/JavaScriptCore/Headers -I/app/webkit/WebKitBuild/GTK/Release/JavaScriptCore/PrivateHeaders -I/app/webkit/WebKitBuild/GTK/Release/JavaScriptCoreGLib/Headers -I/app/webkit/WebKitBuild/GTK/Release/JavaScriptCoreGLib/DerivedSources -I/app/webkit/WebKitBuild/GTK/Release/WTF/Headers -I/app/webkit/WebKitBuild/GTK/Release/bmalloc/Headers -I/app/webkit/WebKitBuild/GTK/Release/ANGLE/Headers -isystem /usr/include/enchant-2 -isystem /usr/include/gio-unix-2.0 -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/gstreamer-1.0 -isystem /usr/include/orc-0.4 -isystem /usr/include/gtk-4.0 -isystem /usr/include/pango-1.0 -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/cairo -isystem /usr/include/graphene-1.0 -isystem /usr/lib/x86_64-linux-gnu/graphene-1.0/include -isystem /usr/include/freetype2 -isystem /usr/include/harfbuzz -isystem /usr/include/webp -isystem /usr/include/pixman-1 -isystem /usr/include/libpng16 -isystem /usr/include/fribidi -isystem /usr/include/libsoup-3.0 -isystem /usr/include/gtk-4.0/unix-print -isystem /usr/include/libxml2 -isystem /usr/include/avif -isystem /usr/include/libmanette -isystem /usr/include/libdrm -fdiagnostics-color=always -Wextra -Wall -pipe -fmax-errors=20 -Wno-odr -Wno-stringop-overread -Wno-stringop-overflow -Wno-nonnull -Wno-array-bounds -Wno-expansion-to-defined -Wno-noexcept-type -Wno-psabi -Wno-misleading-indentation -Wno-maybe-uninitialized -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wno-tautological-compare -fno-strict-aliasing -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++20 -fPIC -fvisibility=hidden  -include /app/webkit/Source/WebKit/WebKit2Prefix.h -Werror -Wno-unused-parameter -mfpmath=sse -msse -msse2 -pthread -DAVIF_DLL -MD -MT Source/WebKit/CMakeFiles/WebKit.dir/__/__/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp.o -MF Source/WebKit/CMakeFiles/WebKit.dir/__/__/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp.o.d -o Source/WebKit/CMakeFiles/WebKit.dir/__/__/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp.o -c /app/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp
In file included from /app/webkit/Source/WebKit/WebProcess/WebPage/WebPage.h:41,
                 from /app/webkit/Source/WebKit/WebProcess/WebPage/PageBanner.cpp:29,
                 from /app/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp:3:
/app/webkit/Source/WebKit/Platform/IPC/MessageSender.h:83:18: error: ‘virtual bool IPC::MessageSender::sendMessage(WTF::UniqueRef<IPC::Encoder>&&, WTF::OptionSet<IPC::SendOption>)’ was hidden [-Werror=overloaded-virtual=]
   83 |     virtual bool sendMessage(UniqueRef<Encoder>&&, OptionSet<SendOption>);
      |                  ^~~~~~~~~~~
In file included from /app/webkit/Source/WebKit/WebProcess/Network/WebSocketChannelManager.h:28,
                 from /app/webkit/Source/WebKit/WebProcess/WebProcess.h:36,
                 from /app/webkit/Source/WebKit/WebProcess/WebPage/VisitedLinkTableController.cpp:32,
                 from /app/webkit/WebKitBuild/GTK/Release/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-28.cpp:4:
/app/webkit/Source/WebKit/WebProcess/Network/WebSocketChannel.h:101:31: note:   by ‘WebKit::WebSocketChannel::sendMessage(T&&, size_t)’
  101 |     template<typename T> void sendMessage(T&&, size_t byteLength);
      |                               ^~~~~~~~~~~
cc1plus: all warnings being treated as errors
[60/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/PackedRefPtr.cpp.o
[61/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/RefLogger.cpp.o
[62/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/RefCounter.cpp.o
[63/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/PriorityQueue.cpp.o
[64/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/Ref.cpp.o
[65/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/RedBlackTree.cpp.o
[66/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/RefCountedFixedVector.cpp.o
[67/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/RefPtr.cpp.o
[68/439] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/NativePromise.cpp.o
ninja: build stopped: subcommand failed.
fujii@fujihiro-ubuntu $
Comment 1 Claudio Saavedra 2024-04-22 22:50:23 PDT
Is it possible that this is caused by unified builds? I can't reproduce this by building WKGTK from directly from git, but when I build a couple of my own MRs, I hit this locally.

IIUC we have

 virtual bool MessageSender::sendMessage(UniqueRef<Encoder>&&, OptionSet<SendOption>);

and then

 template<typename T> void WebSocketChannel::sendMessage(T&&, size_t byteLength);

pulled into the same compilation unit. WebSocketChannel inherits from MessageSender:

  class WebSocketChannel : public IPC::MessageSender, public IPC::MessageReceiver, public WebCore::ThreadableWebSocketChannel, public RefCounted<WebSocketChannel> {


Is this intentional?
Comment 2 Carlos Bentzen 2024-04-23 03:18:20 PDT
It may be because of -Woverloaded-virtual being included in -Wall on GCC 13: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=113844d68e94f4e9c0e946db351ba7d3d4a1335a
Comment 3 Carlos Bentzen 2024-04-23 03:33:44 PDT
Pull request: https://github.com/WebKit/WebKit/pull/27625
Comment 4 Carlos Bentzen 2024-04-23 06:46:05 PDT
Not GTK-specific, maybe GCC-specific?
The title could be set to something like `Build failure with -Werror=overloaded-virtual in GCC`.
Comment 5 Darin Adler 2024-04-23 12:12:14 PDT
Would be nice to notice things like this in EWS. Maybe we can update the GCC used in the GTK EWS?
Comment 6 Fujii Hironori 2024-04-23 13:17:37 PDT
Something weird is happening on GTK EWS.
I'm using the latest flatpak SDK. It actually contains GCC 13.2.0.

> fujii@fujihiro-ubuntu $ ./Tools/Scripts/webkit-flatpak --version
> 277469@main
> fujii@fujihiro-ubuntu $ ./Tools/Scripts/webkit-flatpak -c /usr/bin/c++ --version
> c++ (GCC) 13.2.0

GTK EWS workers are also claiming they are using "SDK version: 277469@main".
Comment 7 Claudio Saavedra 2024-04-23 13:56:32 PDT
At least for me, this only happens after applying a couple of changes in Source/WebKit locally and building. When building a pristine revision from git, it builds fine. So I don't think it's a EWS issue.

Could it be caused by varying grouping of sources in each unified build file?
Comment 8 Darin Adler 2024-04-23 14:01:18 PDT
Different unified build grouping only happens when we add or remove source files, I believe.
Comment 9 EWS 2024-04-23 17:23:45 PDT
Committed 277904@main (619e39d2eab1): <https://commits.webkit.org/277904@main>

Reviewed commits have been landed. Closing PR #27625 and removing active labels.
Comment 10 Radar WebKit Bug Importer 2024-04-23 17:24:17 PDT
<rdar://problem/126953472>