[Bug 276746] www/firefox: fix build with libc++ 18

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 31 Jan 2024 12:11:03 UTC

            Bug ID: 276746
           Summary: www/firefox: fix build with libc++ 18
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: gecko@FreeBSD.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(gecko@FreeBSD.org)
          Assignee: gecko@FreeBSD.org

This fixes two problems in www/firefox related to libc++ 18:
* rust-bindgen problems with tuple definitions
* visibility issues caused by gcc_hidden.h

The first problem is that rust-bindgen uses some tricks to generate
bindings for C++ components, but gets confused by some new constructs in
libc++ 18 headers, causing it to generate faulty binding code.

This is described more fully in <https://bugzilla.mozilla.org/1873379>;
in the mean time, upstream committed
<https://hg.mozilla.org/mozilla-central/rev/9e96d1447f6c> to fix it.

The second problem is that the firefox build uses a rather brute force
technique to suppress visibility of unwanted symbols in their shared
libraries: they include a file config/gcc_hidden.h in front of almost
every source file.

This file contains nothing but a line containing "#pragma GCC visibility
push(hidden)", forcing everything after it to have hidden visibility.
This causes link errors with libc++ 18 and later, similar to:

  ld.lld: error: undefined hidden symbol: std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char>>::append(char const*,
unsigned long)

The issue is described more fully in
<https://github.com/llvm/llvm-project/issues/79027>, but upstream has
not been able to decide if it is really a problem on their end, or if
they want to support the use case at all.

A better way to fix this is by using the more usual -fvisibility command
line flags, which are similar in effect, but do not override extern
declarations such as the ones in libc++ headers (see also

This is achieved by patching build/moz.configure/toolchain.configure, to
use the -fvisibility=hidden and -fvisibility-inlines-hidden flags on
FreeBSD in addition to Darwin. I am considering also sending this

You are receiving this mail because:
You are the assignee for the bug.