Firefox Build Compatibility Issues with LLVM 21.1.x
Categories
(Core :: General, enhancement)
Tracking
()
People
(Reporter: cabronito, Unassigned)
References
(Blocks 1 open bug)
Details
Steps to reproduce:
Firefox fails to build with LLVM 21.1.0-rc1 due to multiple C++ template compatibility issues in bindgen-generated code and vendored libraries. Build reaches 58% completion before failing.
Environment:
- macOS 15.0 (Sequoia)
- Apple M4 MacBook Pro
- LLVM 21.1.0-rc1 compiled with PGO optimizations
- Firefox source from mozilla-central
Build Configuration:
# .mozconfig
ac_add_options --enable-application=browser
ac_add_options --target=aarch64-apple-darwin
ac_add_options --host=aarch64-apple-darwin
ac_add_options --enable-release
ac_add_options --enable-lto=cross
ac_add_options --enable-optimize="-O3 -mcpu=apple-m4 -pipe"
ac_add_options --enable-macos-target=15.0
ac_add_options --disable-warnings-as-errors
export RUSTFLAGS="-Ctarget-cpu=apple-m4 -Copt-level=3 -Clinker-plugin-lto -Ccodegen-units=1"
export CC="/opt/llvm-21.1.0-rc1/bin/clang"
export CXX="/opt/llvm-21.1.0-rc1/bin/clang++"
Reproduction:
./mach build
ATTEMPTS TO RESOLVE
1. Style Crate bindgen Issues
Error:
error[E0412]: cannot find type `invoke_result_t` in module `root::std::__1`
--> gecko/structs.rs:51072:29
|
51072 | root::std::__1::invoke_result_t<ResolveFunction, ResolveValueT>;
| ^^^^^^^^^^^^^^^ not found in `root::std::__1`
Attempted Fix:
Added to layout/style/ServoBindings.toml:
hide-types = [
".*__invoke_result_t.*",
".*invoke_result_t.*",
".*invoke_result.*",
# ... existing entries
]
Result: Partial success but std::invoke_result_t still leaks through in some contexts.
2. Gecko Profiler bindgen Issues
Error:
error[E0412]: cannot find type `_CharT` in this scope
error[E0412]: cannot find type `_Traits` in this scope
error[E0109]: type arguments are not allowed on builtin type `u8`
Successful Fix:
Added to tools/profiler/rust-api/build.rs:
.blocklist_type(".*basic_string_view.*")
.opaque_type(".*basic_string_view.*")
.blocklist_type("std::.*basic_string_view.*")
.opaque_type("std::.*basic_string_view.*")
.blocklist_type("std::__1::basic_string_view.*")
.opaque_type("std::__1::basic_string_view.*")
.blocklist_type(".*basic_string___self_view.*")
Result: Successfully resolved gecko-profiler compilation.
3. Highway SIMD Library Issues
Error:
error: no type named 'type' in 'hwy::EnableIfT<false>'
error: call to 'Combine' is ambiguous
Context: Located in third_party/highway/hwy/ops/arm_neon-inl.h - appears to be template SFINAE compatibility issues with LLVM 21's stricter template resolution.
Actual results:
- bindgen Template Handling: LLVM 21's libc++ uses more complex template metaprogramming that bindgen cannot parse reliably
- std::invoke_result_t Incompatibility: This C++17 template is problematic across multiple Firefox components
- Vendored Library Issues: Highway SIMD library has template compatibility problems with LLVM 21
- Successful Partial Build: 58% completion achieved, indicating most compatibility issues are solvable
Expected results:
REQUESTED ACTION
- Update bindgen Configuration: Comprehensive audit of all bindgen .toml files to hide problematic LLVM 21 template types
- Highway Library Update: Coordinate with upstream Highway project for LLVM 21 compatibility
- Template Compatibility Strategy: Develop systematic approach for handling newer C++ standard library templates in bindgen
- CI Testing: Add LLVM 21 compatibility testing to catch these issues early
Specific Files Needing Attention:
layout/style/ServoBindings.toml- needs stronger invoke_result_t blockingthird_party/highway/- needs upstream compatibility fixes- All bindgen build.rs files - systematic template hiding audit needed
Severity: This will block Firefox adoption of LLVM 21 when it reaches stable release.
Updated•6 months ago
|
Updated•6 months ago
|
Description
•