Firefox for loongarch64 build failed in debian
Accessibility Severity Size Estimate a11y-review Performance Impact Webcompat Priority Webcompat Score Tracking Status firefox135 --- fixed Tracking Status relnote-firefox thunderbird_esr115 thunderbird_esr128 firefox-esr115 firefox-esr128 firefox135 firefox138 firefox139 firefox140Reset Assignee to default
Bug Flags:
behind-pref firefox-backlog sec-bounty sec-bounty-hof in-qa-testsuite in-testsuite qe-verifyThis bug is publicly visible.
48 bytes, text/x-phabricator-request
Details | Review48 bytes, text/x-phabricator-request
Details | Review48 bytes, text/x-phabricator-request
Details | ReviewUser Agent: Mozilla/5.0 (X11; Linux loongarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.338 Safari/537.36
Steps to reproduce:
In https://buildd.debian.org/status/package.php?p=firefox&suite=sid , firefox for loongarch64(loong64) build failed. And I can reproduce the problem and found two problems:
1, build-error:
/home/debian/mozilla-unified/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:1159:54: note: use ‘-flax-vector-conversions’ to permit conversions between vectors with differing element types or numbers of subparts
1159 | SI I32 min(I32 a, I32 b) { return __lsx_vmin_w(a,b); }
| ^
/home/debian/mozilla-unified/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:1159:55: error: cannot convert ‘lsx::I32’ {aka ‘__vector(4) int’} to ‘__m128i’
1159 | SI I32 min(I32 a, I32 b) { return __lsx_vmin_w(a,b); }
| ^
| |
| lsx::I32 {aka __vector(4) int}
In file included from /home/debian/mozilla-unified/gfx/skia/skia/src/opts/SkRasterPipeline_opts.h:123:
/usr/lib/gcc/loongarch64-linux-gnu/14/include/lsxintrin.h:698:31: note: initializing argument 1 of ‘__m128i __lsx_vmin_w(__m128i, __m128i)’
698 | __m128i __lsx_vmin_w (__m128i _1, __m128i _2)
| ^
2, link error:
82:34.58 /usr/bin/ld: ../../../media/libpng/Unified_c_media_libpng0.o: in function MOZ_PNG_init_filt_func': 82:34.59 /home/debian/mozilla-unified/media/libpng/pngrutil.c:4290:(.text.MOZ_PNG_push_proc_row+0x284): undefined reference to
png_init_filter_functions_lsx'
83:40.81 /usr/bin/ld: ../../../media/libyuv/libyuv/libyuv_libyuv/convert.o: in function .LVL919': 83:40.83 /home/debian/mozilla-unified/media/libyuv/libyuv/source/convert.cc:2034:(.text.ARGBToI420+0x1c0): undefined reference to
ARGBToUVRow_LSX'
83:40.83 /usr/bin/ld: ../../../media/libyuv/libyuv/libyuv_libyuv/convert.o: in function ARGBToI420': 83:40.83 /home/debian/mozilla-unified/media/libyuv/libyuv/source/convert.cc:2034:(.text.ARGBToI420+0x1c4): undefined reference to
ARGBToUVRow_LSX'
83:40.83 /usr/bin/ld: /home/debian/mozilla-unified/media/libyuv/libyuv/source/convert.cc:2005:(.text.ARGBToI420+0x1d0): undefined reference to ARGBToYRow_LSX' 83:40.83 /usr/bin/ld: /home/debian/mozilla-unified/media/libyuv/libyuv/source/convert.cc:2003:(.text.ARGBToI420+0x1d4): undefined reference to
ARGBToYRow_LSX'
83:40.83 /usr/bin/ld: /home/debian/mozilla-unified/media/libyuv/libyuv/source/convert.cc:2002:(.text.ARGBToI420+0x208): undefined reference to ARGBToYRow_LSX' 83:40.84 /usr/bin/ld: /home/debian/mozilla-unified/media/libyuv/libyuv/source/convert.cc:2002:(.text.ARGBToI420+0x20c): undefined reference to
ARGBToYRow_LSX'
Actual results:
Gcc for loongarch64 in debian support 128bit simd default. So skia/libpng/libyuv depends on ‘__loongarch_sx’ marco will lead to the upper failed.
https://searchfox.org/mozilla-central/source/gfx/skia/skia/include/private/base/SkFeatures.h#130
https://searchfox.org/mozilla-central/source/media/libpng/pngpriv.h#182
https://searchfox.org/mozilla-central/source/media/libyuv/libyuv/include/libyuv/row.h#694
$ gcc -dM -E - </dev/null | grep loongarch
#define __loongarch64 1
#define __loongarch_grlen 64
#define __loongarch_hard_float 1
#define __loongarch_frlen 64
#define __loongarch_simd_width 128
#define loongarch 1
#define __loongarch_version_minor 0
#define __loongarch_tune "generic"
#define __loongarch_double_float 1
#define __loongarch_sx 1
#define __loongarch_arch "la64v1.0"
#define __loongarch_simd 1
#define __loongarch_version_major 1
#define __loongarch_lp64 1
Expected results:
Firefox for loongarch64 build success.
The Bugbug bot thinks this bug should belong to the 'Core::Graphics' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Component: Untriaged → Graphics
Product: Firefox → Core
I originally wanted to add simd support to these modules, but found that the skia version was a bit behind the upstream, and libpng seemed to lack some loongarch64 simd code. In addition, Loongarch64 is divided into 2 sets of abi for some historical reasons. In abi1.0, 128 bit simd are not enabled by default, while abi2.0 will enable it. Both sets of abi are currently in use.
For the above reasons, I think the best way at present is to turn off the compiler's automatic vectorization through the **-mno-lsx** option, which will continue to maintain the previous state when compiling firefox. At some point in the future, perhaps when skia is updated to a newer version ([](https://skia-review.googlesource.com/c/skia/+/909436)), 128bit simd support willl be added.
$ gcc -mno-lsx -dM -E - </dev/null | grep loongarch #define __loongarch64 1 #define __loongarch_grlen 64 #define __loongarch_hard_float 1 #define __loongarch_frlen 64 #define __loongarch__ 1 #define __loongarch_version_minor 0 #define __loongarch_tune "generic" #define __loongarch_double_float 1 #define __loongarch_arch "la64v1.0" #define __loongarch_version_major 1 #define __loongarch_lp64 1
diff -r d92ada865a80 gfx/skia/moz.build
--- a/gfx/skia/moz.build Thu Dec 05 14:37:11 2024 +0000
+++ b/gfx/skia/moz.build Fri Dec 06 17:31:05 2024 +0800
@@ -21,6 +21,10 @@
skia_opt_flags += ['-O2']
elif CONFIG['CC_TYPE'] in ('clang', 'gcc'):
skia_opt_flags += ['-O3']
+if CONFIG['TARGET_CPU'] in ('loongarch64'):
#skia_opt_flags += ['-flax-vector-conversions']
skia_opt_flags += ['-mno-lsx']
UNIFIED_SOURCES += [
'skia/src/base/SkArenaAlloc.cpp',
diff -r d92ada865a80 media/libpng/moz.build
--- a/media/libpng/moz.build Thu Dec 05 14:37:11 2024 +0000
+++ b/media/libpng/moz.build Fri Dec 06 17:31:05 2024 +0800
@@ -58,6 +58,9 @@
'mips/mips_init.c'
]
+if CONFIG['TARGET_CPU'] in ('loongarch64'):
if CONFIG['HAVE_ALTIVEC']:
DEFINES['MOZ_PNG_USE_POWERPC'] = True
UNIFIED_SOURCES += [
diff -r d92ada865a80 media/libyuv/libyuv/libyuv.gyp
--- a/media/libyuv/libyuv/libyuv.gyp Thu Dec 05 14:37:11 2024 +0000
+++ b/media/libyuv/libyuv/libyuv.gyp Fri Dec 06 17:31:05 2024 +0800
@@ -29,6 +29,7 @@
'mips_msa%': 0, # Default to msa off.
'build_neon': 0,
'build_msa': 0,
['build_lsx == 0', {
'conditions': [
['target_arch == "loongarch64"', {
'cflags': [
'-mno-lsx',
],
'cflags_mozilla': [
'-mno-lsx',
],
}],
],
}],
['build_neon != 0', {
'defines': [
'LIBYUV_NEON',
I'm a newer for Bugzilla and feel Sorry about the messy writing style above.
Assignee: nobody → chengyangyang-hf
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3