`--enable-thread-sanitizer` (TSAN) build fails with `error: no matching package named `compiler_builtins` found`
Categories
(Firefox Build System :: General, defect, P3)
Tracking
(Not tracked)
People
(Reporter: dholbert, Unassigned)
Details
Attachments
(1 file)
STR:
- Install the Rust nightly toolchain, and make it your default (this is required to build with TSAN):
rustup toolchain default nightly
rustup default nightly
- Start a Firefox clobber-build, with this in your mozconfig (or this being your entire mozconfig):
ac_add_options --enable-thread-sanitizer
EXPECTED RESULTS:
Successful build.
ACTUAL RESULTS:
My build errors out pretty early, with:
error: no matching package named `compiler_builtins` found
If I run `./mach build -j1 -vvv, I get this slightly clearer output:
0:02.58 toolkit/library/rust/force-cargo-library-build
0:02.58 /home/dholbert/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo rustc --release --frozen --manifest-path /scratch/work/builds/mozilla-central/mozilla/toolkit/library/rust/Cargo.toml -vv --color=always -j1 -Zbuild-std=std,panic_abort --lib --target=x86_64-unknown-linux-gnu --features 'gkrust-shared/thread_sanitizer gkrust-shared/cubeb_pulse_rust gkrust-shared/cubeb-remoting gkrust-shared/moz_memory gkrust-shared/moz_places gkrust-shared/gecko_profiler gkrust-shared/gecko_profiler_parse_elf gkrust-shared/webrtc gkrust-shared/glean_with_gecko gkrust-shared/glean_disable_upload gkrust-shared/glean_million_queue gkrust-shared/with_dbus gkrust-shared/oxidized_breakpad gkrust-shared/webmidi_midir_impl' --
0:04.69 error: no matching package namedcompiler_builtins
found
0:04.69 location searched: registrycrates-io
0:04.69 required by packagestd v0.0.0 (/home/dholbert/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std)
Note: I tried building with a larger mozconfig based on https://firefox-source-docs.mozilla.org/tools/sanitizer/tsan.html , but I was still blocked by this same error; and it seems that the --enable-thread-sanitizer
build option is necessary & sufficient to trigger the issue.
I'm using Ubuntu 22.04, for what it's worth.
Note that we do have TSAN builds on TreeHerder, so presumably these builds can be successful, but I must be missing some bit of configuration, or maybe there's been a recent regression somewhere that's hitting me that hasn't bit TreeHerder yet.
Reporter | ||
Comment 1•2 years ago
|
||
decoder, I wonder if you've seen this before or know what it's about, in your work with TSAN builds?
Reporter | ||
Comment 2•2 years ago
|
||
(or if you know who to point me at, to find a way forward. My goal here is to try to reproduce bug 1770595 locally in rr, which requires a locally-built tsan build, ideally.)
Comment 3•2 years ago
|
||
Try emptying .cargo/config.in
Reporter | ||
Comment 4•2 years ago
•
|
||
(In reply to Mike Hommey [:glandium] from comment #3)
Try emptying
.cargo/config.in
emptying how?
I tried four things:
(1) If I delete that file, my build errors out with
File listed in OBJDIR_PP_FILES does not exist: /scratch/work/builds/mozilla-central/mozilla/.cargo/config.in
(2) If I clear the contents of that file (but leave it there as an empty file), my build errors out with
mozbuild.preprocessor.Preprocessor.Error: ('/scratch/work/builds/mozilla-central/mozilla/.cargo/config.in', None, 'no useful preprocessor directives found', None)
OK, it needs some "useful" preprocessor directives.
(3) If I remove all of the package-specific stuff up to the #define REPLACE_NAME vendored-sources
(a "useful" preprocessor directive), my build errors out with
0:16.97 error: failed to download `adler v1.0.2`
0:16.97 Caused by:
0:16.97 attempting to make an HTTP request, but --frozen was specified
(4) If I then add back just the first two lines...
[source.crates-io]
replace-with = "vendored-sources"
...but leave out everything else, then I'm back to the compiler_builtins
error from comment 0.
Reporter | ||
Comment 6•2 years ago
|
||
That gives me the same error output that I noted under (3) above: "error: failed to download adler v1.0.
", with "attempting to make an HTTP request, but --frozen was specified"
(Maybe I need to un-specify --frozen? But I don't know where to do that.)
Comment 7•2 years ago
|
||
Yeah, try removing --frozen from https://searchfox.org/mozilla-central/source/build/RunCbindgen.py#48 and https://searchfox.org/mozilla-central/source/config/makefiles/rust.mk#27
Reporter | ||
Comment 8•2 years ago
|
||
That seems to do it, yeah. Here's my full diff.
Presumably our TreeHerder TSAN builds don't do this, though; I wonder why this works there but not for me? Are they building with an older/different rust nightly build or something?
Comment 9•2 years ago
|
||
We're using a patched cargo because upstream cargo can't handle -Zbuild-std while using vendored crates.
Reporter | ||
Comment 10•2 years ago
|
||
OK. Clearing needinfo for choller since I think you've answered my questions and I can build now -- thanks!
Ideally we should still figure out what can be done to avoid this footgun though -- hence, leaving this bug open. (I don't know enough about cargo, the build system, etc. to know if this compiler_builtins
failure is something where we need to re-vendor some package vs. do something else.)
Feel free to dupe or close as-appropriate, though, as long as this is tracked as a known issue somewhere/somehow.
Comment 11•2 years ago
|
||
That's basically unfixable on our end. https://github.com/rust-lang/cargo/pull/8834 and https://github.com/rust-lang/rust/pull/78790 were an attempt that was backed out from upstream (and our cargo/rustc are patched with that)
Comment 12•2 years ago
|
||
The severity field is not set for this bug.
:ahochheiden, could you have a look please?
For more information, please visit auto_nag documentation.
Updated•2 years ago
|
Description
•