Closed Bug 1612855 Opened 6 years ago Closed 6 years ago

./mach cargo check doesn't work with sccache

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(2 files)

No description provided.
Depends on: 1612856
 0:07.41 sccache: encountered fatal error
 0:07.41 sccache: error : failed to store `audio_thread_priority` to cache
 0:07.41 sccache:  cause: failed to store `audio_thread_priority` to cache
 0:07.41 sccache:  cause: failed to zip up compiler outputs
 0:07.41 sccache:  cause: No such file or directory (os error 2)
 0:07.41 error: could not compile `audio_thread_priority`.
 0:07.41 
 0:07.41 Caused by:
 0:07.41   process didn't exit successfully: `CARGO_PKG_DESCRIPTION='Bump a thread to real-time priority, for audio work, on Linux, Windows and macOS' CARGO_PKG_REPOSITORY='https://github.com/padenot/audio_thread_priority' CARGO_PKG_HOMEPAGE= CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION=0.20.2 CARGO_PKG_AUTHORS='Paul Adenot <paul@paul.cx>' LD_LIBRARY_PATH='/home/emilio/src/moz/gecko-3/obj-debug/debug/deps:/home/emilio/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib' CARGO=/home/emilio/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/cargo CARGO_PKG_VERSION_MINOR=20 CARGO_PKG_VERSION_PRE= CARGO_PKG_VERSION_PATCH=2 CARGO_MANIFEST_DIR=/home/emilio/src/moz/gecko-3/third_party/rust/audio_thread_priority CARGO_PKG_NAME=audio_thread_priority /home/emilio/.cargo/bin/sccache /home/emilio/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc --edition=2018 --crate-name audio_thread_priority /home/emilio/src/moz/gecko-3/third_party/rust/audio_thread_priority/src/lib.rs --color always --crate-type staticlib --crate-type rlib --emit=dep-info,metadata -C opt-level=1 -C panic=abort -C debuginfo=2 -C debug-assertions=on -C metadata=aa2a21dc5ab0dccf -C extra-filename=-aa2a21dc5ab0dccf --out-dir /home/emilio/src/moz/gecko-3/obj-debug/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -C linker=/home/emilio/src/moz/gecko-3/build/cargo-linker -L dependency=/home/emilio/src/moz/gecko-3/obj-debug/x86_64-unknown-linux-gnu/debug/deps -L dependency=/home/emilio/src/moz/gecko-3/obj-debug/debug/deps --extern cfg_if=/home/emilio/src/moz/gecko-3/obj-debug/x86_64-unknown-linux-gnu/debug/deps/libcfg_if-9c4e3ff0e22fd95e.rmeta --extern dbus=/home/emilio/src/moz/gecko-3/obj-debug/x86_64-unknown-linux-gnu/debug/deps/libdbus-93760e3c5b3c9431.rmeta --extern libc=/home/emilio/src/moz/gecko-3/obj-debug/x86_64-unknown-linux-gnu/debug/deps/liblibc-2e65ef4641e0dcf9.rmeta --extern log=/home/emilio/src/moz/gecko-3/obj-debug/x86_64-unknown-linux-gnu/debug/deps/liblog-53ab0477184cd3f5.rmeta --cap-lints warn -C opt-level=1 -C debuginfo=2 -C force-frame-pointers=yes --cap-lints warn -L native=/usr/lib64` (exit code: 254)

So, reduced test-case is a crate with a Cargo.toml like this:

[package]
name = "foo"
version = "0.1.0"
authors = ["Emilio Cobos Álvarez <emilio@crisal.io>"]
edition = "2018"

[lib]
name = "foo"
crate-type = ["staticlib", "rlib"]

Running cargo check on that runs:

$ rustc --edition=2018 --crate-name foo src/lib.rs --color always --crate-type staticlib --crate-type rlib --emit=dep-info,metadata -C debuginfo=2 -C metadata=20e937fd7a2cd256 -C extra-filename=-20e937fd7a2cd256 --out-dir /home/emilio/src/moz/foo/target/debug/deps -C incremental=/home/emilio/src/moz/foo/target/debug/incremental -L dependency=/home/emilio/src/moz/foo/target/debug/deps

So sccache runs --print file-names for that:

$ rustc --edition=2018 --crate-name foo src/lib.rs --color always --crate-type staticlib --crate-type rlib --emit=dep-info,metadata -C debuginfo=2 -C metadata=20e937fd7a2cd256 -C extra-filename=-20e937fd7a2cd256 --out-dir /home/emilio/src/moz/foo/target/debug/deps -C incremental=/home/emilio/src/moz/foo/target/debug/incremental -L dependency=/home/emilio/src/moz/foo/target/debug/deps --print file-names
libfoo-20e937fd7a2cd256.a
libfoo-20e937fd7a2cd256.rlib

Which prints both the rlib and the staticlib. But the staticlib is never generated, as we're cargo-checking, but sccache tries to find it and fails.

Do we at least get some kind of environment variable to indicate that cargo check is running as opposed to normal compilation?

That is the --emit=dep-info,metadata bit... I talked with Michael and we both agree this is a rustc bug.

Attached file Rustc fix.

Do you know if we should try to work around this in sccache, probably by looking at --emit, then ignoring .a / .so / etc if we only emit metadata or dep-info?

Flags: needinfo?(nfroyd)
Attached file sccache workaround
Flags: needinfo?(nfroyd)

Fixed via comment 6.

Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: