Closed Bug 1583471 Opened 5 years ago Closed 5 years ago

Build failure with Rust Nightly

Categories

(Core :: JavaScript: WebAssembly, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox-esr68 --- fixed
firefox71 --- fixed

People

(Reporter: decoder, Assigned: bbouvier)

References

Details

Attachments

(3 files)

I'm trying to test a fix for bug 1533213 and compiled Rust tip locally for this purpose. Cranelift gives me the following build error when trying to build a JS shell:

error[E0277]: `bindings::low_level::BD_ConstantValue__bindgen_ty_1` doesn't implement `std::fmt::Debug`
   --> /storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/build/baldrdash-a9e4338ce3bad607/out/bindings.rs:683:5
    |
683 |     pub u: BD_ConstantValue__bindgen_ty_1,
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `bindings::low_level::BD_ConstantValue__bindgen_ty_1` cannot be formatted using `{:?}`
    |
    = help: the trait `std::fmt::Debug` is not implemented for `bindings::low_level::BD_ConstantValue__bindgen_ty_1`
    = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
    = note: required because of the requirements on the impl of `std::fmt::Debug` for `&bindings::low_level::BD_ConstantValue__bindgen_ty_1`
    = note: required for the cast to the object type `dyn std::fmt::Debug`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `baldrdash`.

Caused by:
  process didn't exit successfully: `CARGO_MANIFEST_DIR=/storage/repos/mozilla-central-js/js/src/wasm/cranelift LD_LIBRARY_PATH='/storage/repos/mozilla-central-js/js/src/debug64asan2/debug/deps:/srv/repos/rust/build/x86_64-unknown-linux-gnu/stage2/lib' CARGO=/home/decoder/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo CARGO_PKG_VERSION_PRE= CARGO_PKG_VERSION=0.1.0 CARGO_PKG_AUTHORS='The Spidermonkey and Cranelift developers' CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_REPOSITORY= CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_NAME=baldrdash OUT_DIR=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/build/baldrdash-a9e4338ce3bad607/out CARGO_PKG_DESCRIPTION= CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_HOMEPAGE= /srv/repos/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustc --edition=2018 --crate-name baldrdash js/src/wasm/cranelift/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type rlib --emit=dep-info,metadata,link -C opt-level=1 -C panic=abort -C debuginfo=2 -C debug-assertions=on --cfg 'feature="cranelift_x86"' --cfg 'feature="default"' -C metadata=32fd813605fa06f4 -C extra-filename=-32fd813605fa06f4 --out-dir /storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -C incremental=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/incremental -L dependency=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/deps -L dependency=/storage/repos/mozilla-central-js/js/src/debug64asan2/debug/deps --extern cranelift_codegen=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/deps/libcranelift_codegen-c71c80b8462c9b85.rmeta --extern cranelift_wasm=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/deps/libcranelift_wasm-ae67a9fffe0f37a9.rmeta --extern env_logger=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/deps/libenv_logger-4abcc7d30b76089e.rmeta --extern log=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/deps/liblog-b3dcb2caf9c2018e.rmeta --extern smallvec=/storage/repos/mozilla-central-js/js/src/debug64asan2/x86_64-unknown-linux-gnu/debug/deps/libsmallvec-3425ded5e78c6865.rmeta -C opt-level=1 -C debuginfo=2 -C force-frame-pointers=yes --cap-lints warn -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-pc-table -Zsanitizer=address` (exit code: 1)

If I try to build with your build script, including RUSTFLAGS="-Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-pc-table -Zsanitizer=address", then I get the following error:

error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `/home/ben/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc - --crate-name ___ --print=file-names -C opt-level=1 -C debuginfo=2 -C force-frame-pointers=yes --cap-lints warn -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-pc-table -Cpasses=sancov -Cllvm-args=-sanitizer-coverage-level=4 -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-trace-compares -Cllvm-args=-sanitizer-coverage-pc-table -Zsanitizer=address --target x86_64-unknown-linux-gnu --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
rustc: for the   --sanitizer-coverage-level option: may only occur zero or one times!
rustc: for the   --sanitizer-coverage-inline-8bit-counters option: may only occur zero or one times!
rustc: for the   --sanitizer-coverage-trace-compares option: may only occur zero or one times!
rustc: for the   --sanitizer-coverage-pc-table option: may only occur zero or one times!

Without the RUSTFLAGS variable, build finishes without any errors, with rustc 1.39.0-nightly (eceec57f7 2019-09-18).

Anyhow: something is requesting BD_ConstantValue__bindgen_ty_1 to implement the Debug trait, e.g. it is indirectly used in a debug string, using the format "{:?}". This struct is automatically generated by bindgen. We don't use this struct in a debug string, otherwise any regular build would probably fail, even with Rustc stable. It is not the case, so something else (Rustc with asan build? debug code added?) is requiring this trait to be implemented. We need to understand if that's the case (in which case we'd need to signal to bindgen that we want this trait to be automatically derived; not sure if bindgen has APIs for this as of today), or if we can remove this requirement.

Flags: needinfo?(choller)

Meanwhile, :truber landed a bug that passes these flags automatically already. You need to change it to RUSTFLAGS="-Zsanitizer=address".

Flags: needinfo?(choller) → needinfo?(bbouvier)
Flags: needinfo?(bbouvier)
Priority: -- → P2

Ok, updated the build script. Now I don't get the build failure about the Debug trait, though.

Did you add some debugging spew in the Baldrdash rust code?

Flags: needinfo?(choller)

(In reply to Benjamin Bouvier [:bbouvier] from comment #3)

Ok, updated the build script. Now I don't get the build failure about the Debug trait, though.

Did you add some debugging spew in the Baldrdash rust code?

No, I am building m-c rev 81c450d952e7 without any local modifications.

Flags: needinfo?(choller) → needinfo?(bbouvier)
Assignee: nobody → bbouvier
Status: NEW → ASSIGNED
Flags: needinfo?(bbouvier)

Transition to syn 1.0 is ongoing, but these take a long time to build.

Hopefully we already patch coreaudio-sys manually so all the crates dependent on
bindgen are effectively in-tree.

I published v0.51.1-oldsyn to avoid pulling all these dependencies for now.

Pushed by bbouvier@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/238033981110
Update bindgen to 0.51.1 througout the tree; r=emilio
https://hg.mozilla.org/integration/autoland/rev/6325a8bdff4b
Don't pull new syn / quote / etc. dependencies just yet. r=bbouvier
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71

Can this be backported to ESR68? Or at least the part that fixes the build failure.

Flags: needinfo?(emilio)

It would be nice to have that fixed for ERS68, we're (most likely) hitting this when trying to build thunderbird using rust 1.39:
https://github.com/rust-lang/rust-bindgen/issues/1674

This allows to build ESR with newer versions of Rust.

Comment on attachment 9113501 [details]
Bug 1583471 - Update bindgen in ESR68. r=glandium, a=RyanVM

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: ESR build fix with newer rust versions.
  • User impact if declined: No user impact, but nice for distros and BSDs.
  • Fix Landed on Version: 71
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Touches build-only code, minimal change (I released a minor bindgen version with the fix cherry-picked).
  • String or UUID changes made by this patch: none
Flags: needinfo?(emilio)
Attachment #9113501 - Flags: approval-mozilla-esr68?

Comment on attachment 9113501 [details]
Bug 1583471 - Update bindgen in ESR68. r=glandium, a=RyanVM

Does someone need to review this in Phab?

Flags: needinfo?(emilio)

Not really, it's a trimmed down and rebased version of the original patch. I didn't send it for review intentionally, but lmk if you want somebody to do a onceover.

Flags: needinfo?(emilio)

Comment on attachment 9113501 [details]
Bug 1583471 - Update bindgen in ESR68. r=glandium, a=RyanVM

Fixes build issues for downstream builds compiling with newer versions of Rust. No real changes to the Firefox release builds. Approved for 68.4esr.

Attachment #9113501 - Flags: approval-mozilla-esr68? → approval-mozilla-esr68+
Attachment #9113501 - Attachment description: Bug 1583471 - Update bindgen in ESR68. → Bug 1583471 - Update bindgen in ESR68. r=glandium, a=RyanVM

Whoops, forgot to git add that file, my fault. Fixed.

Flags: needinfo?(emilio)

(In reply to Ryan VanderMeulen [:RyanVM] from comment #22)

https://hg.mozilla.org/releases/mozilla-esr68/rev/ad3e56f73652

Not sure if this is important at all or not, but the commit is marked as being created on 01/Jan/1970 - made it confusing when I was looking for it chronologically :-)

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

Attachment

General

Created:
Updated:
Size: