FreeBSD Bugzilla – Attachment 248090 Details for
Bug 276746
www/firefox: fix build with libc++ 18
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
www/firefox: fix build with libc++ 18
www__firefox-fix-libc++18-1.diff (text/plain), 4.34 KB, created by
Dimitry Andric
on 2024-01-31 12:12:08 UTC
(
hide
)
Description:
www/firefox: fix build with libc++ 18
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2024-01-31 12:12:08 UTC
Size:
4.34 KB
patch
obsolete
>commit 42599e975b1d4f1e392ebb1d93b048dcc8084b4d >Author: Dimitry Andric <dim@FreeBSD.org> >Date: 2024-01-31T13:09:09+01:00 > > www/firefox: fix build with libc++ 18 > > 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. > > PR: 276746 > MFH: 2024Q1 > >diff --git a/www/firefox/files/patch-bug1873379 b/www/firefox/files/patch-bug1873379 >new file mode 100644 >index 000000000000..2859c1d1cf04 >--- /dev/null >+++ b/www/firefox/files/patch-bug1873379 >@@ -0,0 +1,21 @@ >+--- layout/style/ServoBindings.toml.orig 2024-01-08 19:43:07 UTC >++++ layout/style/ServoBindings.toml >+@@ -364,6 +364,9 @@ opaque-types = [ >+ "std::namespace::atomic___base", "std::atomic__My_base", >+ "std::atomic", >+ "std::atomic___base", >++ "std::tuple.*", # Causes "Cannot find type _Pred in this scope" error on mac, like rust-skia#571 >++ "std::.*::tuple.*", >++ >+ # We want everything but FontVariation and Float to be opaque but we don't >+ # have negative regexes. >+ "mozilla::gfx::(.{0,4}|.{6,12}|.{14,}|([^F][^o][^n][^t][^V][^a][^r][^i][^a][^t][^i][^o][^n])|([^F][^l][^o][^a][^t]))", >+@@ -389,8 +392,6 @@ opaque-types = [ >+ # for clang. >+ "mozilla::SeenPtrs", >+ "mozilla::SupportsWeakPtr", >+- "std::tuple", >+- "std::tuple_.*", # Causes "Cannot find type _Pred in this scope" error on mac, like rust-skia#571 >+ "SupportsWeakPtr", >+ "mozilla::detail::WeakReference", >+ "mozilla::WeakPtr", >diff --git a/www/firefox/files/patch-build_moz.configure_toolchain.configure b/www/firefox/files/patch-build_moz.configure_toolchain.configure >new file mode 100644 >index 000000000000..c43c972c6c1a >--- /dev/null >+++ b/www/firefox/files/patch-build_moz.configure_toolchain.configure >@@ -0,0 +1,14 @@ >+Ensure the build does not use "#pragma GCC visibility push(hidden)" before every >+.cpp file, as this no longer works correctly with libc++ 18 and later. >+ >+--- build/moz.configure/toolchain.configure.orig 2024-01-18 21:41:20.000000000 +0100 >++++ build/moz.configure/toolchain.configure 2024-01-31 11:18:04.902430000 +0100 >+@@ -2150,7 +2150,7 @@ def visibility_flags(target, env): >+ @depends(target, build_environment) >+ def visibility_flags(target, env): >+ if target.os != "WINNT": >+- if target.kernel == "Darwin": >++ if target.kernel == "Darwin" or target.kernel == "FreeBSD": >+ return ("-fvisibility=hidden", "-fvisibility-inlines-hidden") >+ return ( >+ "-I%s/system_wrappers" % os.path.join(env.dist),
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 276746
: 248090