Cargo build in workspace fails but works when building each individually

TL;DR: cargo build --release fails in workspace root but find . -name dist-spec.toml | sed 's|/[^/]*$||' | cut -c 3- | xargs -I {} cargo build --release --bin {} works.

Hi there,

I have a workspace with about 20 crates in. Sometimes cargo build --release fails to build (with no particularly helpful error message :-() when run from the workspace root, but building each individual crate in the workspace always works.

The entire build takes about 15 minutes, but I can't see anything about timeouts which might be being exceeded.

How do I go about debugging this, and has anyone run into any suggestions before?

Is there an unhelpful error message you could post?

1 Like

I'm building it now and capturing the output to a log...

The only errors are:

  • error: could not compile one-of-my-crates
  • Compile terminated by signal 9
  • error: build failed

one-of-my-crates changes often as well.

(EDIT: I'll try building with --verbose)

If it was killed with signal 9 and you didn't send that signal, it was probably because it ran out of memory.

1 Like

Excellent suggestion - as always - thanks Alice :slight_smile: