Skip to content

Commit a1c55db

Browse files
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 <skandigraun@gmail.com>
1 parent 24108b8 commit a1c55db

6 files changed

Lines changed: 88 additions & 4 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Fixes error on 32-bit arm:
2+
3+
E [...]/third_party/llama.cpp/ggml/src/ggml-cpu/simd-mappings.h:45:9: error: unknown type name '__fp16'; did you mean '__bf16'?
4+
5+
Solution taken from
6+
https://stackoverflow.com/questions/31242106/fp16-type-undefined-in-gnu-arm-c
7+
8+
Upstream-Status: Pending
9+
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
10+
11+
--- ./third_party/llama.cpp/moz.build.orig 2026-05-30 08:47:27.294716362 +0200
12+
+++ ./third_party/llama.cpp/moz.build 2026-05-30 08:20:07.478595605 +0200
13+
@@ -45,6 +45,8 @@
14+
elif CONFIG['TARGET_CPU'] == 'aarch64':
15+
SOURCES += files['ARM64_SOURCES']
16+
elif CONFIG['TARGET_CPU'] == 'arm':
17+
+ CXXFLAGS += ["-mfp16-format=ieee"]
18+
+ CFLAGS += ["-mfp16-format=ieee"]
19+
SOURCES += files['ARM_SOURCES']
20+
else:
21+
DEFINES["GGML_CPU_GENERIC"] = 1

meta-firefox/recipes-browser/firefox/firefox.inc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ SRC_URI += "https://ftp.mozilla.org/pub/firefox/releases/${PV}/source/firefox-${
5454
file://0001-Add-option-to-disable-arm-hw-crypto-engine.patch \
5555
file://0001-Fix-conflicting-types-for-once_flag-and-call_once-wi.patch \
5656
file://fix-glibc-2.43-compilation.patch \
57-
file://freebl-ignore-unused-arguments-during-configure.patch \
5857
file://debian-hacks/Add-another-preferences-directory-for-applications-p.patch \
5958
file://debian-hacks/Avoid-using-vmrs-vmsr-on-armel.patch \
6059
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-${
7372
file://prefs/Set-DPI-to-system-settings.patch \
7473
"
7574

75+
SRC_URI:append:toolchain-gcc = " file://fix-gcc-compilation.patch"
76+
SRC_URI:append:toolchain-clang = " file://freebl-ignore-unused-arguments-during-configure.patch"
77+
SRC_URI:append:riscv64:toolchain-gcc = " file://msgpack-enforce-endian-functionality.patch"
78+
7679
SRCREV_FORMAT = "default"
7780

7881
# Add a config file to enable GPU acceleration by default.
@@ -92,8 +95,6 @@ SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'forbid-multiple-compositors',
9295
file://fixes/0001-Enable-to-suppress-multiple-compositors.patch \
9396
', '', d)}"
9497

95-
TOOLCHAIN:pn-firefox = "clang"
96-
9798
DISABLE_STATIC = ""
9899

99100
PACKAGECONFIG ??= "${@bb.utils.contains("DISTRO_FEATURES", "alsa", "alsa", "", d)} \
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
By default, OE sets "-Wformat-security" in the CFLAGS variable.
2+
One particular module in the Firefox tree is trying to disable all
3+
such warnings, however it doesn't disable the -Wformat-security
4+
flag in particular, and due to this, compilation fails with the
5+
following error:
6+
7+
cc1plus: error: '-Wformat-security' ignored without '-Wformat' [-Werror=format-security]
8+
9+
Add this missing warning removal to the list of ignored warnings.
10+
11+
Upstream-Status: Inappropriate [oe-specific]
12+
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
13+
14+
--- ./js/src/xsum/moz.build.orig 2026-05-29 10:18:14.888226193 +0200
15+
+++ ./js/src/xsum/moz.build 2026-05-29 10:18:29.490810894 +0200
16+
@@ -17,4 +17,4 @@
17+
]
18+
19+
# Suppress warnings in third-party code.
20+
-SOURCES['xsum.cpp'].flags += ['-Wno-implicit-fallthrough', '-Wno-format', '-Wno-unused-value']
21+
+SOURCES['xsum.cpp'].flags += ['-Wno-implicit-fallthrough', '-Wno-format', '-Wno-unused-value', '-Wno-format-security']

meta-firefox/recipes-browser/firefox/firefox/freebl-ignore-unused-arguments-during-configure.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Clang sends warnings about unsued command line arguments to stderr during configuring
1+
Clang sends warnings about unused command line arguments to stderr during configuring
22
freebl (which is enabled for targets without hw crypto support). Gyp only checks
33
if there is anything on stderr, but not the content - it throws an error like this:
44

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From f6ddc9b85adaa58f6426544e2bd1bd16e0aecd70 Mon Sep 17 00:00:00 2001
2+
From: Takatoshi Kondo <redboltz@gmail.com>
3+
Date: Sat, 8 Sep 2018 20:06:00 +0900
4+
Subject: [PATCH] Added enforcing endian functionality.
5+
6+
Fixes error with gcc@riscv:
7+
third_party/msgpack/include/msgpack/sysdep.h:146:5: error: #error msgpack-c supports only big endian and little endian
8+
9+
Upstream-Status: Backport [https://github.com/msgpack/msgpack-c/commit/f6ddc9b85adaa58f6426544e2bd1bd16e0aecd70]
10+
Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
11+
12+
---
13+
include/msgpack/sysdep.h | 6 ++++--
14+
1 file changed, 4 insertions(+), 2 deletions(-)
15+
16+
diff --git a/include/msgpack/sysdep.h b/include/msgpack/sysdep.h
17+
index 569ae4cdf..b430956b4 100644
18+
--- a/third_party/msgpack/include/msgpack/sysdep.h
19+
+++ b/third_party/msgpack/include/msgpack/sysdep.h
20+
@@ -10,8 +10,6 @@
21+
#ifndef MSGPACK_SYSDEP_H
22+
#define MSGPACK_SYSDEP_H
23+
24+
-#include <msgpack/predef.h>
25+
-
26+
#include <stdlib.h>
27+
#include <stddef.h>
28+
29+
@@ -86,6 +84,10 @@
30+
31+
#endif
32+
33+
+#if !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE)
34+
+#include <msgpack/predef/other/endian.h>
35+
+#endif // !defined(MSGPACK_ENDIAN_LITTLE_BYTE) && !defined(MSGPACK_ENDIAN_BIG_BYTE)
36+
+
37+
#if MSGPACK_ENDIAN_LITTLE_BYTE
38+
39+
# if defined(unix) || defined(__unix) || defined(__APPLE__) || defined(__OpenBSD__)

meta-firefox/recipes-browser/firefox/firefox_151.0.2.bb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ SRC_URI:append:libc-musl = " \
1313
file://fix-undeclared-identifier__NR_riscv_hwprobe.patch \
1414
"
1515

16+
SRC_URI:append:toolchain-gcc:arm = " file://llama.cpp-unknown-type-name-__fp16.patch"
17+
1618
SRC_URI[sha256sum] = "63c4267799f2618dd7ac5997d0306bbcf2a5306caaca0056795bc6c61d00f8c8"
1719

1820
PACKAGECONFIG[legacy-appdir] = ""

0 commit comments

Comments
 (0)