Closed Bug 1652448 Opened 5 years ago Closed 5 years ago

Rust code continually rebuilds on release builds.

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(firefox80 fixed)

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: emilio, Assigned: glandium)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

STR:

  • Make a build with ac_add_options --enable-release.

  • Wait for it to finish.

  • touch layout/generic/nsPageSequenceFrame.cpp (or any other C++ file really).

  • mach build

ER:

  • Only layout/generic rebuilds.

AR:

  • I see a bunch of:
 0:10.96 toolkit/library/rust/force-cargo-library-build
 0:12.70    Compiling rustc-demangle v0.1.8
 0:12.94    Compiling profiler_helper v0.1.0 (/home/emilio/src/moz/gecko-4/tools/profiler/rust-helper)
 0:13.08    Compiling gkrust-shared v0.1.0 (/home/emilio/src/moz/gecko-4/toolkit/library/rust/shared)
 0:13.87    Compiling gkrust v0.1.0 (/home/emilio/src/moz/gecko-4/toolkit/library/rust)

Which is also super slow.

Curiously enough it doesn't happen when I export REBUILD_CHECK=1, in which case only dump_syms gets rebuilt:

$ ./mach build                                                                                                                                                                                                                             
 0:00.33 Clobber not needed.
 0:00.33 Adding make options from /home/emilio/src/moz/gecko-4/.mozconfig
    AUTOCLOBBER=1
    MOZ_OBJDIR=/home/emilio/src/moz/gecko-4/obj-no-sccache-release
    OBJDIR=/home/emilio/src/moz/gecko-4/obj-no-sccache-release
    FOUND_MOZCONFIG=/home/emilio/src/moz/gecko-4/.mozconfig
    export FOUND_MOZCONFIG
 0:00.34 /usr/bin/gmake -f client.mk -s
 0:00.57 Elapsed: 0.00s; From dist/private: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.57 Elapsed: 0.00s; From dist/public: Kept 0 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.57 Elapsed: 0.00s; From dist/xpi-stage: Kept 90 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.62 Elapsed: 0.05s; From _tests: Kept 1200 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.65 Elapsed: 0.08s; From dist/bin: Kept 2693 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.72 Elapsed: 0.15s; From dist/include: Kept 6228 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.80 Rebuilding .deps/buildid.h.stub because FORCE was removed
 0:00.90 Rebuilding .deps/source-repo.h.stub because FORCE was removed
 0:01.04 Rebuilding build/.deps/application.ini.stub because /home/emilio/src/moz/gecko-4/obj-no-sccache-release/buildid.h changed
 0:01.14 Rebuilding build/.deps/application.ini.h.stub because build/application.ini changed
 0:01.41 force-cargo-library-build
 0:01.41 force-cargo-program-build
 0:01.42 Rebuilding nsBrowserApp.o because /home/emilio/src/moz/gecko-4/obj-no-sccache-release/build/application.ini.h changed
 0:01.46     Blocking waiting for file lock on package cache
 0:01.53 Rebuilding Unified_cpp_layout_generic3.o because /home/emilio/src/moz/gecko-4/layout/generic/nsPageSequenceFrame.cpp changed
 0:01.58 force-cargo-program-build
 0:01.61     Blocking waiting for file lock on package cache
 0:01.97 Rebuilding ../../dist/bin/firefox because nsBrowserApp.o changed
 0:02.34     Blocking waiting for file lock on package cache
 0:03.19     Blocking waiting for file lock on package cache
 0:04.02     Blocking waiting for file lock on package cache
 0:04.03     Blocking waiting for file lock on package cache
 0:04.04     Blocking waiting for file lock on package cache
 0:04.04     Blocking waiting for file lock on package cache
 0:04.05     Blocking waiting for file lock on package cache
 0:04.05     Blocking waiting for file lock on package cache
 0:04.08     Finished release [optimized] target(s) in 2.49s
 0:04.41     Finished release [optimized] target(s) in 3.00s
 0:04.71     Finished release [optimized] target(s) in 3.30s
 0:05.10 force-cargo-host-library-build
 0:06.00    Compiling rustc-demangle v0.1.8
 0:06.43    Compiling dump_syms_rust_demangle v0.1.0 (/home/emilio/src/moz/gecko-4/toolkit/crashreporter/rust)
 0:06.52     Finished release [optimized] target(s) in 1.42s
 0:06.64 Rebuilding ../../../../../../../dist/host/bin/dump_syms because /home/emilio/src/moz/gecko-4/obj-no-sccache-release/x86_64-unknown-linux-gnu/release/libdump_syms_rust_demangle.a changed
 0:11.68 Rebuilding libxul.so because ../../../layout/generic/Unified_cpp_layout_generic3.o changed

What does CARGO_LOG=cargo::core::compiler::fingerprint=trace say for the build after touching the layout files?

Flags: needinfo?(emilio)
Attached file build-log

./mach build, then touch layout/generic/nsPageSequenceFrame.cpp, then CARGO_LOG=cargo::core::compiler::fingerprint=trace ./mach build >build-log 2>&1.

There's some RUSTFLAGS changes that look suspicious. Then there's the err: current filesystem status shows we're outdated bit...

Flags: needinfo?(emilio)
Attachment #9163189 - Attachment mime type: application/octet-stream → text/plain
  • touch layout/generic/nsPageSequenceFrame.cpp (or any other C++ file really).

I don't even need this step to reproduce.

So, the problem is that rustc-demangle is built for toolkit/library/rust/target and toolkit/crashreporter/rust/host, and because both host and target are the same cargo target, for cargo, they're the same thing, so when flags are different between both, it thinks it needs to rebuild.
And the flags are different between both, because we only set codegen-units=1 for target things.

Otherwise, crates that are shared between host and target are always
rebuilt because of the difference in rust flags.

Assignee: nobody → mh+mozilla
Status: NEW → ASSIGNED
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/fe9cbc63cbd4 Use the same codegen-units numbers on host and target rust builds. r=firefox-build-system-reviewers,rstewart
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: