Bug 230464

Summary: www/webkit2-gtk3: fails to build with libc++ 7
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Individual Port(s)Assignee: freebsd-gnome (Nobody) <gnome>
Status: Closed FIXED    
Severity: Affects Only Me CC: dim
Priority: --- Keywords: needs-patch
Version: LatestFlags: bugzilla: maintainer-feedback? (gnome)
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230600
Bug Depends on:    
Bug Blocks: 230355    
Attachments:
Description Flags
Stop Optional.h from defining its own bad_optional_access none

Description Jan Beich freebsd_committer freebsd_triage 2018-08-08 17:28:54 UTC
$ poudriere jail -cj clang7 -a amd64 -v projects/clang700-import -m svn+https
$ poudriere testport -j clang7 www/webkit2-gtk3
[...]
In file included from Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp:28:
In file included from Source/JavaScriptCore/bytecode/ArrayProfile.h:29:
In file included from Source/JavaScriptCore/runtime/Structure.h:28:
In file included from Source/JavaScriptCore/runtime/ClassInfo.h:25:
In file included from Source/JavaScriptCore/interpreter/CallFrame.h:30:
In file included from Source/JavaScriptCore/runtime/VM.h:40:
In file included from Source/JavaScriptCore/runtime/FunctionHasExecutedCache.h:28:
In file included from /usr/include/c++/v1/unordered_map:385:
In file included from /usr/include/c++/v1/__node_handle:16:
/usr/include/c++/v1/optional:171:29: error: redefinition of 'bad_optional_access'
class _LIBCPP_EXCEPTION_ABI bad_optional_access
                            ^
DerivedSources/ForwardingHeaders/wtf/Optional.h:295:7: note: previous definition is here
class bad_optional_access : public std::logic_error {
      ^

build log: https://ptpb.pw/GBGh
Comment 1 Jan Beich freebsd_committer freebsd_triage 2018-08-08 17:33:36 UTC
Regressed by https://reviews.llvm.org/rL338472 likely due to #include <optional>
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2018-08-22 06:00:07 UTC
Created attachment 196436 [details]
Stop Optional.h from defining its own bad_optional_access

I tried making webkit use libc++'s <optional> header, but it is too reliant on internal details of its own implementation.  Maybe that will be fixed by upstream at some later point, and when they switch to C++17. :)

In any case, I've attempted to work around the error by simply not defining bad_optional_access in Optional.h, if libc++ 7.0.0 is used.  This makes the port build for me.
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-08-22 19:38:22 UTC
A commit references this bug:

Author: jbeich
Date: Wed Aug 22 19:38:09 UTC 2018
New revision: 477812
URL: https://svnweb.freebsd.org/changeset/ports/477812

Log:
  www/webkit2-gtk3, java/openjfx8-devel: unbreak with libc++ 7

  In file included from Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp:28:
  In file included from Source/JavaScriptCore/bytecode/ArrayProfile.h:29:
  In file included from Source/JavaScriptCore/runtime/Structure.h:28:
  In file included from Source/JavaScriptCore/runtime/ClassInfo.h:25:
  In file included from Source/JavaScriptCore/interpreter/CallFrame.h:30:
  In file included from Source/JavaScriptCore/runtime/VM.h:40:
  In file included from Source/JavaScriptCore/runtime/FunctionHasExecutedCache.h:28:
  In file included from /usr/include/c++/v1/unordered_map:385:
  In file included from /usr/include/c++/v1/__node_handle:16:
  /usr/include/c++/v1/optional:171:29: error: redefinition of 'bad_optional_access'
  class _LIBCPP_EXCEPTION_ABI bad_optional_access
                              ^
  DerivedSources/ForwardingHeaders/wtf/Optional.h:295:7: note: previous definition is here
  class bad_optional_access : public std::logic_error {
        ^

  PR:		230464 230600
  Submitted by:	dim

Changes:
  head/java/openjfx8-devel/files/patch-modules_web_src_main_native_Source_WTF_wtf_Optional.h
  head/www/webkit2-gtk3/files/patch-Source_WTF_wtf_Optional.h