cross-rs / cross

“Zero setup” cross compilation and “cross testing” of Rust crates
Apache License 2.0
6.53k stars 365 forks source link

Multi-crate workspaces: failed to build archive: No such file or directory #1272

Open dspadea opened 1 year ago

dspadea commented 1 year ago

Checklist

Describe your issue

I have a multi-crate (9 crates) workspace project which I am trying to compile with cross.

When running cross on M1 Mac to target x86_64-unknown-linux-gnu, my build repeatedly fails with:

error: failed to build archive: No such file or directory

It really seems to be a race condition of some kind. It consistently happens toward the last few crate compiles, and breaks on a different crate each time. It will fail on one crate, I re-run, that crate will succeed and the next one will break. After 3-4 re-runs, I get a successful build.

I do not see this issue happen at all with a standard cargo-based build.

What target(s) are you cross-compiling for?

x86_64-unknown-linux-gnu

Which operating system is the host (e.g computer cross is on) running?

What architecture is the host?

What container engine is cross using?

cross version

cross 0.2.5 (88f49ff 2023-02-04)

Example

For example, clean run #1 ends with:

error: failed to build archive: No such file or directory

error: could not compile `catalog` (lib) due to previous error

Caused by:
  process didn't exit successfully: `rustc --crate-name catalog --edition=2021 catalog/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=231 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=cf58d492c7f96fcb -C extra-filename=-cf58d492c7f96fcb --out-dir /target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -C incremental=/target/x86_64-unknown-linux-gnu/debug/incremental -L dependency=/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/target/debug/deps --extern chrono=/target/x86_64-unknown-linux-gnu/debug/deps/libchrono-fbefeda04941e9ca.rmeta --extern czi_common_datatypes=/target/x86_64-unknown-linux-gnu/debug/deps/libczi_common_datatypes-f0d902fd36a7fa2d.rmeta --extern diagnostics=/target/x86_64-unknown-linux-gnu/debug/deps/libdiagnostics-0fd28a90a06e0dbf.rmeta --extern maplit=/target/x86_64-unknown-linux-gnu/debug/deps/libmaplit-c814b2e5339311bc.rmeta --extern octocrab=/target/x86_64-unknown-linux-gnu/debug/deps/liboctocrab-aa12826c16756c39.rmeta --extern reqwest=/target/x86_64-unknown-linux-gnu/debug/deps/libreqwest-72b346bd741863f6.rmeta --extern serde=/target/x86_64-unknown-linux-gnu/debug/deps/libserde-e9ad6a1e1f76c840.rmeta --extern serde_json=/target/x86_64-unknown-linux-gnu/debug/deps/libserde_json-783df95cd22061e8.rmeta -L native=/target/x86_64-unknown-linux-gnu/debug/build/ring-60bb58039a911a35/out` (exit status: 1)
warning: build failed, waiting for other jobs to finish...

Simply re-running the command, the previous crate will succeed and it usually breaks a few more times in different places before finally completing successfully. Unfortunately, now that I'm trying to write a bug report, it's only failing one time before succeeding (though each time on a different crate).

Additional information / notes

I'm not sure how important it is, but all of the crates except one are lib crates. There's only a single bin crate in this workspace, and only a single binary is produced at the end.

Emilgardis commented 1 year ago

can you run with -vv added to the command, I think there is a way to debug the ar calls also but I can't figure out what it would be

dspadea commented 1 year ago

Here it is:

error: failed to build archive: No such file or directory

error: could not compile `czi-doctor` (lib) due to previous error

Caused by:
  process didn't exit successfully: `CARGO=/rust/bin/cargo CARGO_CRATE_NAME=czi_doctor CARGO_MANIFEST_DIR=/project/czi-doctor CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=czi-doctor CARGO_PKG_README=README.md CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 LD_LIBRARY_PATH='/target/debug/deps:/rust/lib' rustc --crate-name czi_doctor --edition=2021 czi-doctor/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=231 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 -C metadata=10a101ac124998f7 -C extra-filename=-10a101ac124998f7 --out-dir /target/x86_64-unknown-linux-gnu/debug/deps --target x86_64-unknown-linux-gnu -C incremental=/target/x86_64-unknown-linux-gnu/debug/incremental -L dependency=/target/x86_64-unknown-linux-gnu/debug/deps -L dependency=/target/debug/deps --extern czi_common_datatypes=/target/x86_64-unknown-linux-gnu/debug/deps/libczi_common_datatypes-f0d902fd36a7fa2d.rmeta --extern diagnostics=/target/x86_64-unknown-linux-gnu/debug/deps/libdiagnostics-0fd28a90a06e0dbf.rmeta` (exit status: 1)
warning: build failed, waiting for other jobs to finish...
+ rustup component list --toolchain stable-x86_64-unknown-linux-gnu
Emilgardis commented 1 year ago

could you post the entire output? The log you posted does not show anything useful

dspadea commented 1 year ago

Please find attached. cross.log

mplanchard commented 12 months ago

@dspadea did you ever get this working? I'm running into the same thing

dspadea commented 11 months ago

@mplanchard Sadly, no, I didn't. I think I remember afterward seeing similar behavio when building my own build container in Docker and running the build in there. Could maybe (?) be an issue with building in Docker on Mac in general, not just with cross-rs? But if that's the case, I'd suspect we'd be far from the only people seeing it. I don't know why we are special.

mxfactorial commented 11 months ago

@dspadea @mplanchard

  1. open docker desktop on mac
  2. select Settings gear button at top right corner
  3. scroll down on General tab
  4. select gRPC FUSE or osxfs (Legacy) options under "Choose file sharing implementation for your containers"
  5. rerun cross build

2023-10-18 13 30 21

CosminPerRam commented 8 months ago

Switching to gRPC FUSE in "Choose file sharing implementation for your containers" seems to work for me (macOS 14.1.1, M1).

estk commented 8 months ago

@Emilgardis Maybe this should be in the readme? I ran into this today.

Emilgardis commented 8 months ago

Adding a note about changing fs in the readme if you experience this error doesn't align with the current readme imo. I'm not even sure where it would be best suited and if it is indeed the best solution.

I think a entry in the wiki makes the most sense right now, feel free to git clone https://github.com/cross-rs/cross.wiki.git, make a change and then give me the patch and I can add it, I'll get to this myself otherwise eventually as I think it's worth having it in a more central place