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 <https://gcc.gnu.org/wiki/Visibility#line-91>). 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 upstream.
Created attachment 248090 [details] www/firefox: fix build with libc++ 18
See also https://bugzilla.mozilla.org/1874059
MARKED AS SPAM
The first part is already in Firefox 123 which I'll merge early next week (as the RC drops), and at that occasion I'll lift the second part, too.
There you are: ports 7659a22057
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=560d828e45df62eb4c0e87364f36b7932b10f944 commit 560d828e45df62eb4c0e87364f36b7932b10f944 Author: Christoph Moench-Tegeder <cmt@FreeBSD.org> AuthorDate: 2024-04-18 23:03:17 +0000 Commit: Christoph Moench-Tegeder <cmt@FreeBSD.org> CommitDate: 2024-04-18 23:05:29 +0000 mail/thunderbird: fix linking with libc++18 copied from www/firefox PR: 276746 mail/thunderbird/files/patch-bug1874059 (new) | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=16543701d7d98630a94e10adeffb8785aa4aa3c9 commit 16543701d7d98630a94e10adeffb8785aa4aa3c9 Author: Christoph Moench-Tegeder <cmt@FreeBSD.org> AuthorDate: 2024-04-18 23:04:07 +0000 Commit: Christoph Moench-Tegeder <cmt@FreeBSD.org> CommitDate: 2024-04-18 23:05:29 +0000 www/firefox-esr: fix linking with libc++18 copied from www/firefox PR: 276746 www/firefox-esr/files/patch-bug1874059 (new) | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
A commit in branch 2024Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=edd17465bb010cc0cd0aff492ea657f6c90f4601 commit edd17465bb010cc0cd0aff492ea657f6c90f4601 Author: Christoph Moench-Tegeder <cmt@FreeBSD.org> AuthorDate: 2024-04-18 23:03:17 +0000 Commit: Christoph Moench-Tegeder <cmt@FreeBSD.org> CommitDate: 2024-04-18 23:06:04 +0000 mail/thunderbird: fix linking with libc++18 copied from www/firefox PR: 276746 (cherry picked from commit 560d828e45df62eb4c0e87364f36b7932b10f944) mail/thunderbird/files/patch-bug1874059 (new) | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
A commit in branch 2024Q2 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=6db914e6b2eb3721cf881a39d72fabf4ff1005ed commit 6db914e6b2eb3721cf881a39d72fabf4ff1005ed Author: Christoph Moench-Tegeder <cmt@FreeBSD.org> AuthorDate: 2024-04-18 23:04:07 +0000 Commit: Christoph Moench-Tegeder <cmt@FreeBSD.org> CommitDate: 2024-04-18 23:05:58 +0000 www/firefox-esr: fix linking with libc++18 copied from www/firefox PR: 276746 (cherry picked from commit 16543701d7d98630a94e10adeffb8785aa4aa3c9) www/firefox-esr/files/patch-bug1874059 (new) | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
(In reply to commit-hook from comment #9) Thanks for applying those patches Christoph, I had completely overlooked that these ports were also broken. Apologies!