Bug 175125

Summary: [GTK][WPE] CFLAGS from pkg-config for (E)GL are not passed to WebKit
Product: WebKit Reporter: Adrian Perez <aperez>
Component: WebKitGTKAssignee: Carlos Alberto Lopez Perez <clopez>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, beidson, bugs-noreply, cgarcia, clopez, commit-queue, darin, mcatanzaro, youennf, ysuzuki, zan
Priority: P2    
Version: Other   
Hardware: All   
OS: Linux   
See Also: https://bugs.webkit.org/show_bug.cgi?id=145408
https://bugs.webkit.org/show_bug.cgi?id=178081
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Adrian Perez 2017-08-03 03:56:15 PDT
For example, in “FindEGL.cmake”, the “Cflags” field from “egl.pc” is stored
in the “${EGL_DEFINITIONS}” CMake variable, which is used to pass the flags
to WebCore, but the value is never passed to WebKit, and building WebKit can
fail. One such case is when building in a Wayland-only system (no X11 support),
where Mesa's “egl.pc” contains “-DMESA_EGL_NO_X11_HEADERS”, but not passing
that when building WebKit causes Mesa's “eglplatform.h” to try to include the
X11 headers — and the build fails.
Comment 1 Adrian Perez 2017-08-03 03:57:23 PDT
Carlos López has posted a working patch at http://sprunge.us/aUhc
Comment 2 Carlos Alberto Lopez Perez 2017-08-06 14:51:00 PDT
Created attachment 317384 [details]
Patch
Comment 3 Michael Catanzaro 2017-08-06 16:05:28 PDT
Comment on attachment 317384 [details]
Patch

CMake is so fragile. How could this happen. :(
Comment 4 Michael Catanzaro 2017-08-06 16:05:58 PDT
I mean, the fact that it has been possible to build at all, for years, without the right flags being passed... that is surprising.
Comment 5 WebKit Commit Bot 2017-08-06 16:35:02 PDT
Comment on attachment 317384 [details]
Patch

Clearing flags on attachment: 317384

Committed r220326: <http://trac.webkit.org/changeset/220326>
Comment 6 WebKit Commit Bot 2017-08-06 16:35:03 PDT
All reviewed patches have been landed.  Closing bug.
Comment 7 Carlos Alberto Lopez Perez 2017-08-06 17:21:38 PDT
(In reply to Michael Catanzaro from comment #4)
> I mean, the fact that it has been possible to build at all, for years,
> without the right flags being passed... that is surprising.

Two things explains this:

* The default build (with Mesa as GL library and with X11 support built into Mesa's EGL) works fine without passing any cflag. You only run into this failure if your GL library requires some cflag to build. Requiring this is the exception rather than the norm. I have only seen this with the Freescale GL libraries (Vivante) or when you disable the X11 support when building Mesa's EGL libraries  (as Adrian comments).

* When we landed r184954 <https://trac.webkit.org/r184954>, we didn't used any  (E)GL function on the UIProcess, so it was not needed to add this there at that time. Only in WebCore was needed by then.
Comment 8 Carlos Alberto Lopez Perez 2017-08-07 02:54:01 PDT
Committed r220331: <http://trac.webkit.org/changeset/220331>
Comment 9 Zan Dobersek 2017-08-07 03:33:47 PDT
Comment on attachment 317384 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317384&action=review

> Source/WebKit/CMakeLists.txt:97
> +    if (USE_OPENGL)

This doesn't account for libepoxy, where OPENGL and EGL packages aren't leveraged.

> Source/WebKit/CMakeLists.txt:127
>      list(APPEND WebKit2_INCLUDE_DIRECTORIES
>          "${THIRDPARTY_DIR}/ANGLE"
>          "${THIRDPARTY_DIR}/ANGLE/include/KHR"

We shouldn't be using ANGLE headers in the first place.
Comment 10 Zan Dobersek 2017-08-07 03:56:09 PDT
Comment on attachment 317384 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=317384&action=review

>> Source/WebKit/CMakeLists.txt:127
>>          "${THIRDPARTY_DIR}/ANGLE/include/KHR"
> 
> We shouldn't be using ANGLE headers in the first place.

... but it's apparently needed due to indirect GraphicsContext3D.h inclusions. This should be addressed later then, after GC3D usage cleanup.
Comment 11 Carlos Alberto Lopez Perez 2017-08-07 03:58:10 PDT
(In reply to Zan Dobersek from comment #9)
> Comment on attachment 317384 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=317384&action=review
> 
> > Source/WebKit/CMakeLists.txt:97
> > +    if (USE_OPENGL)
> 
> This doesn't account for libepoxy, where OPENGL and EGL packages aren't
> leveraged.
> 

Good catch. I didn't realized about libepoxy. Let's re-open.

> > Source/WebKit/CMakeLists.txt:127
> >      list(APPEND WebKit2_INCLUDE_DIRECTORIES
> >          "${THIRDPARTY_DIR}/ANGLE"
> >          "${THIRDPARTY_DIR}/ANGLE/include/KHR"
> 
> We shouldn't be using ANGLE headers in the first place.

That was already there before, I didn't introduced this include of the ANGLE headers.
Comment 12 Carlos Alberto Lopez Perez 2017-08-07 04:00:57 PDT
Reopen
Comment 13 Carlos Alberto Lopez Perez 2017-08-07 04:29:50 PDT
Created attachment 317412 [details]
Patch
Comment 14 Carlos Alberto Lopez Perez 2017-08-07 04:32:41 PDT
Created attachment 317413 [details]
Patch
Comment 15 Carlos Alberto Lopez Perez 2017-08-07 04:34:51 PDT
Created attachment 317414 [details]
Patch

fix typo on changelog
Comment 16 Michael Catanzaro 2017-08-07 07:05:39 PDT
Comment on attachment 317412 [details]
Patch

The ChangeLog is messed up and all EWS are red....
Comment 17 Carlos Alberto Lopez Perez 2017-08-07 07:19:27 PDT
(In reply to Michael Catanzaro from comment #16)
> Comment on attachment 317412 [details]
> Patch
> 
> The ChangeLog is messed up and all EWS are red....

Why do you comment on an obsoleted attachment?

please see https://bugs.webkit.org/attachment.cgi?id=317414&action=review
Comment 18 Michael Catanzaro 2017-08-07 08:14:43 PDT
Comment on attachment 317414 [details]
Patch

I'm bad at Bugzilla! Much better.
Comment 19 WebKit Commit Bot 2017-08-07 08:44:17 PDT
Comment on attachment 317414 [details]
Patch

Clearing flags on attachment: 317414

Committed r220334: <http://trac.webkit.org/changeset/220334>
Comment 20 WebKit Commit Bot 2017-08-07 08:44:19 PDT
All reviewed patches have been landed.  Closing bug.