Description
On Mac OS X, when I run time remake --trace -j8
from a clean checkout, three things can occur in parallel:
- Running
get-snapshot.py
, which is largely consumed by downloading the snapshot - Building LLVM
- Building libuv and associated products, and copying them into place.
In particular, libmorestack.a is first built as part of libuv and then copied into
x86_64-apple-darwin/stage0/lib/rustc/x86_64-apple-darwin/lib/libmorestack.a
But part of what get-snapshot.py
does is to clean out the target area of the unpacking before doing the current unpacking. (I added that code for fixing #3225 .)
And in a sequential build, this cleaning step usually happens before the libuv building steps; but for a parallel build, the steps can be reordered.
The reason the re-ordering matters is: It looks like the net that get-snapshot.py is a bit too broad, and it ends up deleting the libmorestack.a
that it had copied over, among other things:
opening snapshot dl/rust-stage0-2013-08-14-e7b5729-macos-x86_64-f44aba76e9d7a9a28b8a6dd78f14576e7c84fbf3.tar.bz2
removing x86_64-apple-darwin/stage0/lib/rustc/x86_64-apple-darwin/lib/libmorestack.a
removing x86_64-apple-darwin/stage0/lib/rustc/x86_64-apple-darwin/lib/librustllvm.dylib
removing x86_64-apple-darwin/stage0/lib/rustc/x86_64-apple-darwin/lib/librustrt.dylib
extracting rust-stage0/bin/rustc
extracting rust-stage0/lib/libstd-6c65cf4b443341b1-0.8-pre.dylib
extracting rust-stage0/lib/libextra-a7c050cfd46b2c9a-0.8-pre.dylib
extracting rust-stage0/lib/librustc-d3cb8c2ccd84a7a7-0.8-pre.dylib
extracting rust-stage0/lib/libsyntax-64629f7f0c6a9bc-0.8-pre.dylib
extracting rust-stage0/lib/librustrt.dylib
extracting rust-stage0/lib/librustllvm.dylib
So, to fix this, either:
- get-snapshot.py could be restricted in what paths it deletes; it can't hard-code them, since it needs to match previous snapshot's SHA's, but there is potentially a simpler strategy we could adopt. Or,
- The libuv (and perhaps also the llvm) builds could be forced to wait until the snapshot has been unpacked. Or at least the copies of their products into the target area. Or,
- We could refactor the cleaning step as a separate action from grabbing the snapshot, and force that to run before all three of the above parallel actions.
Anyway, I've become sort of the local make guru, so I'll see what I can do about this. It probably only affects people who do make -jK
for large/interesting K, and the problem often goes away on subsequent runs of make once the prior run's intermediate build products are in place.