Bug 200223 - [GTK] Compilation errors when GL is disabled
Summary: [GTK] Compilation errors when GL is disabled
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Local Build
Hardware: All Linux
: P2 Major
Assignee: Michael Catanzaro
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2019-07-29 06:04 PDT by Kam Amini
Modified: 2019-09-18 19:34 PDT (History)
5 users (show)

See Also:


Attachments
Patch (1.92 KB, patch)
2019-09-18 13:17 PDT, Yury Semikhatsky
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kam Amini 2019-07-29 06:04:56 PDT
Hello,

I receive the following compilation error when the GL support is off. I'm compiling 2.24.3 on a CentOS machine.

> In file included from /usr/include/glib-2.0/gobject/gobject.h:28:0,
>                  from /usr/include/glib-2.0/gobject/gbinding.h:29,
>                  from /usr/include/glib-2.0/glib-object.h:23,
>                  from /opt/activevideo/webkit-dependencies/include/gstreamer-1.0/gst/gstenumtypes.h:7,
>                  from /opt/activevideo/webkit-dependencies/include/gstreamer-1.0/gst/gst.h:31,
>                  from ../Source/WebCore/platform/graphics/gstreamer/GRefPtrGStreamer.h:24,
>                  from ../Source/WebCore/platform/graphics/gstreamer/GStreamerCommon.h:24,
>                  from ../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:29,
>                  from ../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:27:
> ../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: In lambda function:
> ../Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:2530:17: error: ‘class WebCore::MediaPlayerPrivateGStreamer’ has no member named ‘updateTextureMapperFlags’
>          player->updateTextureMapperFlags();
>                  ^
>  [12/1006] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp.o

Root Cause:
The issue is apparent in the following sources. The `updateTextureMapperFlags` is defined only when `TEXTURE_MAPPER_GL` is used.

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:247
246 #if USE(TEXTURE_MAPPER_GL)
247     void updateTextureMapperFlags();
248     TextureMapperGL::Flags m_textureMapperFlags;
249 #endif

The following is the definition of the function:

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:964
963 #if USE(TEXTURE_MAPPER_GL)
964 void MediaPlayerPrivateGStreamerBase::updateTextureMapperFlags()
965 {
966     switch (m_videoSourceOrientation) {
967     case DefaultImageOrientation:
968         m_textureMapperFlags = 0;

And the following is the usage of the function which does not check the `TEXTURE_MAPPER_GL` macro to be set.

Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:2491
2489             player->m_videoDecoderPlatform = WebKitGstVideoDecoderPlatform::ImxVPU;
2490
2491         player->updateTextureMapperFlags();
2492     }), this);

Thanks in advance.

Best regards,
Kam
Comment 1 Philippe Normand 2019-07-29 08:29:10 PDT
Hi Kam,

Can you clarify the full list of CMake arguments you use please?
Comment 2 Michael Catanzaro 2019-07-29 08:29:37 PDT
Can you confirm that adding the #if USE(TEXTURE_MAPPER_GL) guard around the call to player->updateTextureMapperFlags() is sufficient to fix the build, or is there a subsequent issue?
Comment 3 Philippe Normand 2019-07-30 02:19:12 PDT
Reproducer:

cmake ~/WebKit -DPORT=GTK -DENABLE_OPENGL=OFF
ninja
Comment 4 Kam Amini 2019-07-30 02:32:07 PDT
Thanks @Philip for the reproduction commands. I'll place the macro around that line and let you know @Michael.
Comment 5 Philippe Normand 2019-07-30 02:34:45 PDT
This is beyond GStreamer:

In file included from /usr/include/X11/Xlib.h:44,
                 from /usr/include/gtk-3.0/gdk/gdkx.h:30,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/PlatformDisplay.cpp:54,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:2:
DerivedSources/ForwardingHeaders/wtf/Threading.h:75:5: error: expected identifier before numeric constant
     None = 0,
     ^~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h:75:5: error: expected ‘}’ before numeric constant
In file included from DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:33,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/FontCascade.h:34,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext.h:31,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.h:38,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:34,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:4:
DerivedSources/ForwardingHeaders/wtf/Threading.h:74:35: note: to match this ‘{’
 enum class GCThreadType : uint8_t {
                                   ^
In file included from /usr/include/X11/Xlib.h:44,
                 from /usr/include/gtk-3.0/gdk/gdkx.h:30,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/PlatformDisplay.cpp:54,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:2:
DerivedSources/ForwardingHeaders/wtf/Threading.h:75:5: error: expected unqualified-id before numeric constant
     None = 0,
     ^~~~
In file included from DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:33,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/FontCascade.h:34,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext.h:31,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.h:38,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:34,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:4:
DerivedSources/ForwardingHeaders/wtf/Threading.h:147:53: error: ‘GCThreadType’ has not been declared
     WTF_EXPORT_PRIVATE static void registerGCThread(GCThreadType);
                                                     ^~~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h:203:5: error: ‘GCThreadType’ does not name a type; did you mean ‘GThreadPool’?
     GCThreadType gcThreadType() const { return static_cast<GCThreadType>(m_gcThreadType); }
     ^~~~~~~~~~~~
     GThreadPool
DerivedSources/ForwardingHeaders/wtf/Threading.h:216:42: error: ‘PlatformThreadHandle’ has not been declared
     void establishPlatformSpecificHandle(PlatformThreadHandle);
                                          ^~~~~~~~~~~~~~~~~~~~
In file included from DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:33,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/FontCascade.h:34,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext.h:31,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.h:38,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:34,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:4:
DerivedSources/ForwardingHeaders/wtf/Threading.h:248:5: error: ‘ThreadGroupAddResult’ does not name a type; did you mean ‘ThreadGroup’?
     ThreadGroupAddResult addToThreadGroup(const AbstractLocker& threadGroupLocker, ThreadGroup&);
     ^~~~~~~~~~~~~~~~~~~~
     ThreadGroup
DerivedSources/ForwardingHeaders/wtf/Threading.h:249:73: error: ‘ThreadGroup’ has not been declared
     void removeFromThreadGroup(const AbstractLocker& threadGroupLocker, ThreadGroup&);
                                                                         ^~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h:257:31: error: ‘ThreadSpecificKey’ does not name a type; did you mean ‘ThreadSafeRefCounted’?
     static WTF_EXPORT_PRIVATE ThreadSpecificKey s_key;
                               ^~~~~~~~~~~~~~~~~
                               ThreadSafeRefCounted
DerivedSources/ForwardingHeaders/wtf/Threading.h:293:26: error: ‘ThreadGroup’ was not declared in this scope
     Vector<std::weak_ptr<ThreadGroup>> m_threadGroups;
                          ^~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h:293:26: note: suggested alternative:
In file included from DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:33,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/FontCascade.h:34,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext.h:31,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.h:38,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:34,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:4:
DerivedSources/ForwardingHeaders/wtf/Threading.h:61:7: note:   ‘WTF::ThreadGroup’
 class ThreadGroup;
       ^~~~~~~~~~~
In file included from DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:33,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/FontCascade.h:34,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext.h:31,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.h:38,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:34,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:4:
DerivedSources/ForwardingHeaders/wtf/Threading.h:293:26: error: template argument 1 is invalid
     Vector<std::weak_ptr<ThreadGroup>> m_threadGroups;
                          ^~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h:293:37: error: template argument 1 is invalid
     Vector<std::weak_ptr<ThreadGroup>> m_threadGroups;
                                     ^~
DerivedSources/ForwardingHeaders/wtf/Threading.h:294:5: error: ‘PlatformThreadHandle’ does not name a type
     PlatformThreadHandle m_handle;
     ^~~~~~~~~~~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h: In constructor ‘Thread::Thread()’:
DerivedSources/ForwardingHeaders/wtf/Threading.h:321:44: error: ‘GCThreadType’ has not been declared
     , m_gcThreadType(static_cast<unsigned>(GCThreadType::None))
                                            ^~~~~~~~~~~~
In file included from /usr/include/X11/Xlib.h:44,
                 from /usr/include/gtk-3.0/gdk/gdkx.h:30,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/PlatformDisplay.cpp:54,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:2:
DerivedSources/ForwardingHeaders/wtf/Threading.h:321:58: error: expected unqualified-id before numeric constant
     , m_gcThreadType(static_cast<unsigned>(GCThreadType::None))
                                                          ^~~~
In file included from DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:33,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/FontCascade.h:34,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext.h:31,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.h:38,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:34,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:4:
DerivedSources/ForwardingHeaders/wtf/Threading.h:321:58: error: expected ‘)’ before numeric constant
     , m_gcThreadType(static_cast<unsigned>(GCThreadType::None))
                                                          ^
                                                          )
DerivedSources/ForwardingHeaders/wtf/Threading.h:321:63: error: expected ‘{’ before ‘)’ token
     , m_gcThreadType(static_cast<unsigned>(GCThreadType::None))
                                                               ^
DerivedSources/ForwardingHeaders/wtf/Threading.h: At global scope:
DerivedSources/ForwardingHeaders/wtf/Threading.h:321:63: error: expected unqualified-id before ‘)’ token
DerivedSources/ForwardingHeaders/wtf/Threading.h: In static member function ‘static Thread* Thread::currentMayBeNull()’:
DerivedSources/ForwardingHeaders/wtf/Threading.h:329:51: error: ‘s_key’ was not declared in this scope
     return static_cast<Thread*>(threadSpecificGet(s_key));
                                                   ^~~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h:329:51: note: suggested alternative: ‘si_pkey’
     return static_cast<Thread*>(threadSpecificGet(s_key));
                                                   ^~~~~
                                                   si_pkey
DerivedSources/ForwardingHeaders/wtf/Threading.h:329:33: error: ‘threadSpecificGet’ was not declared in this scope
     return static_cast<Thread*>(threadSpecificGet(s_key));
                                 ^~~~~~~~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Threading.h:329:33: note: suggested alternative:
In file included from DerivedSources/ForwardingHeaders/wtf/MainThread.h:35,
                 from DerivedSources/ForwardingHeaders/wtf/ThreadSafeRefCounted.h:30,
                 from DerivedSources/ForwardingHeaders/wtf/FunctionDispatcher.h:29,
                 from DerivedSources/ForwardingHeaders/wtf/RunLoop.h:33,
                 from DerivedSources/ForwardingHeaders/pal/HysteresisActivity.h:28,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoImpl.h:23,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp:21,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:3:
DerivedSources/ForwardingHeaders/wtf/ThreadingPrimitives.h:143:14: note:   ‘WTF::threadSpecificGet’
 inline void* threadSpecificGet(ThreadSpecificKey key)
              ^~~~~~~~~~~~~~~~~
In file included from DerivedSources/ForwardingHeaders/wtf/Platform.h:31,
                 from /home/phil/WebKit/Source/WebCore/config.h:26,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext3DPrivate.cpp:20,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:1:
DerivedSources/ForwardingHeaders/wtf/Threading.h: In static member function ‘static Thread& Thread::current()’:
DerivedSources/ForwardingHeaders/wtf/Threading.h:344:26: error: ‘s_key’ is not a member of ‘Thread’
     if (UNLIKELY(Thread::s_key == InvalidThreadSpecificKey))
                          ^~~~~
DerivedSources/ForwardingHeaders/wtf/Compiler.h:341:41: note: in definition of macro ‘UNLIKELY’
 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
                                         ^
DerivedSources/ForwardingHeaders/wtf/Threading.h:344:35: error: ‘InvalidThreadSpecificKey’ was not declared in this scope
     if (UNLIKELY(Thread::s_key == InvalidThreadSpecificKey))
                                   ^~~~~~~~~~~~~~~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Compiler.h:341:41: note: in definition of macro ‘UNLIKELY’
 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
                                         ^
DerivedSources/ForwardingHeaders/wtf/Threading.h:344:35: note: suggested alternative:
     if (UNLIKELY(Thread::s_key == InvalidThreadSpecificKey))
                                   ^~~~~~~~~~~~~~~~~~~~~~~~
DerivedSources/ForwardingHeaders/wtf/Compiler.h:341:41: note: in definition of macro ‘UNLIKELY’
 #define UNLIKELY(x) __builtin_expect(!!(x), 0)
                                         ^
In file included from DerivedSources/ForwardingHeaders/wtf/MainThread.h:35,
                 from DerivedSources/ForwardingHeaders/wtf/ThreadSafeRefCounted.h:30,
                 from DerivedSources/ForwardingHeaders/wtf/FunctionDispatcher.h:29,
                 from DerivedSources/ForwardingHeaders/wtf/RunLoop.h:33,
                 from DerivedSources/ForwardingHeaders/pal/HysteresisActivity.h:28,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoImpl.h:23,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/BackingStoreBackendCairoImpl.cpp:21,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:3:
DerivedSources/ForwardingHeaders/wtf/ThreadingPrimitives.h:122:36: note:   ‘WTF::InvalidThreadSpecificKey’
 static constexpr ThreadSpecificKey InvalidThreadSpecificKey = PTHREAD_KEYS_MAX;
                                    ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from DerivedSources/ForwardingHeaders/wtf/WeakPtr.h:33,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/FontCascade.h:34,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/GraphicsContext.h:31,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.h:38,
                 from /home/phil/WebKit/Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:34,
                 from DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:4:
DerivedSources/ForwardingHeaders/wtf/Threading.h: At global scope:
DerivedSources/ForwardingHeaders/wtf/Threading.h:356:1: error: expected declaration before ‘}’ token
 } // namespace WTF
 ^
Comment 6 Michael Catanzaro 2019-07-30 08:25:47 PDT
(In reply to Philippe Normand from comment #5)
> This is beyond GStreamer:
> 
> In file included from /usr/include/X11/Xlib.h:44,
>                  from /usr/include/gtk-3.0/gdk/gdkx.h:30,
>                  from
> /home/phil/WebKit/Source/WebCore/platform/graphics/PlatformDisplay.cpp:54,
>                  from
> DerivedSources/WebCore/unified-sources/UnifiedSource-3c72abbe-24.cpp:2:
> DerivedSources/ForwardingHeaders/wtf/Threading.h:75:5: error: expected
> identifier before numeric constant
>      None = 0,
>      ^~~~

Files including Xlib.h must be excluded from unified build. Solution is to add @no-unify to PlatformDisplay.cpp in Sources.txt.

If you're bored or have 25 hours today, you could git grep to try to find every .cpp that includes gdkx.h and Xlib.h and mark them all as @no-unify.
Comment 7 Michael Catanzaro 2019-07-30 08:26:57 PDT
Actually I have time today to take this.
Comment 8 Michael Catanzaro 2019-07-30 09:16:53 PDT
I tested the tarball, and these guards are all that's needed there. I'll check trunk next; I expect to see Phil's errors on trunk.
Comment 9 Michael Catanzaro 2019-07-30 09:17:42 PDT
Committed r248009: <https://trac.webkit.org/changeset/248009>
Comment 10 Michael Catanzaro 2019-07-30 09:28:41 PDT
BTW the eventual 2.24.4 tarball will contain this fix, thanks for reporting.
Comment 11 Michael Catanzaro 2019-07-30 10:29:02 PDT
Committed r248012: <https://trac.webkit.org/changeset/248012>
Comment 12 Michael Catanzaro 2019-07-30 10:31:06 PDT
Reopening since fixing trunk requires thinking, and I'm not good at that. We have:

In file included from DerivedSources/WebKit/unified-sources/UnifiedSource-88d1702b-25.cpp:3:
/home/mcatanzaro/Projects/WebKit/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp: In member function ‘void WebKit::WebProcessPool::platformInitializeWebProcess(const WebKit::WebProcessProxy&, WebKit::WebProcessCreationParameters&)’:
/home/mcatanzaro/Projects/WebKit/Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp:123:51: error: ‘WaylandCompositor’ has not been declared
  123 |         parameters.waylandCompositorDisplayName = WaylandCompositor::singleton().displayName();
      |                                                   ^~~~~~~~~~~~~~~~~

So WebProcessPoolGLib.cpp requires WaylandCompositor because PLATFORM(WAYLAND) is true but USE(WPE_RENDERER) is false. Problem is WaylandCompositor.h is guarded by #if PLATFORM(WAYLAND) && USE(EGL) && !USE(WPE_RENDERER). Carlos Garcia might know what to do.
Comment 13 Kam Amini 2019-07-31 01:34:14 PDT
(In reply to Michael Catanzaro from comment #10)
> BTW the eventual 2.24.4 tarball will contain this fix, thanks for reporting.

Thank you for the quick fix. I'll wait until the bug is fully resolved.
Comment 14 Yury Semikhatsky 2019-09-18 13:17:25 PDT
Created attachment 379065 [details]
Patch
Comment 15 WebKit Commit Bot 2019-09-18 19:34:56 PDT
Comment on attachment 379065 [details]
Patch

Clearing flags on attachment: 379065

Committed r250077: <https://trac.webkit.org/changeset/250077>
Comment 16 WebKit Commit Bot 2019-09-18 19:34:57 PDT
All reviewed patches have been landed.  Closing bug.