Bug 1897675 - Firefox fails to build on aarch64
Summary: Firefox fails to build on aarch64
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: firefox
Version: rawhide
Hardware: Unspecified
OS: Unspecified
urgent
high
Target Milestone: ---
Assignee: Gecko Maintainer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: openqa
Depends On:
Blocks: ARMTracker F34BetaBlocker
TreeView+ depends on / blocked
 
Reported: 2020-11-13 18:14 UTC by Martin Stransky
Modified: 2021-01-03 21:33 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-01-02 19:57:33 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 85282 0 P3 NEW CWG 727 (full specialization in non-namespace scope) 2021-02-18 15:14:06 UTC
Mozilla Foundation 1677690 0 P3 RESOLVED build fails after introducing SIMD support on aarch64 2021-02-18 15:14:05 UTC

Description Martin Stransky 2020-11-13 18:14:57 UTC
Firefox fails to build on aarch64:

https://koji.fedoraproject.org/koji/taskinfo?taskID=55521461

/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:661:13: error: explicit specialization in non-namespace scope ‘class js::wasm::BaseRegAlloc’
  661 |   template <>
      |             ^
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:662:8: error: template-id ‘hasFPU<js::jit::MIRType::Simd128>’ in declaration of primary template
  662 |   bool hasFPU<MIRType::Simd128>() {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:747:17: error: too many template-parameter-lists
  747 |   FloatRegister allocFPU() {
      |                 ^~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:752:13: error: explicit specialization in non-namespace scope ‘class js::wasm::BaseRegAlloc’
  752 |   template <>
      |             ^
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:753:17: error: expected ‘;’ at end of member declaration
  753 |   FloatRegister allocFPU<MIRType::Simd128>() {
      |                 ^~~~~~~~
      |                         ;
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:753:17: error: ‘js::jit::FloatRegister js::wasm::BaseRegAlloc::allocFPU’ conflicts with a previous declaration
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:738:8: note: previous declaration ‘void js::wasm::BaseRegAlloc::allocFPU(js::jit::FloatRegister)’
  738 |   void allocFPU(FloatRegister r) {
      |        ^~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:753:25: error: expected unqualified-id before ‘<’ token
  753 |   FloatRegister allocFPU<MIRType::Simd128>() {
      |                         ^
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp: In member function ‘js::wasm::RegF32 js::wasm::BaseRegAlloc::needF32()’:
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:937:27: error: invalid use of non-static member function ‘void js::wasm::BaseRegAlloc::allocFPU(js::jit::FloatRegister)’
  937 |     return RegF32(allocFPU<MIRType::Float32>());
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:738:8: note: declared here
  738 |   void allocFPU(FloatRegister r) {
      |        ^~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:937:18: error: expected primary-expression before ‘(’ token
  937 |     return RegF32(allocFPU<MIRType::Float32>());
      |                  ^
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:937:27: error: invalid use of non-static member function ‘void js::wasm::BaseRegAlloc::allocFPU(js::jit::FloatRegister)’
  937 |     return RegF32(allocFPU<MIRType::Float32>());
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:738:8: note: declared here
  738 |   void allocFPU(FloatRegister r) {
      |        ^~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:937:46: error: expected primary-expression before ‘)’ token
  937 |     return RegF32(allocFPU<MIRType::Float32>());
      |                                              ^
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp: In member function ‘js::wasm::RegF64 js::wasm::BaseRegAlloc::needF64()’:
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:951:27: error: invalid use of non-static member function ‘void js::wasm::BaseRegAlloc::allocFPU(js::jit::FloatRegister)’
  951 |     return RegF64(allocFPU<MIRType::Double>());
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:738:8: note: declared here
  738 |   void allocFPU(FloatRegister r) {
      |        ^~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:951:18: error: expected primary-expression before ‘(’ token
  951 |     return RegF64(allocFPU<MIRType::Double>());
      |                  ^
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:951:27: error: invalid use of non-static member function ‘void js::wasm::BaseRegAlloc::allocFPU(js::jit::FloatRegister)’
  951 |     return RegF64(allocFPU<MIRType::Double>());
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:738:8: note: declared here
  738 |   void allocFPU(FloatRegister r) {
      |        ^~~~~~~~
/builddir/build/BUILD/firefox-83.0/js/src/wasm/WasmBaselineCompile.cpp:951:45: error: expected primary-expression before ‘)’ token
  951 |     return RegF64(allocFPU<MIRType::Double>());

Comment 1 Dan Horák 2020-11-16 10:31:25 UTC
We see this in our CI too, but I haven't looked at the details yet. It might have come thru an upstream change at the beginning of October, will try bisecting. I don't think there has been an upstream report for it yet.

Comment 2 Dan Horák 2020-11-16 12:19:18 UTC
and the winner is https://bugzilla.mozilla.org/show_bug.cgi?id=1609381 (Wasm SIMD for arm64 baseline), not confirmed by a build yet as it's still in progress

Comment 3 Dan Horák 2020-11-17 10:27:11 UTC
and it might be another C++ standards related issue with g++ vs clang, I have found eg. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85282

Jon, Jakub, could you give us your opinion? The code in question start at https://github.com/mozilla/gecko-dev/blob/master/js/src/wasm/WasmBaselineCompile.cpp#L662

Comment 4 Jonathan Wakely 2020-11-17 12:03:32 UTC
Yes, it's GCC PR 85282.

The code was not valid in C++14. It is valid now but GCC doesn't implement it yet.

If mozilla code is written in C++14 (or wants to be portable to older compilers) then it shouldn't really depend on that feature.

Comment 5 Dan Horák 2020-11-17 12:09:02 UTC
Seems they use C++17 and clang, so their position is "patches welcome", please see https://bugzilla.mozilla.org/show_bug.cgi?id=1677690#c1

Comment 6 Jonathan Wakely 2020-11-17 12:14:12 UTC
FWIW the latest Intel compiler doesn't support this either. MSVC and Clang support it.

Here's a completely untested patch:
https://github.com/mozilla/gecko-dev/compare/master...jwakely:patch-1

If that works I can create the pull request.

Comment 8 Dan Horák 2020-11-17 12:27:00 UTC
awesome, most of the issue went away, but there is still one

...
 0:50.65 /usr/bin/g++ -std=gnu++17 -o Unified_cpp_js_src_wasm0.o -c  -I/home/sharkcz/projects/firefox/obj-aarch64-unknown-linux-gnu/dist/system_wrappers -include /home/sharkcz/projects/firefox/config/gcc_hidden.h -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-strong -DNDEBUG=1 -DTRIMMED=1 -DWASM_SUPPORTS_HUGE_MEMORY -DJS_CACHEIR_SPEW -DJS_STRUCTURED_SPEW -DJS_HAS_CTYPES -DFFI_BUILDING -DEXPORT_JS_API -DMOZ_HAS_MOZGLUE -I/home/sharkcz/projects/firefox/js/src/wasm -I/home/sharkcz/projects/firefox/obj-aarch64-unknown-linux-gnu/js/src/wasm -I/home/sharkcz/projects/firefox/obj-aarch64-unknown-linux-gnu/js/src -I/home/sharkcz/projects/firefox/js/src -I/home/sharkcz/projects/firefox/obj-aarch64-unknown-linux-gnu/dist/include -I/home/sharkcz/projects/firefox/obj-aarch64-unknown-linux-gnu/dist/include/nspr -fPIC -DMOZILLA_CLIENT -include /home/sharkcz/projects/firefox/obj-aarch64-unknown-linux-gnu/js/src/js-confdefs.h -Wall -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wsign-compare -Wtype-limits -Wunreachable-code -Wwrite-strings -Wno-invalid-offsetof -Wc++2a-compat -Wduplicated-cond -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wno-error=maybe-uninitialized -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=coverage-mismatch -Wno-error=free-nonheap-object -Wno-multistatement-macros -Wno-error=class-memaccess -Wno-error=deprecated-copy -Wformat -Wformat-overflow=2 -Werror=implicit-function-declaration -Wno-psabi -fno-sized-deallocation -fno-aligned-new -fno-rtti -fno-exceptions -fno-math-errno -pthread -pipe -g -freorder-blocks -O3 -fno-omit-frame-pointer -funwind-tables -fno-strict-aliasing -Werror=format -Wno-shadow -Wno-attributes  -MD -MP -MF .deps/Unified_cpp_js_src_wasm0.o.pp  -fdiagnostics-color  Unified_cpp_js_src_wasm0.cpp
 0:50.66 cc1plus: warning: ‘-Werror=’ argument ‘-Werror=implicit-function-declaration’ is not valid for C++
 1:01.49 In file included from /home/sharkcz/projects/firefox/js/src/vm/Activation.h:25,
 1:01.49                  from /home/sharkcz/projects/firefox/js/src/vm/JSContext.h:28,
 1:01.49                  from /home/sharkcz/projects/firefox/js/src/vm/GlobalObject.h:33,
 1:01.49                  from /home/sharkcz/projects/firefox/js/src/frontend/CompilationInfo.h:28,
 1:01.49                  from /home/sharkcz/projects/firefox/js/src/frontend/Parser.h:184,
 1:01.49                  from /home/sharkcz/projects/firefox/js/src/wasm/AsmJS.cpp:38,
 1:01.50                  from Unified_cpp_js_src_wasm0.cpp:2:
 1:01.50 /home/sharkcz/projects/firefox/js/src/vm/Stack.h: In instantiation of ‘class js::detail::FixedArgsBase<js::NO_CONSTRUCT, 0>’:
 1:01.50 /home/sharkcz/projects/firefox/js/src/vm/Stack.h:933:7:   required from ‘class js::FixedInvokeArgs<0>’
 1:01.50 /home/sharkcz/projects/firefox/js/src/vm/Interpreter.h:90:29:   required from here
 1:01.50 /home/sharkcz/projects/firefox/js/src/vm/Stack.h:890:19: warning: comparison is always true due to limited range of data type [-Wtype-limits]
 1:01.50   890 |   static_assert(N <= ARGS_LENGTH_MAX, "o/~ too many args o/~");
 1:01.50       |                 ~~^~~~~~~~~~~~~~~~~~
 1:09.53 In file included from Unified_cpp_js_src_wasm0.cpp:11:
 1:09.53 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp:750:13: error: explicit specialization in non-namespace scope ‘class js::wasm::BaseRegAlloc’
 1:09.54   750 |   template <>
 1:09.54       |             ^
 1:09.54 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp:751:17: error: template-id ‘allocFPU<js::jit::MIRType::Simd128>’ in declaration of primary template
 1:09.54   751 |   FloatRegister allocFPU<MIRType::Simd128>() {
 1:09.54       |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
 1:09.55 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp: In member function ‘bool js::wasm::BaseRegAlloc::hasFPU()’:
 1:09.55 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp:658:34: error: ‘T’ was not declared in this scope
 1:09.55   658 |     if constexpr (std::is_same_v<T, MIRType::Simd128>)
 1:09.55       |                                  ^
 1:19.34 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp: In member function ‘bool js::wasm::BaseRegAlloc::hasFPU() [with js::jit::MIRType t = js::jit::MIRType::Float32]’:
 1:19.34 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp:663:3: warning: control reaches end of non-void function [-Wreturn-type]
 1:19.34   663 |   }
 1:19.34       |   ^
 1:19.34 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp: In member function ‘bool js::wasm::BaseRegAlloc::hasFPU() [with js::jit::MIRType t = js::jit::MIRType::Double]’:
 1:19.34 /home/sharkcz/projects/firefox/js/src/wasm/WasmBaselineCompile.cpp:663:3: warning: control reaches end of non-void function [-Wreturn-type]
 1:20.18 gmake[4]: *** [/home/sharkcz/projects/firefox/config/rules.mk:725: Unified_cpp_js_src_wasm0.o] Chyba 1
 1:20.18 gmake[4]: Opouští se adresář „/home/sharkcz/projects/firefox/obj-aarch64-unknown-linux-gnu/js/src/wasm“
...

Comment 9 Jonathan Wakely 2020-11-17 13:01:20 UTC
Fixed patch that builds: https://github.com/mozilla/gecko-dev/commit/71597faac0fde4f608a60dd610d0cefac4972cc3.patch

Comment 10 Adam Williamson 2020-12-04 19:24:04 UTC
Ping?

Patches are listed above, but Firefox has had aarch64 builds disabled since 2020-11-20. Martin, can you please look at this? We can't really just have Firefox not building for one of our primary arches.

Comment 11 Adam Williamson 2020-12-04 19:25:06 UTC
Proposing as a Beta blocker per "It must be possible to run the default web browser and a terminal application from all release-blocking desktop environments." GNOME is the release-blocking desktop environment for aarch64.

Comment 12 Martin Stransky 2020-12-10 08:45:31 UTC
Added to Firefox 84 which coming out 12-15-2020.
Thanks.

Comment 13 Martin Stransky 2020-12-14 05:10:58 UTC
Aarch64 fixes seems to be working now, Thanks (https://koji.fedoraproject.org/koji/taskinfo?taskID=57238919).
We'll ship new builds with Firefox 84.0 release.

Comment 14 Adam Williamson 2020-12-16 02:20:32 UTC
It would be best not to close this until we actually have a successful build in Rawhide. I don't see one yet.

Side note: you forgot to update the %changelog with the 84.0 builds. The latest entry in the changelog is still 83.0-15.

Comment 15 Martin Stransky 2020-12-16 08:17:43 UTC
Yeah, sorry for that.

Comment 16 Adam Williamson 2021-01-02 19:57:33 UTC
We do have a successful build in Rawhide now:
https://koji.fedoraproject.org/koji/buildinfo?buildID=1661449

so this can be closed. Please, in future, don't disable aarch64 builds. If aarch64 doesn't build it needs to be fixed before a build can be done. It's a primary, release-blocking arch. Thanks!

Comment 17 Martin Stransky 2021-01-03 21:08:47 UTC
(In reply to Adam Williamson from comment #16)
> We do have a successful build in Rawhide now:
> https://koji.fedoraproject.org/koji/buildinfo?buildID=1661449
> 
> so this can be closed. Please, in future, don't disable aarch64 builds. If
> aarch64 doesn't build it needs to be fixed before a build can be done. It's
> a primary, release-blocking arch. Thanks!

In such case we'd hold security updated until aarch64 is fixed and that can take weeks so I don't think it's acceptable. If aarch64 updates are so important it will be great to have second arch experts here to help with it.

Comment 18 Peter Robinson 2021-01-03 21:21:51 UTC
> In such case we'd hold security updated until aarch64 is fixed and that can
> take weeks so I don't think it's acceptable. If aarch64 updates are so
> important it will be great to have second arch experts here to help with it.

We do, but you've constantly ignored us, please file a bug and block against ARMTracker so arch maintainers are aware of it (similar blockers exist for other arches), or actively reach out.

Comment 19 Martin Stransky 2021-01-03 21:33:38 UTC
(In reply to Peter Robinson from comment #18)
> > In such case we'd hold security updated until aarch64 is fixed and that can
> > take weeks so I don't think it's acceptable. If aarch64 updates are so
> > important it will be great to have second arch experts here to help with it.
> 
> We do, but you've constantly ignored us, please file a bug and block against
> ARMTracker so arch maintainers are aware of it (similar blockers exist for
> other arches), or actively reach out.

Okay, will do that next time.
Thanks.


Note You need to log in before you can comment on or make changes to this bug.