From a1c55db9f91047390be1606a9797bc65c1c4c3f9 Mon Sep 17 00:00:00 2001 From: Gyorgy Sarvari Date: Fri, 29 May 2026 11:49:07 +0200 Subject: [PATCH 1/2] firefox: remove hard clang dependency Firefox compiles with gcc - remove the hardcoded clang dependency. New patches freebl-ignore-unused-arguments-during-configure.patch: A component is trying to remove some gcc warnings. OE adds -Wformat-security by default, but the component also adds -Wno-format, which cancels it out, but generates a warning (which is turned into an error): cc1plus: error: '-Wformat-security' ignored without '-Wformat' [-Werror=format-security] To avoid this, the patch adds also -Wno-format-security explicitly. msgpack-enforce-endian-functionality.patch: Using gcc, the msgpack third party application can't determine the endianness of risc-v arch (at least not for qemuriscv64), failing the build. This issue has been fixed upstream a while ago, but not pulled into Firefox yet. This patch is a backport of that commit. llama.cpp-unknown-type-name-__fp16.patch: On 32-bit arm fp16 isn't defined by default. Added a patch taken from https://stackoverflow.com/questions/31242106/fp16-type-undefined-in-gnu-arm-c Signed-off-by: Gyorgy Sarvari --- .../llama.cpp-unknown-type-name-__fp16.patch | 21 ++++++++++ .../recipes-browser/firefox/firefox.inc | 7 ++-- .../firefox/firefox/fix-gcc-compilation.patch | 21 ++++++++++ ...re-unused-arguments-during-configure.patch | 2 +- ...msgpack-enforce-endian-functionality.patch | 39 +++++++++++++++++++ .../firefox/firefox_151.0.2.bb | 2 + 6 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 meta-firefox/recipes-browser/firefox/firefox-latest/llama.cpp-unknown-type-name-__fp16.patch create mode 100644 meta-firefox/recipes-browser/firefox/firefox/fix-gcc-compilation.patch create mode 100644 meta-firefox/recipes-browser/firefox/firefox/msgpack-enforce-endian-functionality.patch diff --git a/meta-firefox/recipes-browser/firefox/firefox-latest/llama.cpp-unknown-type-name-__fp16.patch b/meta-firefox/recipes-browser/firefox/firefox-latest/llama.cpp-unknown-type-name-__fp16.patch new file mode 100644 index 000000000..f9e6146ea --- /dev/null +++ b/meta-firefox/recipes-browser/firefox/firefox-latest/llama.cpp-unknown-type-name-__fp16.patch @@ -0,0 +1,21 @@ +Fixes error on 32-bit arm: + +E [...]/third_party/llama.cpp/ggml/src/ggml-cpu/simd-mappings.h:45:9: error: unknown type name '__fp16'; did you mean '__bf16'? + +Solution taken from +https://stackoverflow.com/questions/31242106/fp16-type-undefined-in-gnu-arm-c + +Upstream-Status: Pending +Signed-off-by: Gyorgy Sarvari + +--- ./third_party/llama.cpp/moz.build.orig 2026-05-30 08:47:27.294716362 +0200 ++++ ./third_party/llama.cpp/moz.build 2026-05-30 08:20:07.478595605 +0200 +@@ -45,6 +45,8 @@ + elif CONFIG['TARGET_CPU'] == 'aarch64': + SOURCES += files['ARM64_SOURCES'] + elif CONFIG['TARGET_CPU'] == 'arm': ++ CXXFLAGS += ["-mfp16-format=ieee"] ++ CFLAGS += ["-mfp16-format=ieee"] + SOURCES += files['ARM_SOURCES'] + else: + DEFINES["GGML_CPU_GENERIC"] = 1 diff --git a/meta-firefox/recipes-browser/firefox/firefox.inc b/meta-firefox/recipes-browser/firefox/firefox.inc index 95e8dd042..efd83e766 100644 --- a/meta-firefox/recipes-browser/firefox/firefox.inc +++ b/meta-firefox/recipes-browser/firefox/firefox.inc @@ -54,7 +54,6 @@ SRC_URI += "https://ftp.mozilla.org/pub/firefox/releases/${PV}/source/firefox-${ file://0001-Add-option-to-disable-arm-hw-crypto-engine.patch \ file://0001-Fix-conflicting-types-for-once_flag-and-call_once-wi.patch \ file://fix-glibc-2.43-compilation.patch \ - file://freebl-ignore-unused-arguments-during-configure.patch \ file://debian-hacks/Add-another-preferences-directory-for-applications-p.patch \ file://debian-hacks/Avoid-using-vmrs-vmsr-on-armel.patch \ file://debian-hacks/Avoid-wrong-sessionstore-data-to-keep-windows-out-of.patch \ @@ -73,6 +72,10 @@ SRC_URI += "https://ftp.mozilla.org/pub/firefox/releases/${PV}/source/firefox-${ file://prefs/Set-DPI-to-system-settings.patch \ " +SRC_URI:append:toolchain-gcc = " file://fix-gcc-compilation.patch" +SRC_URI:append:toolchain-clang = " file://freebl-ignore-unused-arguments-during-configure.patch" +SRC_URI:append:riscv64:toolchain-gcc = " file://msgpack-enforce-endian-functionality.patch" + SRCREV_FORMAT = "default" # Add a config file to enable GPU acceleration by default. @@ -92,8 +95,6 @@ SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'forbid-multiple-compositors', file://fixes/0001-Enable-to-suppress-multiple-compositors.patch \ ', '', d)}" -TOOLCHAIN:pn-firefox = "clang" - DISABLE_STATIC = "" PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "alsa", "alsa", "", d)} \ diff --git a/meta-firefox/recipes-browser/firefox/firefox/fix-gcc-compilation.patch b/meta-firefox/recipes-browser/firefox/firefox/fix-gcc-compilation.patch new file mode 100644 index 000000000..1ddf884f4 --- /dev/null +++ b/meta-firefox/recipes-browser/firefox/firefox/fix-gcc-compilation.patch @@ -0,0 +1,21 @@ +By default, OE sets "-Wformat-security" in the CFLAGS variable. +One particular module in the Firefox tree is trying to disable all +such warnings, however it doesn't disable the -Wformat-security +flag in particular, and due to this, compilation fails with the +following error: + +cc1plus: error: '-Wformat-security' ignored without '-Wformat' [-Werror=format-security] + +Add this missing warning removal to the list of ignored warnings. + +Upstream-Status: Inappropriate [oe-specific] +Signed-off-by: Gyorgy Sarvari + +--- ./js/src/xsum/moz.build.orig 2026-05-29 10:18:14.888226193 +0200 ++++ ./js/src/xsum/moz.build 2026-05-29 10:18:29.490810894 +0200 +@@ -17,4 +17,4 @@ + ] + + # Suppress warnings in third-party code. +-SOURCES['xsum.cpp'].flags += ['-Wno-implicit-fallthrough', '-Wno-format', '-Wno-unused-value'] ++SOURCES['xsum.cpp'].flags += ['-Wno-implicit-fallthrough', '-Wno-format', '-Wno-unused-value', '-Wno-format-security'] diff --git a/meta-firefox/recipes-browser/firefox/firefox/freebl-ignore-unused-arguments-during-configure.patch b/meta-firefox/recipes-browser/firefox/firefox/freebl-ignore-unused-arguments-during-configure.patch index a1dcf768a..a2e5f386c 100644 --- a/meta-firefox/recipes-browser/firefox/firefox/freebl-ignore-unused-arguments-during-configure.patch +++ b/meta-firefox/recipes-browser/firefox/firefox/freebl-ignore-unused-arguments-during-configure.patch @@ -1,4 +1,4 @@ -Clang sends warnings about unsued command line arguments to stderr during configuring +Clang sends warnings about unused command line arguments to stderr during configuring freebl (which is enabled for targets without hw crypto support). Gyp only checks if there is anything on stderr, but not the content - it throws an error like this: diff --git a/meta-firefox/recipes-browser/firefox/firefox/msgpack-enforce-endian-functionality.patch b/meta-firefox/recipes-browser/firefox/firefox/msgpack-enforce-endian-functionality.patch new file mode 100644 index 000000000..4d291a76f --- /dev/null +++ b/meta-firefox/recipes-browser/firefox/firefox/msgpack-enforce-endian-functionality.patch @@ -0,0 +1,39 @@ +From f6ddc9b85adaa58f6426544e2bd1bd16e0aecd70 Mon Sep 17 00:00:00 2001 +From: Takatoshi Kondo +Date: Sat, 8 Sep 2018 20:06:00 +0900 +Subject: [PATCH] Added enforcing endian functionality. + +Fixes error with gcc@riscv: +third_party/msgpack/include/msgpack/sysdep.h:146:5: error: #error msgpack-c supports only big endian and little endian + +Upstream-Status: Backport [https://github.com/msgpack/msgpack-c/commit/f6ddc9b85adaa58f6426544e2bd1bd16e0aecd70] +Signed-off-by: Gyorgy Sarvari + +--- + include/msgpack/sysdep.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/include/msgpack/sysdep.h b/include/msgpack/sysdep.h +index 569ae4cdf..b430956b4 100644 +--- a/third_party/msgpack/include/msgpack/sysdep.h ++++ b/third_party/msgpack/include/msgpack/sysdep.h +@@ -10,8 +10,6 @@ + #ifndef MSGPACK_SYSDEP_H + #define MSGPACK_SYSDEP_H + +-#include +- + #include + #include + +@@ -86,6 +84,10 @@ + + #endif + ++#if !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE) ++#include ++#endif // !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE) ++ + #if MSGPACK_ENDIAN_LITTLE_BYTE + + # if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__) diff --git a/meta-firefox/recipes-browser/firefox/firefox_151.0.2.bb b/meta-firefox/recipes-browser/firefox/firefox_151.0.2.bb index f9b89ce4f..8d242e83d 100644 --- a/meta-firefox/recipes-browser/firefox/firefox_151.0.2.bb +++ b/meta-firefox/recipes-browser/firefox/firefox_151.0.2.bb @@ -13,6 +13,8 @@ SRC_URI:append:libc-musl = " \ file://fix-undeclared-identifier__NR_riscv_hwprobe.patch \ " +SRC_URI:append:toolchain-gcc:arm = " file://llama.cpp-unknown-type-name-__fp16.patch" + SRC_URI[sha256sum] = "63c4267799f2618dd7ac5997d0306bbcf2a5306caaca0056795bc6c61d00f8c8" PACKAGECONFIG[legacy-appdir] = "" From c5ea867de5e25b5acfe3715d2e34378473fc4c62 Mon Sep 17 00:00:00 2001 From: Gyorgy Sarvari Date: Sat, 30 May 2026 08:58:10 +0200 Subject: [PATCH 2/2] firefox: allow limiting concurrent jobs The PARALLEL_MAKE OE variable has been ignored until now, Firefox was built with the number of jobs determined by mach (which is usually the number of CPU cores). To be able to control this number, pass the PARALLEL_MAKE variable value as a custom make flag to mach. Signed-off-by: Gyorgy Sarvari --- meta-firefox/classes/mozilla.bbclass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meta-firefox/classes/mozilla.bbclass b/meta-firefox/classes/mozilla.bbclass index 181f8c820..a83ee45ac 100644 --- a/meta-firefox/classes/mozilla.bbclass +++ b/meta-firefox/classes/mozilla.bbclass @@ -36,6 +36,8 @@ export WASM_CXX = "${WASI_SYSROOT}/bin/clang++ -target wasm32-wasip1 " export BUILD_VERBOSE_LOG = "1" +export MOZ_MAKE_FLAGS = "${PARALLEL_MAKE}" + RUST_HOST ?= "${RUST_BUILD_SYS}" RUST_TARGET ?= "${RUST_HOST_SYS}"