Bug 162261

Summary: [GTK] webkit-2.14.0 fails to build with clang/libc++ due to std::function usage
Product: WebKit Reporter: Jeremy Huddleston Sequoia <jeremyhu>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, commit-queue, krejzi, mcatanzaro
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=146574
Attachments:
Description Flags
0001-GTK-Fix-build-failure-in-clipboard-support
none
0001-GTK-Fix-build-failure-in-clipboard-support
achristensen: review-, achristensen: commit-queue-
0001-GTK-Fix-build-failure-in-clipboard-support none

Description Jeremy Huddleston Sequoia 2016-09-20 02:30:24 PDT
2.14.0 fails to build.  2.13.91 built fine.  I didn't get a chance to test 2.13.92 in the few days it was available before 2.14.0 was released.

webkitgtk-2.14.0/Source/WebCore/platform/gtk/PasteboardHelper.h:49:75: error: no type named 'function' in namespace 'std'
    void writeClipboardContents(GtkClipboard*, const DataObjectGtk&, std::function<void()>&& primarySelectionCleared = nullptr);
                                                                     ~~~~~^
webkitgtk-2.14.0/Source/WebCore/platform/gtk/PasteboardHelper.h:49:83: error: expected ')'
    void writeClipboardContents(GtkClipboard*, const DataObjectGtk&, std::function<void()>&& primarySelectionCleared = nullptr);
                                                                                  ^
webkitgtk-2.14.0/Source/WebCore/platform/gtk/PasteboardHelper.h:49:32: note: to match this '('
    void writeClipboardContents(GtkClipboard*, const DataObjectGtk&, std::function<void()>&& primarySelectionCleared = nullptr);
                               ^

It looks like this regressed last week with:

commit e49e53a12bad70cca80c704e8ee2521dfd759d2c
Author: commit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Sep 14 16:45:48 2016 +0000

    [GTK][Wayland] Implement clipboard support
    https://bugs.webkit.org/show_bug.cgi?id=146574
    
    Patch by Carlos Garnacho <carlosg@gnome.org> on 2016-09-14
    Reviewed by Carlos Garcia Campos.
Comment 1 Jeremy Huddleston Sequoia 2016-09-20 02:43:35 PDT
We're building with recent libc++ and -std=c++1y.  It looked like maybe a missing include of <functional>, but that's not it.

My C++ is a bit on the weak side, but I'll try to dig into it when I get some cycles.
Comment 2 Carlos Garcia Campos 2016-09-20 06:36:58 PDT
I guess you are building on Mac, right?
Comment 3 Carlos Garcia Campos 2016-09-20 08:31:24 PDT
*** Bug 162268 has been marked as a duplicate of this bug. ***
Comment 4 Armin K. 2016-09-20 08:34:23 PDT
To note what I said in bug that was marked as duplicate of this one:

Solution was to add #include <functional> to Source/WebCore/platform/gtk/PasteboardHelper.h and Source/WebCore/platform/PlatformPasteboard.h
Comment 5 Jeremy Huddleston Sequoia 2016-09-20 10:12:57 PDT
Thanks Armin, I added that to Source/WebCore/platform/gtk/PasteboardHelper.h but not Source/WebCore/platform/PlatformPasteboard.h.  That seems to address the issue for me (although we did hit another build failure after that, which I have a fix for as well).  I'll get patches added.
Comment 6 Jeremy Huddleston Sequoia 2016-09-20 10:51:45 PDT
Created attachment 289381 [details]
0001-GTK-Fix-build-failure-in-clipboard-support
Comment 7 WebKit Commit Bot 2016-09-20 10:53:51 PDT
Attachment 289381 [details] did not pass style-queue:


ERROR: Source/WebCore/ChangeLog:8:  You should remove the 'No new tests' and either add and list tests, or explain why no new tests were possible.  [changelog/nonewtests] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Jeremy Huddleston Sequoia 2016-09-20 11:11:09 PDT
Created attachment 289388 [details]
0001-GTK-Fix-build-failure-in-clipboard-support
Comment 9 Alex Christensen 2016-09-20 11:51:34 PDT
Comment on attachment 289388 [details]
0001-GTK-Fix-build-failure-in-clipboard-support

The include should go just before the first #include <wtf/...> in these cases to comply with WebKit alphabetization rules.
Comment 10 Michael Catanzaro 2016-09-20 12:24:11 PDT
EWS says:

Parsed 3 diffs from patch file(s).
patching file Source/WebCore/ChangeLog
patch: **** malformed patch at line 32:
Comment 11 Jeremy Huddleston Sequoia 2016-09-20 23:34:46 PDT
Created attachment 289434 [details]
0001-GTK-Fix-build-failure-in-clipboard-support
Comment 12 Jeremy Huddleston Sequoia 2016-09-20 23:35:09 PDT
(In reply to comment #9)
> The include should go just before the first #include <wtf/...> in these
> cases to comply with WebKit alphabetization rules.

Done, thanks.
Comment 13 Carlos Garcia Campos 2016-09-20 23:50:19 PDT
Comment on attachment 289434 [details]
0001-GTK-Fix-build-failure-in-clipboard-support

Thanks!
Comment 14 WebKit Commit Bot 2016-09-21 00:11:44 PDT
Comment on attachment 289434 [details]
0001-GTK-Fix-build-failure-in-clipboard-support

Clearing flags on attachment: 289434

Committed r206200: <http://trac.webkit.org/changeset/206200>
Comment 15 WebKit Commit Bot 2016-09-21 00:11:49 PDT
All reviewed patches have been landed.  Closing bug.