Closed Bug 1838063 Opened 2 years ago Closed 2 years ago

error[E0277]: the trait bound `u64: Mul<NonZeroU8>` is not satisfied when building firefox 109

Categories

(Firefox Build System :: General, defect)

Firefox 109
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1840323

People

(Reporter: mike.davis99887, Unassigned)

Details

Steps to reproduce:

hi,

i'm trying to build firefox from source but since rust version 1.70.0 i'm getting errors when building mp4parse.

to reproduce the bug:

hg clone https://hg.mozilla.org/releases/mozilla-release/
cd ./mozilla-release
hg update --clean --rev 722618 (tag: FIREFOX_109_0_1_RELEASE)
touch mozconfig with the following options:
ac_add_options --target=x86_64-pc-linux-gnu
ac_add_options --with-ccache=sccache
ac_add_options --disable-bootstrap
ac_add_options --disable-tests
ac_add_options --disable-debug-symbols
ac_add_options --disable-updater
ac_add_options --without-wasm-sandboxed-libraries
unset MOZ_TELEMETRY_REPORTING
./mach bootstrap (with option 2 because older versions don't have artifacts anymore)
./mach build

Actual results:

then i get an error when building mp4parse with the message:

 0:06.37 error[E0277]: the trait bound `u64: Mul<NonZeroU8>` is not satisfied
 0:06.37     --> /firefox-109.0.1/third_party/rust/mp4parse/src/lib.rs:3188:62
 0:06.37      |
 0:06.37 3188 |                 static_assertions::const_assert!(<$lhs>::MAX * <$rhs>::MAX <= <$output>::MAX);
 0:06.38      |                                                              ^ no implementation for `u64 * NonZeroU8`
 0:06.38 ...
 0:06.38 3198 | impl_mul!((U8, std::num::NonZeroU8) => (U16, u16));
 0:06.38      | -------------------------------------------------- in this macro invocation
 0:06.38      |
 0:06.38      = help: the trait `~const Mul<NonZeroU8>` is not implemented for `u64`
 0:06.39      = help: the following other types implement trait `Mul<Rhs>`:
 0:06.39                <&'a u64 as Mul<u64>>
 0:06.39                <&u64 as Mul<&u64>>
 0:06.39                <u64 as Mul<&u64>>
 0:06.39                <u64 as Mul>
 0:06.39      = note: this error originates in the macro `impl_mul` (in Nightly builds, run with -Z macro-backtrace for more info)
 0:06.40 note: erroneous constant used
 0:06.40     --> /firefox-109.0.1/third_party/rust/mp4parse/src/lib.rs:3198:1
 0:06.40      |
 0:06.40 3198 | impl_mul!((U8, std::num::NonZeroU8) => (U16, u16));
 0:06.40      | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 0:06.40      |
 0:06.40      = note: this note originates in the macro `static_assertions::const_assert` which comes from the expansion of the macro `impl_mul` (in Nightly builds, run with -Z macro-backtrace for more info)
 0:06.40 error[E0277]: the trait bound `u64: Mul<NonZeroU8>` is not satisfied
 0:06.40     --> /firefox-109.0.1/third_party/rust/mp4parse/src/lib.rs:3188:62
 0:06.41      |
 0:06.41 3188 |                 static_assertions::const_assert!(<$lhs>::MAX * <$rhs>::MAX <= <$output>::MAX);
 0:06.41      |                                                              ^ no implementation for `u64 * NonZeroU8`
 0:06.41 ...
 0:06.41 3199 | impl_mul!((U32, std::num::NonZeroU8) => (U32MulU8, u64));
 0:06.41      | -------------------------------------------------------- in this macro invocation
 0:06.41      |
 0:06.41      = help: the trait `~const Mul<NonZeroU8>` is not implemented for `u64`
 0:06.41      = help: the following other types implement trait `Mul<Rhs>`:
 0:06.42                <&'a u64 as Mul<u64>>
 0:06.42                <&u64 as Mul<&u64>>
 0:06.42                <u64 as Mul<&u64>>
 0:06.42                <u64 as Mul>
 0:06.43      = note: this error originates in the macro `impl_mul` (in Nightly builds, run with -Z macro-backtrace for more info)

Expected results:

i can build newer versions but that's because mach automatically downloads artifacts but i can't do that on older versions.
i also did:

cd ./third_party/rust/mp4parse
cargo build

and it built even with the latest toolchain but when using mach it still throws error.

so apparently is you do cargo build --release on mp4parse it will throw the same error but if you 1) remove the release flag or b) switch to an older toolchain (in my case 1.66.0) it will work.
is there a way to specify no --release flag in mach?

hi,

so i finally managed to build one of the older versions from source.
i did that by adding ac_add_options --disable-release in mozconfig and by switching to an older version of rust with rustup default 1.66.0.
if you tried to build in the past make sure to do ./mach clobber --full and build from scratch otherwise mach will still use the wrong version of rust. you could also try ./mach configure but i don't know how and if that'll work.

hope this helps

I see the same when building Firefox 102.11 with Rust 1.70. It builds fine with Rust 1.61.

Following patch need to be applied on third_party/rust/mp4parse/src/lib.rs (plus update third_party/rust/mp4parse/.cargo-checksum.json).

https://github.com/mozilla/mp4parse-rust/commit/8b5b652d38e007e736bb442ccd5aa5ed699db100

Note that latest Firefox (versoin 116a) sources build without an issue.

No longer problem with 102.13.0.

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::General' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → General
Product: Firefox → Firefox Build System
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: 1840323
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.