Bug 147559

Summary: [GTK] r186800 broke the build on Ubuntu 14.04
Product: WebKit Reporter: Csaba Osztrogonác <ossy>
Component: New BugsAssignee: Michael Catanzaro <mcatanzaro>
Status: RESOLVED FIXED    
Severity: Normal CC: cgarcia, clopez, commit-queue, mcatanzaro, mrobinson, ossy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 146057    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Csaba Osztrogonác 2015-08-03 08:38:37 PDT
After http://trac.webkit.org/changeset/186800 I got the following
build error on my Ubuntu 14.04 (with Clang 3.5 compiler)

-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
CMake Error at Source/cmake/OptionsGTK.cmake:423 (message):
  Recompile GTK+ with Wayland backend to use ENABLE_WAYLAND_TARGET
Call Stack (most recent call first):
  CMakeLists.txt:164 (include)


-- Configuring incomplete, errors occurred!
See also "/home/webkit/WebKit/WebKitBuild/Release/CMakeFiles/CMakeOutput.log".
See also "/home/webkit/WebKit/WebKitBuild/Release/CMakeFiles/CMakeError.log".


It seems GTK3_SUPPORTS_WAYLAND is false for some reason. Is 
it possible to make the build work or should I disable Wayland?
Comment 1 Carlos Garcia Campos 2015-08-03 08:51:54 PDT
So, ubuntu builds GTK+ without wayland support, I guess we should detect that. We can get that info from the targets variable of the pkg-config file.
Comment 2 Csaba Osztrogonác 2015-08-03 10:36:02 PDT
One more thing, I tested the build on Ubuntu 15.04 too, the build works fine.
Comment 3 Michael Catanzaro 2015-08-03 13:19:14 PDT
(In reply to comment #1)
> So, ubuntu builds GTK+ without wayland support, I guess we should detect
> that.

That's what we were doing until r185788 when I intentionally removed that behavior. I somewhat prefer requiring the user to explicitly disable the Wayland backend. But I think it's reasonable to autodetect it, since there's no way autodetection could cause the feature to be disabled accidentally; if your GTK+ has no Wayland support then you really don't need WebKitGTK+ to have it either. The same argument could be made to support how we currently handle CairoGL.
Comment 4 Michael Catanzaro 2015-08-03 13:24:30 PDT
(In reply to comment #1)
> We can get that info from the targets variable of the pkg-config file.

You already have GTK3_SUPPORTS_X11 and GTK3_SUPPORTS_WAYLAND, so the thing to do is to check them and set ENABLE_X11_TARGET and ENABLE_WAYLAND_TARGET accordingly. This has to be done after calling find_package(GTK3) and *before* calling WEBKIT_OPTION_END. This will require dropping the required GTK+ version from the call to find_package, since it's not possible to know until after WEBKIT_OPTION_END, and then checking it manually in an if statement using the VERSION_LESS operator after WEBKIT_OPTION_END.
Comment 5 Carlos Garcia Campos 2015-08-03 22:28:37 PDT
(In reply to comment #4)
> (In reply to comment #1)
> > We can get that info from the targets variable of the pkg-config file.
> 
> You already have GTK3_SUPPORTS_X11 and GTK3_SUPPORTS_WAYLAND, so the thing
> to do is to check them and set ENABLE_X11_TARGET and ENABLE_WAYLAND_TARGET
> accordingly. This has to be done after calling find_package(GTK3) and
> *before* calling WEBKIT_OPTION_END. This will require dropping the required
> GTK+ version from the call to find_package, since it's not possible to know
> until after WEBKIT_OPTION_END, and then checking it manually in an if
> statement using the VERSION_LESS operator after WEBKIT_OPTION_END.

Could you write a patch instead of telling us how to do it? :-)
Comment 6 Michael Catanzaro 2015-08-04 05:38:54 PDT
Of course :) but you have to wait until my trip is done; if you get impatient, there is your solution.
Comment 7 Carlos Alberto Lopez Perez 2015-08-17 15:46:03 PDT
(In reply to comment #0)
> After http://trac.webkit.org/changeset/186800 I got the following
> build error on my Ubuntu 14.04 (with Clang 3.5 compiler)
> 
> -- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
> CMake Error at Source/cmake/OptionsGTK.cmake:423 (message):
>   Recompile GTK+ with Wayland backend to use ENABLE_WAYLAND_TARGET
> Call Stack (most recent call first):
>   CMakeLists.txt:164 (include)
> 
> 
> -- Configuring incomplete, errors occurred!
> See also
> "/home/webkit/WebKit/WebKitBuild/Release/CMakeFiles/CMakeOutput.log".
> See also "/home/webkit/WebKit/WebKitBuild/Release/CMakeFiles/CMakeError.log".
> 
> 
> It seems GTK3_SUPPORTS_WAYLAND is false for some reason. Is 
> it possible to make the build work or should I disable Wayland?

I think this may get fixed just by doing:

$ rm -fr WebKitBuild
$ Tools/gtk/install-dependencies
$ Tools/Scripts/update-webkitgtk-libs

We ship GTK+-3.16 on the JHBuild, but the Wayland headers have to be installed _before_ building the GTK+ we ship in the JHBuild. Otherwise the configure script of GTK+ will disable the support for wayland.
Comment 8 Michael Catanzaro 2015-08-22 09:04:35 PDT
(In reply to comment #7)
> I think this may get fixed just by doing:
> 
> $ rm -fr WebKitBuild
> $ Tools/gtk/install-dependencies
> $ Tools/Scripts/update-webkitgtk-libs
> 
> We ship GTK+-3.16 on the JHBuild, but the Wayland headers have to be
> installed _before_ building the GTK+ we ship in the JHBuild. Otherwise the
> configure script of GTK+ will disable the support for wayland.

This was a one-time issue caused by running install-dependencies before Wayland support was added. I don't think we need to change anything here. But I will change PlatformGTK.cmake to allow automagic detection of X11/Wayland support.
Comment 9 Csaba Osztrogonác 2015-08-24 02:02:42 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > I think this may get fixed just by doing:
> > 
> > $ rm -fr WebKitBuild
> > $ Tools/gtk/install-dependencies
> > $ Tools/Scripts/update-webkitgtk-libs
> > 
> > We ship GTK+-3.16 on the JHBuild, but the Wayland headers have to be
> > installed _before_ building the GTK+ we ship in the JHBuild. Otherwise the
> > configure script of GTK+ will disable the support for wayland.
> 
> This was a one-time issue caused by running install-dependencies before
> Wayland support was added. I don't think we need to change anything here.
> But I will change PlatformGTK.cmake to allow automagic detection of
> X11/Wayland support.

Unfortunately it didn't fix the issue for me, GTK is 
still built without Wayland support for some reason.

...
checking for wayland-scanner... /usr/bin/wayland-scanner
checking for WAYLAND_DEPENDENCIES... no
...
        GTK+ 3.16.4
        ===========

        GDK backends:         x11
        X11 extensions:       XKB Xinerama XI2.2 XRANDR XFIXES Composite DAMAGE
        Print backends:       file lpr
        Dynamic modules:      yes
        Included immodules:   none
        colord support:       no
        libcanberra support:  no
        Introspection:        yes
        Debugging:            minimum
        Documentation:        no
...

GTK's config.log
-----------------
...
configure:20330: checking for wayland-scanner
configure:20348: found /usr/bin/wayland-scanner
configure:20361: result: /usr/bin/wayland-scanner
configure:20370: $PKG_CONFIG --exists --print-errors "$WAYLAND_DEPENDENCIES"
Requested 'wayland-client >= 1.5.91' but version of Wayland Client is 1.4.0
Requested 'wayland-cursor >= 1.5.91' but version of Wayland Cursor is 1.4.0
configure:20373: $? = 1
configure:20379: checking for WAYLAND_DEPENDENCIES
configure:20386: result: no
...

It seems the problem is that 14.04 ships older wayland than GTK+ need.
Comment 10 Michael Catanzaro 2015-08-24 11:47:13 PDT
Created attachment 259760 [details]
Patch
Comment 11 Michael Catanzaro 2015-08-24 11:48:01 PDT
(Please do test on Ubuntu; I have not built GTK+ without the Wayland backend.)
Comment 12 Csaba Osztrogonác 2015-08-24 11:53:48 PDT
(In reply to comment #11)
> (Please do test on Ubuntu; I have not built GTK+ without the Wayland
> backend.)

thanks, will check tomorrow
Comment 13 Csaba Osztrogonác 2015-08-25 03:33:59 PDT
Comment on attachment 259760 [details]
Patch

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

> Source/cmake/OptionsGTK.cmake:80
> -WEBKIT_OPTION_DEFINE(ENABLE_X11_TARGET "Whether to enable support for the X11 windowing target." PUBLIC ON)
> -WEBKIT_OPTION_DEFINE(ENABLE_WAYLAND_TARGET "Whether to enable support for the Wayland windowing target." PUBLIC ON)
> +WEBKIT_OPTION_DEFINE(ENABLE_X11_TARGET "Whether to enable support for the X11 windowing target." PUBLIC ${ENABLE_X11_TARGET_DEFAULT})
> +WEBKIT_OPTION_DEFINE(ENABLE_WAYLAND_TARGET "Whether to enable support for the Wayland windowing target." PUBLIC ${ENABLE_WAYLAND_TARGET_DEFAULT})

I got the following error:

CMake Error at Source/cmake/OptionsGTK.cmake:80 (WEBKIT_OPTION_DEFINE):
  WEBKIT_OPTION_DEFINE Macro invoked with incorrect arguments for macro
  named: WEBKIT_OPTION_DEFINE

It seems ENABLE_WAYLAND_TARGET_DEFAULT is empty here and not OFF.
Comment 14 Michael Catanzaro 2015-08-25 09:09:05 PDT
Created attachment 259851 [details]
Patch
Comment 15 Michael Catanzaro 2015-08-25 09:09:43 PDT
(Again, please test this on Ubuntu.)
Comment 16 Csaba Osztrogonác 2015-08-25 09:27:22 PDT
(In reply to comment #15)
> (Again, please test this on Ubuntu.)

I got the following build error:

../../Source/WebCore/platform/graphics/PlatformDisplay.cpp:69:5: error: unknown type name 'GdkDisplay'
    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
    ^
../../Source/WebCore/platform/graphics/PlatformDisplay.cpp:69:67: error: use of undeclared identifier 'gdk_display_manager_get'
    GdkDisplay* display = gdk_display_manager_get_default_display(gdk_display_manager_get());
Comment 17 Michael Catanzaro 2015-08-25 09:34:32 PDT
Created attachment 259853 [details]
Patch
Comment 18 Csaba Osztrogonác 2015-08-25 10:20:39 PDT
(In reply to comment #17)
> Created attachment 259853 [details]
> Patch

It builds fine for me on 14.04.
Comment 19 WebKit Commit Bot 2015-08-25 12:13:55 PDT
Comment on attachment 259853 [details]
Patch

Clearing flags on attachment: 259853

Committed r188929: <http://trac.webkit.org/changeset/188929>
Comment 20 WebKit Commit Bot 2015-08-25 12:14:04 PDT
All reviewed patches have been landed.  Closing bug.