Bug 212431 - www/firefox: Fix build with libc++ 3.9.0
Summary: www/firefox: Fix build with libc++ 3.9.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-gecko (Nobody)
URL:
Keywords: patch
Depends on:
Blocks: 212343
  Show dependency treegraph
 
Reported: 2016-09-06 20:51 UTC by Dimitry Andric
Modified: 2016-09-18 18:42 UTC (History)
3 users (show)

See Also:
jbeich: maintainer-feedback+


Attachments
Patch for mozilla bug 1245076 (3.01 KB, patch)
2016-09-06 20:51 UTC, Dimitry Andric
jbeich: maintainer-approval+
Details | Diff
Patch for mozilla bug 1269171 (9.45 KB, patch)
2016-09-06 20:51 UTC, Dimitry Andric
jbeich: maintainer-approval+
Details | Diff
Patch for mozilla bug 1268816 (3.64 KB, patch)
2016-09-07 09:55 UTC, Jan Beich
dim: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2016-09-06 20:51:13 UTC
Created attachment 174439 [details]
Patch for mozilla bug 1245076

While testing the clang390-import branch, I ran into issues building Firefox, which manifest as:

/usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/include/mozilla/mozalloc.h:184:33: error: no type named 'bad_alloc' in namespace 'std'
void* operator new(size_t size) MOZALLOC_THROW_BAD_ALLOC
                                ^~~~~~~~~~~~~~~~~~~~~~~~

Jan Beich already reported this in upstream bug 1269171 [1], and it is caused by the way the Firefox build generates its standard library wrapper headers.

To properly fix this, we need to import the fixes for both upstream bug 1245076 [2] and bug 1269171 [1].  I also had to commit an additional workaround for it in the clang390-import branch, r305496 [3].

[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1269171
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1245076
[3] https://svnweb.freebsd.org/changeset/base/305496
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2016-09-06 20:51:48 UTC
Created attachment 174440 [details]
Patch for mozilla bug 1269171
Comment 2 Jan Beich freebsd_committer freebsd_triage 2016-09-06 23:53:34 UTC
Can you confirm Firefox trunk builds fine on projects/clang390-import before r305496? If so I'd prefer to find out what fixed it before using libc++ workaround in base. Maybe you need to add type_traits into config/*-headers like Mozilla bug 1268816 did.

  1. pkg install mercurial
  2. hg clone https://hg.mozilla.org/mozilla-unified/ firefox
  3. hg up central

or if you prefer git

  1. pkg install git
  2. git clone https://github.com/mozilla/gecko-dev/ firefox

  4. cd firefox
  6. ./mach bootstrap # press 2, y, y, 2 in prompts
  7. nice ./mach build
  8. ./mach run
Comment 3 Jan Beich freebsd_committer freebsd_triage 2016-09-07 09:55:16 UTC
Created attachment 174469 [details]
Patch for mozilla bug 1268816
Comment 4 Jan Beich freebsd_committer freebsd_triage 2016-09-07 11:28:36 UTC
Comment on attachment 174439 [details]
Patch for mozilla bug 1245076

Looks fine and builds fine on 9.3R i386 and 10.1R i386.
Comment 5 Jan Beich freebsd_committer freebsd_triage 2016-09-07 11:32:41 UTC
Comment on attachment 174469 [details]
Patch for mozilla bug 1268816

Hand over to dim@ whether to land this one and back out base r305496.
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2016-09-07 17:15:47 UTC
(In reply to Jan Beich from comment #5)
> Comment on attachment 174469 [details]
> Patch for mozilla bug 1268816
> 
> Hand over to dim@ whether to land this one and back out base r305496.

I haven't tried mozilla-central yet, but www/firefox 47.0.1,2 with only patch-bug1268816, and base r305496 reverted, it still dies with:

In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/mozglue/misc/TimeStamp.cpp:11:
In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/include/mozilla/TimeStamp.h:13:
In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/include/mozilla/FloatingPoint.h:15:
In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/include/mozilla/MathAlgorithms.h:15:
In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/stl_wrappers/cmath:28:
In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/system_wrappers/new:3:
In file included from /usr/include/c++/v1/new:70:
In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/system_wrappers/exception:3:
In file included from /usr/include/c++/v1/exception:82:
In file included from /usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/stl_wrappers/type_traits:34:
/usr/work/share/dim/ports/www/firefox/work/firefox-47.0.1/obj-i386-portbld-freebsd12.0/dist/include/mozilla/mozalloc.h:184:33: error: no type named 'bad_alloc' in namespace 'std'
void* operator new(size_t size) MOZALLOC_THROW_BAD_ALLOC
                                ^~~~~~~~~~~~~~~~~~~~~~~~

So I assume we need all three patches, then?  Going to try that next.
Comment 7 Dimitry Andric freebsd_committer freebsd_triage 2016-09-07 18:00:18 UTC
Comment on attachment 174469 [details]
Patch for mozilla bug 1268816

(In reply to Dimitry Andric from comment #6)
> So I assume we need all three patches, then?  Going to try that next.

Okay, so with all three patches in files/, and base r305496 reverted, www/firefox builds to completion.  Great!
Comment 8 commit-hook freebsd_committer freebsd_triage 2016-09-07 21:47:35 UTC
A commit references this bug:

Author: dim
Date: Wed Sep  7 21:47:23 UTC 2016
New revision: 421523
URL: https://svnweb.freebsd.org/changeset/ports/421523

Log:
  Make www/firefox build with libc++ 3.9.0, by adding patches for upstream
  bugs 1245076, 1268816 and, 1269171.  Together, these solve a number of
  problems with Firefox's generated wrapper headers for the C++ standard
  library.

  Approved by:	jbeich (maintainer)
  PR:		212431

Changes:
  head/www/firefox/files/patch-bug1245076
  head/www/firefox/files/patch-bug1268816
  head/www/firefox/files/patch-bug1269171
Comment 9 Dimitry Andric freebsd_committer freebsd_triage 2016-09-07 21:49:04 UTC
Committed.  Thanks for the help, Jan!
Comment 10 commit-hook freebsd_committer freebsd_triage 2016-09-18 18:38:55 UTC
A commit references this bug:

Author: jbeich
Date: Sun Sep 18 18:38:23 UTC 2016
New revision: 422403
URL: https://svnweb.freebsd.org/changeset/ports/422403

Log:
  gecko: apply r421523 to the rest

  Bump PORTREVISION to get a clear regression window.

  PR:		212431

Changes:
  head/mail/thunderbird/Makefile
  head/mail/thunderbird/files/patch-bug1245076
  head/mail/thunderbird/files/patch-bug1268816
  head/mail/thunderbird/files/patch-bug1269171
  head/www/firefox-esr/Makefile
  head/www/firefox-esr/files/patch-bug1245076
  head/www/firefox-esr/files/patch-bug1268816
  head/www/firefox-esr/files/patch-bug1269171
  head/www/libxul/Makefile
  head/www/libxul/files/patch-bug1245076
  head/www/libxul/files/patch-bug1268816
  head/www/libxul/files/patch-bug1269171
  head/www/seamonkey/Makefile
  head/www/seamonkey/files/patch-bug1245076
  head/www/seamonkey/files/patch-bug1268816
  head/www/seamonkey/files/patch-bug1269171
Comment 11 Dimitry Andric freebsd_committer freebsd_triage 2016-09-18 18:42:55 UTC
(In reply to commit-hook from comment #10)
> A commit references this bug:
> 
> Author: jbeich
> Date: Sun Sep 18 18:38:23 UTC 2016
> New revision: 422403
> URL: https://svnweb.freebsd.org/changeset/ports/422403
> 
> Log:
>   gecko: apply r421523 to the rest
...
>   head/www/libxul/Makefile
>   head/www/libxul/files/patch-bug1245076
>   head/www/libxul/files/patch-bug1268816
>   head/www/libxul/files/patch-bug1269171

Ah, I was just about to submit a fix for libxul, but nevermind it now. :)  Thanks!