<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>208907</bug_id>
          
          <creation_ts>2020-03-11 01:06:47 -0700</creation_ts>
          <short_desc>[GTK] graphics/GLContext.cpp fails compiling with error: ‘initializeOpenGLShims’ was not declared in this scope; did you mean ‘initializeOpenGLShimsIfNeeded’?</short_desc>
          <delta_ts>2022-02-15 00:40:13 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>236593</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=236593</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Дилян Палаузов">dpa-webkit</reporter>
          <assigned_to name="Adrian Perez">aperez</assigned_to>
          <cc>aperez</cc>
    
    <cc>berto</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cgarcia</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>gustavo</cc>
    
    <cc>leio</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1628560</commentid>
    <comment_count>0</comment_count>
    <who name="Дилян Палаузов">dpa-webkit</who>
    <bug_when>2020-03-11 01:06:47 -0700</bug_when>
    <thetext>Compiling WebKitGkt 2.28.0 fails with:

make[2]: Entering directory &apos;/src/gnome/webkitgtk-2.28.0/build&apos;
[ 72%] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir/platform/graphics/GLContext.cpp.o
/src/gnome/webkitgtk-2.28.0/Source/WebCore/platform/graphics/GLContext.cpp: In function ‘bool WebCore::initializeOpenGLShimsIfNeeded()’:
/src/gnome/webkitgtk-2.28.0/Source/WebCore/platform/graphics/GLContext.cpp:66:19: error: ‘initializeOpenGLShims’ was not declared in this scope; did you mean ‘initializeOpenGLShimsIfNeeded’?
   66 |         success = initializeOpenGLShims();
      |                   ^~~~~~~~~~~~~~~~~~~~~
      |                   initializeOpenGLShimsIfNeeded
/src/gnome/webkitgtk-2.28.0/Source/WebCore/platform/graphics/GLContext.cpp: In member function ‘unsigned int WebCore::GLContext::version()’:
/src/gnome/webkitgtk-2.28.0/Source/WebCore/platform/graphics/GLContext.cpp:171:71: error: ‘::glGetString’ has not been declared; did you mean ‘res_getString’?
  171 |         String versionString = String(reinterpret_cast&lt;const char*&gt;(::glGetString(GL_VERSION)));
      |                                                                       ^~~~~~~~~~~
      |                                                                       res_getString
/src/gnome/webkitgtk-2.28.0/Source/WebCore/platform/graphics/GLContext.cpp:171:83: error: ‘GL_VERSION’ was not declared in this scope; did you mean ‘GCC_VERSION’?
  171 |         String versionString = String(reinterpret_cast&lt;const char*&gt;(::glGetString(GL_VERSION)));
      |                                                                                   ^~~~~~~~~~
      |                                                                                   GCC_VERSION
make[2]: *** [Source/WebCore/CMakeFiles/WebCore.dir/build.make:7769: Source/WebCore/CMakeFiles/WebCore.dir/platform/graphics/GLContext.cpp.o] Error 1
make[2]: Leaving directory &apos;/src/gnome/webkitgtk-2.28.0/build&apos;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1628565</commentid>
    <comment_count>1</comment_count>
    <who name="Дилян Палаузов">dpa-webkit</who>
    <bug_when>2020-03-11 01:47:14 -0700</bug_when>
    <thetext>GlContext.cpp contains:


#if USE(GLX)
#include &quot;GLContextGLX.h&quot;
#include &quot;OpenGLShims.h&quot;
#endif



static bool initializeOpenGLShimsIfNeeded()
{
#if USE(OPENGL_ES) || USE(LIBEPOXY)
    return true;
#else
    static bool initialized = false;
    static bool success = true;
    if (!initialized) {
        success = initializeOpenGLShims();
        initialized = true;
    }
    return success;
#endif
}

So when GLX, OPENGL_ES and LIBEPOXY are not defined, which somehow happens to be the case on my system, compilation fails.  My system does have libepoxy 1.5.3.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1650946</commentid>
    <comment_count>2</comment_count>
    <who name="Mart Raudsepp">leio</who>
    <bug_when>2020-05-09 12:43:05 -0700</bug_when>
    <thetext>Source/WebCore/platform/graphics/GLContext.cpp is including OpenGLShims.h only if GLX is enabled, but then using the initializeOpenGLShims function in other cases as well. I think the preprocessor conditionals should match better.
As-is, it seems to guarantee a fail for a -DENABLE_X11_TARGET=OFF -DENABLE_OPENGL=ON build that picks OpenGL.

Basically initializeOpenGLShimsIfNeeded seems to think that a EGL+full OpenGL (instead of GLX) doesn&apos;t exist or happen, but libepoxy isn&apos;t used at all for a webkitgtk build (I guess it might be used in webkit-wpe or something)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1650949</commentid>
    <comment_count>3</comment_count>
    <who name="Mart Raudsepp">leio</who>
    <bug_when>2020-05-09 12:45:02 -0700</bug_when>
    <thetext>while there, I also notice that initializeOpenGLShimsIfNeeded tracks initialized and success states, to not call it multiple times - but initializeOpenGLShims already (or by now) does exactly that as well, so that feels superfluous there in initializeOpenGLShimsIfNeeded</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1650960</commentid>
    <comment_count>4</comment_count>
      <attachid>398939</attachid>
    <who name="Mart Raudsepp">leio</who>
    <bug_when>2020-05-09 13:46:52 -0700</bug_when>
    <thetext>Created attachment 398939
Patch to make non-X EGL full OpenGL builds succeed

I&apos;m not happy about this patch, as it doesn&apos;t adjust things to be similar in all the places, but enough to get the build issue I was having fixed.

Looking into this, I found that various OpenGLShims.h usages are quite different from each other in their conditionals. So some places assume it&apos;s only needed for GLX, while others don&apos;t know anything about ANGLE being a thing yet, etc.
I don&apos;t know the context and maze of compile conditionals enough to really know how to do this properly, so meanwhile I&apos;m going to try using this attached patch in Gentoo.

Note that this patch contains changes to another file issue as well, not just GLContext.cpp, as after fixing GLContext, the build reaches the next issue there.

I&apos;m going to also have it build various different build configurations in the background on a big aarch64 box; if I don&apos;t report back here, all of those succeed with this patch included. Otherwise I&apos;ll have to update the patch to make all the build combinations we try to support work, and will post it here as well for consideration or ideas.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1652213</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-05-13 06:51:28 -0700</bug_when>
    <thetext>Please be careful when selecting Bugzilla components... if you don&apos;t select WebKitGTK, the bug is likely to be ignored.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1652218</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-05-13 07:12:55 -0700</bug_when>
    <thetext>Trying to find when this broke... I&apos;m not sure. That header was *added* to the file in r249909. Prior to that commit, it must have been included from some other header. The guards are clearly incorrect since the shims are initialized outside the USE(GLX) codepath, so your patch is an improvement at least.

(In reply to Mart Raudsepp from comment #4)
&gt; Looking into this, I found that various OpenGLShims.h usages are quite
&gt; different from each other in their conditionals. So some places assume it&apos;s
&gt; only needed for GLX, while others don&apos;t know anything about ANGLE being a
&gt; thing yet, etc.

Yeah I agree this seems to be pretty messed up. Needs to be investigated by graphics developers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1667532</commentid>
    <comment_count>7</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2020-06-30 04:26:52 -0700</bug_when>
    <thetext>(In reply to Mart Raudsepp from comment #2)
&gt; Source/WebCore/platform/graphics/GLContext.cpp is including OpenGLShims.h
&gt; only if GLX is enabled, but then using the initializeOpenGLShims function in
&gt; other cases as well. I think the preprocessor conditionals should match
&gt; better.
&gt; As-is, it seems to guarantee a fail for a -DENABLE_X11_TARGET=OFF
&gt; -DENABLE_OPENGL=ON build that picks OpenGL.

The ENABLE_OPENGL option does not exist, I suppose the idea is to end up
with USE_OPENGL=ON, which means setting ENABLE_GRAPHICS_CONTEXT_GL=ON.

So yes, I can reproduce the issue by configuring a build with:

  % cmake -DPORT=GTK -DENABLE_X11_TARGET=OFF -DENABLE_GRAPHICS_CONTEXT_GL=ON

&gt; Basically initializeOpenGLShimsIfNeeded seems to think that a EGL+full
&gt; OpenGL (instead of GLX) doesn&apos;t exist or happen, but libepoxy isn&apos;t used at
&gt; all for a webkitgtk build (I guess it might be used in webkit-wpe or
&gt; something)

The WPE port uses libepoxy, but the GTK port does not.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1667597</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2020-06-30 09:15:01 -0700</bug_when>
    <thetext>(In reply to Adrian Perez from comment #7)
&gt; The WPE port uses libepoxy, but the GTK port does not.

It&apos;s 2020, probably time to depend on libepoxy?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1739237</commentid>
    <comment_count>9</comment_count>
    <who name="EWS Watchlist">ews-watchlist</who>
    <bug_when>2021-03-14 09:34:38 -0700</bug_when>
    <thetext>Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1779326</commentid>
    <comment_count>10</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-07-24 08:41:32 -0700</bug_when>
    <thetext>Hey Adrian, I think we need someone more familiar with OpenGL to unbreak the -DENABLE_X11_TARGET=OFF builds. Any chance you could help?

(In reply to Michael Catanzaro from comment #8)
&gt; It&apos;s 2020, probably time to depend on libepoxy?

libepoxy has been around for long enough that I think it&apos;s entirely reasonable to make it a hard dep. I assume that would make things a lot simpler.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1812554</commentid>
    <comment_count>11</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2021-11-08 01:05:18 -0800</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #10)
&gt; Hey Adrian, I think we need someone more familiar with OpenGL to unbreak the
&gt; -DENABLE_X11_TARGET=OFF builds. Any chance you could help?
&gt; 
&gt; (In reply to Michael Catanzaro from comment #8)
&gt; &gt; It&apos;s 2020, probably time to depend on libepoxy?
&gt; 
&gt; libepoxy has been around for long enough that I think it&apos;s entirely
&gt; reasonable to make it a hard dep. I assume that would make things a lot
&gt; simpler.

I hadn&apos;t stepped in before because I didn&apos;t manage to reproduce the build
issue, but recently this build issue came up with 2.32.x in one of the
Buildroot autobuilders:

  http://autobuild.buildroot.net/results/2fbbf65a3dd8b6916fadb459af1b308f88b58554/

This means there we have now a build config file that can be used to trigger
this build failure deterministically. I will give it a go and see if this is
still a problem in 2.34.x and in trunk :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1812560</commentid>
    <comment_count>12</comment_count>
    <who name="Mart Raudsepp">leio</who>
    <bug_when>2021-11-08 02:39:41 -0800</bug_when>
    <thetext>In 2.34.x there&apos;s various issues with different build configurations. I&apos;m applying https://gitweb.gentoo.org/repo/gentoo.git/tree/net-libs/webkit-gtk/files/2.34.1-opengl-without-X-fixes.patch but that&apos;s not enough for all combinations. Need to start with making sure non-unity builds work and then I think there&apos;s issues with non-X and/or non-GL builds in 2.34.x.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1812565</commentid>
    <comment_count>13</comment_count>
    <who name="Mart Raudsepp">leio</who>
    <bug_when>2021-11-08 02:56:35 -0800</bug_when>
    <thetext>There are my downstream build issues of different failures from different build configurations, many can be tracked down from compilation failure, but I can help figuring out which build option triggers it too:

https://bugs.gentoo.org/819384
https://bugs.gentoo.org/820437
https://bugs.gentoo.org/820440
https://bugs.gentoo.org/820443

Some are probably OpenGL related and on-topic here, others are other issues.

I&apos;m &quot;leio&quot; on Libera and GNOME IRC if that&apos;s better medium to work together on any of these.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1841606</commentid>
    <comment_count>14</comment_count>
    <who name="Adrian Perez">aperez</who>
    <bug_when>2022-02-15 00:40:13 -0800</bug_when>
    <thetext>I believe the patch in bug #236593 should fix all the issues related
to the OpenGLShims.h header. If you still find some remaining issue
after it gets merged, please do reopen bug #236593 and let me know :)

*** This bug has been marked as a duplicate of bug 236593 ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>398939</attachid>
            <date>2020-05-09 13:46:52 -0700</date>
            <delta_ts>2020-05-09 13:46:52 -0700</delta_ts>
            <desc>Patch to make non-X EGL full OpenGL builds succeed</desc>
            <filename>2.28.2-opengl-without-X-fixes.patch</filename>
            <type>text/plain</type>
            <size>1656</size>
            <attacher name="Mart Raudsepp">leio</attacher>
            
              <data encoding="base64">RnJvbSBjNjdlZmEyYmJlMjA5NGI0MGI0ZTEwNGJiMjY0OTdjMmFmZjVjZTY4IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXJ0IFJhdWRzZXBwIDxsZWlvQGdlbnRvby5vcmc+CkRhdGU6
IFNhdCwgOSBNYXkgMjAyMCAyMzoxMTo1MiArMDMwMApTdWJqZWN0OiBbUEFUQ0hdIENsZWFuIHVw
IE9wZW5HTFNoaW1zLmggY29uZGl0aW9uYWxzIGluIGEgZmV3IHBsYWNlcyB0byBmaXgKIHNvbWUg
YnVpbGQgY29uZmlndXJhdGlvbnMKCi0tLQogU291cmNlL1dlYkNvcmUvcGxhdGZvcm0vZ3JhcGhp
Y3MvR0xDb250ZXh0LmNwcCAgICAgICAgICAgICB8IDUgKysrKy0KIFNvdXJjZS9XZWJLaXQvVUlQ
cm9jZXNzL0FQSS9nbGliL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