Bug 198080

Summary: webkitgtk 2.24.2 fails to build w/gstreamer 1.12.5
Product: WebKit Reporter: Mike Gorse <mgorse>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: berto, bugs-noreply, commit-queue, pnormand
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Linux   
Attachments:
Description Flags
Patch.
none
Patch. none

Description Mike Gorse 2019-05-21 13:07:12 PDT
I am trying to build webkitgtk on openSUSE Leap 15.0, which has gstreamer 1.12.5. With USE_GSTREAMER_GL, I get the following error, similar to bug 196178:

In file included from Source/WebCore/platform/graphics/texmap/TextureMapperGLHeaders.h:34:0,
                 from Source/WebCore/platform/graphics/texmap/TextureMapperGL.h:31,
                 from Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h:41,
                 from Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:26:
Source/WebCore/platform/graphics/OpenGLShims.h:259:67: error: expected type-specifier before 'glActiveTexture'
 #define glActiveTexture                        LOOKUP_GL_FUNCTION(glActiveTexture)
                                                                   ^
followed by many other errors. Probably related to this commit:
https://trac.webkit.org/changeset/245119/webkit
Comment 1 Alberto Garcia 2019-05-22 00:56:24 PDT
This is probably not the cleanest fix, but here's a very quick
workaround that I used to make it build in my environment:

--- webkitgtk.orig/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
+++ webkitgtk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.h
@@ -38,6 +38,9 @@
 #include <wtf/WeakPtr.h>
 
 #if USE(TEXTURE_MAPPER_GL)
+#define GST_USE_UNSTABLE_API
+#include <gst/gl/gl.h>
+#undef GST_USE_UNSTABLE_API
 #include "TextureMapperGL.h"
 #if USE(NICOSIA)
 #include "NicosiaContentLayerTextureMapperImpl.h"
Comment 2 Mike Gorse 2019-06-19 13:49:30 PDT
I'm not super familiar with gstreamer / don't know whether this is the
right fix or not, but I just noticed that it wouldn't be the only place
where we do this. mediaPlayerPrivateGStreamerBase.cpp has this:
#define GST_USE_UNSTABLE_API
#include <gst/gl/gl.h>
#undef GST_USE_UNSTABLE_API

We could also condition it with #if !GST_CHECK_VERSION(1, 14, 0)
Comment 3 Philippe Normand 2019-06-19 14:05:38 PDT
(In reply to Mike Gorse from comment #2)
> I'm not super familiar with gstreamer / don't know whether this is the
> right fix or not, but I just noticed that it wouldn't be the only place
> where we do this. mediaPlayerPrivateGStreamerBase.cpp has this:
> #define GST_USE_UNSTABLE_API
> #include <gst/gl/gl.h>
> #undef GST_USE_UNSTABLE_API
> 
> We could also condition it with #if !GST_CHECK_VERSION(1, 14, 0)

That include is already wrapped by #if USE(GSTREAMER_GL). I know the ifdef soup there is already confusing enough.
Comment 4 Mike Gorse 2019-06-21 13:53:23 PDT
Created attachment 372646 [details]
Patch.

This is the patch that Alberto posted in comment 1, along with a ChangeLog entry. It fixes the build for me.
Comment 5 Philippe Normand 2019-06-21 14:44:02 PDT
Comment on attachment 372646 [details]
Patch.

Can the same include be removed from the cpp file then?
Comment 6 Mike Gorse 2019-06-22 05:03:20 PDT
Created attachment 372676 [details]
Patch.

Removed gst/gl/gl.h from the source file. Also moved include of epoxy header, since I think that that needs to be included first.
Comment 7 WebKit Commit Bot 2019-06-22 08:51:06 PDT
Comment on attachment 372676 [details]
Patch.

Clearing flags on attachment: 372676

Committed r246710: <https://trac.webkit.org/changeset/246710>
Comment 8 WebKit Commit Bot 2019-06-22 08:51:08 PDT
All reviewed patches have been landed.  Closing bug.