Open Bug 1891964 Opened 7 months ago Updated 4 months ago

Unable to compile Fenix/Gecko 125

Categories

(Fenix :: General, defect)

Firefox 125
All
Android
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: tad, Unassigned, NeedInfo)

Details

Steps to reproduce:

I'm the co-maintainer of Fennec F-Droid and maintainer of Mull. Both are unofficial source-built versions of Firefox for Android.

With 125 I haven't been able to successfully compile gecko with the standard NDK r26c or r25c toolchains + source-built wasi-20 toolchains.

Actual results:

both armv7 and aarch64 builds fail with the following errors:

11:08.69 In file included from Unified_cpp_layout_style4.cpp:20:
11:08.69 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsAnimationManager.cpp:26:
11:08.69 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/base/nsPresContextInlines.h:12:
11:08.69 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/base/nsCSSFrameConstructor.h:29:
11:08.69 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:62:
11:08.69 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/SmallPointerArray.h:265:11: error: array of abstract class type 'union Element'
11:08.69   } mArray[2];
11:08.69           ^
11:08.69 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/dom/base/nsINode.h:511:21: note: unimplemented pure virtual method 'WrapNode' in 'Element'
11:08.69   virtual JSObject* WrapNode(JSContext* aCx,
11:08.69                     ^
11:08.69 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/dom/base/nsINode.h:1357:20: note: unimplemented pure virtual method 'Clone' in 'Element'
11:08.69   virtual nsresult Clone(mozilla::dom::NodeInfo*, nsINode** aResult) const = 0;
11:08.69                    ^
11:10.28 In file included from Unified_cpp_layout_style4.cpp:65:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsComputedDOMStyle.cpp:23:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrameInlines.h:11:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/ComputedStyleInlines.h:22:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsStyleStructInlines.h:18:
11:10.28 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:226:16: error: return type of virtual function 'FirstContinuation' is not covariant with the return type of the function it overrides ('nsTextFrame *' is not derived from 'nsIFrame *')
11:10.28   nsTextFrame* FirstContinuation() const override {
11:10.28   ~~~~~~~~~~~~ ^
11:10.28 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:2475:21: note: overridden virtual function is here
11:10.28   virtual nsIFrame* FirstContinuation() const {
11:10.28           ~~~~~~~~~ ^
11:10.28 In file included from Unified_cpp_layout_style4.cpp:65:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsComputedDOMStyle.cpp:23:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrameInlines.h:11:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/ComputedStyleInlines.h:22:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsStyleStructInlines.h:18:
11:10.28 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:229:16: error: return type of virtual function 'GetPrevContinuation' is not covariant with the return type of the function it overrides ('nsTextFrame *' is not derived from 'nsIFrame *')
11:10.28   nsTextFrame* GetPrevContinuation() const override { return nullptr; }
11:10.28   ~~~~~~~~~~~~ ^
11:10.28 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:2471:21: note: overridden virtual function is here
11:10.28   virtual nsIFrame* GetPrevContinuation() const;
11:10.28           ~~~~~~~~~ ^
11:10.28 In file included from Unified_cpp_layout_style4.cpp:65:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsComputedDOMStyle.cpp:23:
11:10.28 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrameInlines.h:11:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/ComputedStyleInlines.h:22:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsStyleStructInlines.h:18:
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:230:16: error: return type of virtual function 'GetNextContinuation' is not covariant with the return type of the function it overrides ('nsTextFrame *' is not derived from 'nsIFrame *')
11:10.29   nsTextFrame* GetNextContinuation() const final { return mNextContinuation; }
11:10.29   ~~~~~~~~~~~~ ^
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:2473:21: note: overridden virtual function is here
11:10.29   virtual nsIFrame* GetNextContinuation() const;
11:10.29           ~~~~~~~~~ ^
11:10.29 In file included from Unified_cpp_layout_style4.cpp:65:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsComputedDOMStyle.cpp:23:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrameInlines.h:11:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/ComputedStyleInlines.h:22:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsStyleStructInlines.h:18:
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:247:16: error: return type of virtual function 'GetNextInFlow' is not covariant with the return type of the function it overrides ('nsTextFrame *' is not derived from 'nsIFrame *')
11:10.29   nsTextFrame* GetNextInFlow() const final {
11:10.29   ~~~~~~~~~~~~ ^
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:2495:21: note: overridden virtual function is here
11:10.29   virtual nsIFrame* GetNextInFlow() const;
11:10.29           ~~~~~~~~~ ^
11:10.29 In file included from Unified_cpp_layout_style4.cpp:65:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsComputedDOMStyle.cpp:23:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrameInlines.h:11:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/ComputedStyleInlines.h:22:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsStyleStructInlines.h:18:
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:273:16: error: return type of virtual function 'LastInFlow' is not covariant with the return type of the function it overrides ('nsTextFrame *' is not derived from 'nsIFrame *')
11:10.29   nsTextFrame* LastInFlow() const final;
11:10.29   ~~~~~~~~~~~~ ^
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:2506:21: note: overridden virtual function is here
11:10.29   virtual nsIFrame* LastInFlow() const { return const_cast<nsIFrame*>(this); }
11:10.29           ~~~~~~~~~ ^
11:10.29 In file included from Unified_cpp_layout_style4.cpp:65:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsComputedDOMStyle.cpp:23:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrameInlines.h:11:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/ComputedStyleInlines.h:22:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsStyleStructInlines.h:18:
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:274:16: error: return type of virtual function 'LastContinuation' is not covariant with the return type of the function it overrides ('nsTextFrame *' is not derived from 'nsIFrame *')
11:10.29   nsTextFrame* LastContinuation() const final;
11:10.29   ~~~~~~~~~~~~ ^
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:2478:21: note: overridden virtual function is here
11:10.29   virtual nsIFrame* LastContinuation() const {
11:10.29           ~~~~~~~~~ ^
11:10.29 In file included from Unified_cpp_layout_style4.cpp:65:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsComputedDOMStyle.cpp:23:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrameInlines.h:11:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/dist/include/mozilla/ComputedStyleInlines.h:22:
11:10.29 In file included from /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/style/nsStyleStructInlines.h:18:
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:242:9: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.29     if (GetContent()->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
11:10.29         ^~~~~~~~~~
11:10.29 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:243:7: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.29       GetContent()->RemoveProperty(nsGkAtoms::flowlength);
11:10.30       ^~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:244:7: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.30       GetContent()->UnsetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
11:10.30       ^~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:248:33: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.30     return mNextContinuation && mNextContinuation->HasAnyStateBits(
11:10.30                                 ^~~~~~~~~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:261:10: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.30         !mNextContinuation->HasAnyStateBits(NS_FRAME_IS_FLUID_CONTINUATION)) {
11:10.30          ^~~~~~~~~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:264:11: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.30       if (GetContent()->HasFlag(NS_HAS_FLOWLENGTH_PROPERTY)) {
11:10.30           ^~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:265:9: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.30         GetContent()->RemoveProperty(nsGkAtoms::flowlength);
11:10.30         ^~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:266:9: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'nsTextFrame'
11:10.30         GetContent()->UnsetFlags(NS_HAS_FLOWLENGTH_PROPERTY);
11:10.30         ^~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:373:12: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'const nsTextFrame'
11:10.30     return HasAnyStateBits(TEXT_HAS_NONCOLLAPSED_CHARACTERS);
11:10.30            ^~~~~~~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:383:12: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'const nsTextFrame'
11:10.30     return HasAnyStateBits(TEXT_HAS_FONT_INFLATION);
11:10.30            ^~~~~~~~~~~~~~~
11:10.30 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:675:12: error: cannot initialize object parameter of type 'const nsIFrame' with an expression of type 'const nsTextFrame'
11:10.31     return HasAnyStateBits(TEXT_IN_TEXTRUN_USER_DATA |
11:10.31            ^~~~~~~~~~~~~~~
11:10.31 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsTextFrame.h:1072:5: error: no matching member function for call to 'RemoveProperty'
11:10.31     RemoveProperty(ContinuationsProperty());
11:10.31     ^~~~~~~~~~~~~~
11:10.31 /mnt/fdroid/fdroiddata/build/srclib/MozFennec/layout/generic/nsIFrame.h:4319:8: note: candidate function template not viable: no known conversion from 'nsTextFrame' to 'nsIFrame' for object argument
11:10.31   void RemoveProperty(FrameProperties::Descriptor<T> aProperty) {
11:10.31        ^
11:10.31 fatal error: too many errors emitted, stopping now [-ferror-limit=]
11:11.00 20 errors generated.
11:11.13 gmake[4]: *** [/mnt/fdroid/fdroiddata/build/srclib/MozFennec/config/rules.mk:688: Unified_cpp_layout_style4.o] Error 1
11:11.13 gmake[4]: *** Waiting for unfinished jobs....

Expected results:

compile successfully

relan has made a fix for the first issue: https://gitlab.com/relan/fennecbuild/-/merge_requests/51#note_1880336146

however it still fails:

18:01.13     Finished release [optimized] target(s) in 15m 52s
18:03.72 toolkit/library/rust/libgkrust.a
18:03.75 toolkit/library/build/libxul.so
18:06.48 ld.lld: error: undefined symbol: __pwrite_chk
18:06.48 >>> referenced by unistd.h:160 (/mnt/fdroid/android-ndk/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/fortify/unistd.h:160)
18:06.48 >>>               9101141cc29acd10-mdb.o:(mdb_page_flush) in archive /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/thumbv7neon-linux-androideabi/release/libgkrust.a
18:06.48 >>> referenced by unistd.h:160 (/mnt/fdroid/android-ndk/android-ndk-r26c/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/bits/fortify/unistd.h:160)
18:06.48 >>>               9101141cc29acd10-mdb.o:(mdb_env_init_meta) in archive /mnt/fdroid/fdroiddata/build/srclib/MozFennec/obj/thumbv7neon-linux-androideabi/release/libgkrust.a
18:07.89 clang-17: error: linker command failed with exit code 1 (use -v to see invocation)
18:07.89 gmake[4]: *** [/mnt/fdroid/fdroiddata/build/srclib/MozFennec/config/rules.mk:541: libxul.so] Error 1
18:07.89 gmake[3]: *** [/mnt/fdroid/fdroiddata/build/srclib/MozFennec/config/recurse.mk:72: toolkit/library/build/target] Error 2
18:07.89 gmake[3]: *** Waiting for unfinished jobs....

The severity field is not set for this bug.
:bclark, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(brclark)

So in the end we fixed it.
There were three issues, one ours, the other two likely upstream issues.

The first was

SmallPointerArray.h:265:11: error: array of abstract class type 'union Element'
and fixed by https://gitlab.com/relan/fennecbuild/-/blob/1319dc0ecfc2da8b4918899063fc59ae2bade497/gecko-fix-125-compile.patch
This patch should be upstreamed if appropriate.

The second was

ld.lld: error: undefined symbol: __pwrite_chk
and fixed by removing the triplet from the compiler https://gitlab.com/relan/fennecbuild/-/commit/1319dc0ecfc2da8b4918899063fc59ae2bade497#2a3ffa9e598316176c1c8434bbf16a4aa511d325_292_312
This partly makes sense, the minSdk21 clang "doesn't support" these fortifications, but using the non-triplet compiled version still appears to work on these older Android verisons.

The third was the publishing being broken and never outputting the AAR for geckoview and fixed by reverting bz#1879852 and bz#1876067.
I'm unclear why this happens.

Tagging nalexander (as you've helped us in the past) so this gets an eye or two, as assigned bclark hasn't logged in in ~10 months.
Thanks.

Flags: needinfo?(nalexander)

(In reply to Tad from comment #5)

So in the end we fixed it.
There were three issues, one ours, the other two likely upstream issues.

The first was

SmallPointerArray.h:265:11: error: array of abstract class type 'union Element'
and fixed by https://gitlab.com/relan/fennecbuild/-/blob/1319dc0ecfc2da8b4918899063fc59ae2bade497/gecko-fix-125-compile.patch
This patch should be upstreamed if appropriate.

Emilio: is this real? Should it be merged?

The second was

ld.lld: error: undefined symbol: __pwrite_chk
and fixed by removing the triplet from the compiler https://gitlab.com/relan/fennecbuild/-/commit/1319dc0ecfc2da8b4918899063fc59ae2bade497#2a3ffa9e598316176c1c8434bbf16a4aa511d325_292_312
This partly makes sense, the minSdk21 clang "doesn't support" these fortifications, but using the non-triplet compiled version still appears to work on these older Android verisons.

This seems pretty odd but not something to address in mozilla-central.

The third was the publishing being broken and never outputting the AAR for geckoview and fixed by reverting bz#1879852 and bz#1876067.
I'm unclear why this happens.

owlish: can you suggest how to debug this? I know there have been lots of changes in this area, especially around VCS versions and hashing. I think we'd need a lot more debug investigation to be able to run this down.

Flags: needinfo?(nalexander)
Flags: needinfo?(emilio)
Flags: needinfo?(bugzeeeeee)
Flags: needinfo?(brclark)

(In reply to Nick Alexander :nalexander [he/him] from comment #6)

The first was

SmallPointerArray.h:265:11: error: array of abstract class type 'union Element'
and fixed by https://gitlab.com/relan/fennecbuild/-/blob/1319dc0ecfc2da8b4918899063fc59ae2bade497/gecko-fix-125-compile.patch
This patch should be upstreamed if appropriate.

Emilio: is this real? Should it be merged?

That patch is harmless so we can merge it if needed, but it smells like a compiler bug workaround.

The error in comment 0 seems to point out at the compiler confusing mozilla::SmallPointerArray::Element with mozilla::dom::Element. I'm not an expert in C++ naming resolution rules but at least seems suspect.

Same with the other nsIFrame-related errors, that is valid code. It seems something was messed up with the compiler...

Flags: needinfo?(emilio)

The third was the publishing being broken and never outputting the AAR for geckoview and fixed by reverting bz#1879852 and bz#1876067.

I'm still hitting this on 126 and those reverts are no longer a workaround with MozAC merged in

It seems something was messed up with the compiler...

This is the standard NDK r26c toolchain with its llvm17.
We're not using mach bootstrap as that downloads prebuilts which we can't use.
We could compile the toolchain as it is but it hasn't been necessary yet.

Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.