cross-rs / cross

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

Missing manifest file issue #1469

Closed makspll closed 6 months ago

makspll commented 6 months ago

Checklist

Describe your issue

Cross randomly stopped working in our CI at bevy_mod_scripting, as described here: https://github.com/houseabsolute/actions-rust-cross/issues/15

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

aarch64-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

0.2.5

Example

cross +stable test --workspace --features=lua54,rhai,teal,lua_script_api,rhai_script_api,rune --profile=ephemeral-build --target aarch64-unknown-linux-gnu -vv

in root of the workspace at: https://github.com/makspll/bevy_mod_scripting

Causes:

 error: failed to load manifest for workspace member `/project/crates/bevy_script_api`
Caused by:
  failed to load manifest for dependency `bevy_mod_scripting_lua_derive`
Caused by:
  failed to load manifest for dependency `bevy_mod_scripting`
Caused by:
  failed to read `/bevy_mod_scripting/Cargo.toml`
Caused by:
  No such file or directory (os error 2)
Error: Process completed with exit code 101.

Additional information / notes

No response

Emilgardis commented 6 months ago

I think this is an issue of us not properly resolving workspaces, so we don't grab the correct paths.

failed to read `/bevy_mod_scripting/Cargo.toml`

looks very wrong.

This was supposed to be fixed with https://github.com/cross-rs/cross/pull/684 but I think an assumption done there has been broken.

Should be fixed with #939, can you reproduce the issue with cross installed from the main branch?

Emilgardis commented 6 months ago

https://github.com/makspll/bevy_mod_scripting/blame/10dcca992a5bdcd172b293e54a3f6dcdbbd848f2/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml#L26 this is the reason I think. Try using workspace = true here

Emilgardis commented 6 months ago

Sorry, linked the wrong line, should be https://github.com/makspll/bevy_mod_scripting/blob/10dcca992a5bdcd172b293e54a3f6dcdbbd848f2/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml#L43

the problem is basically that you're traversing down to much, if anything it should be path = "../../..", fixing that line makes the project build for me on cross 0.2.5

Emilgardis commented 6 months ago

So to summarize, cross 0.2.5 mounts the cargo workspace at /project, the manifest at $workspace/crates/languages/bevy_mod_scripting_lua_derive/Cargo.toml points to a folder that travels one folder outside the workspace, ../../../../bevy_mod_scripting. The fourth .. is / meaning the path becomes /bevy_mod_scripting which is not correct for how the workspace is mounted.

You can reproduce this issue without cross by renaming the repos folder to something else, here's me doing it on windows by renaming bevy_mod_scripting to bevy_mod_scripting_renamed

error: failed to load manifest for workspace member `G:\workspace\bevy_mod_scripting_renamed\crates\bevy_script_api`

Caused by:
  failed to load manifest for dependency `bevy_mod_scripting_lua_derive`

Caused by:
  failed to load manifest for dependency `bevy_mod_scripting`

Caused by:
  failed to read `G:\workspace\bevy_mod_scripting\Cargo.toml`

Caused by:
  The system cannot find the path specified. (os error 3)
makspll commented 6 months ago

Oh good catch! I wonder why this doesn't break on a normal build?