ustu
October 29, 2021, 9:07pm
1
I installed Rust on my M1 Mac mini.
I can't get it to build my rust project - it says "No such file or directory (os error 2)"
Notice below how the Cargo.toml file it says it cannot find is two directories up.
Can anyone suggest what might be wrong?
thanks!
username@M1-Mac-mini ffmq % cargo run
error: failed to read `/Users/username/devel/Cargo.toml`
Caused by:
No such file or directory (os error 2)
username@M1-Mac-mini ffmq % pwd
/Users/username/devel/ffmq/ffmq
username@M1-Mac-mini ffmq % find .
.
./Cargo.toml
./LICENSE
./README.md
./.gitignore
./src
./src/main.rs
./src/main.rs.working
username@M1-Mac-mini ffmq %
kpreid
October 29, 2021, 10:17pm
2
What are the contents of the Cargo.toml
file you do have? In particular, does it have a [workspace]
section?
ustu
October 29, 2021, 10:24pm
3
It does not have a workspace section. Does it need that? That same exact code compiles fine on Linux.
[package]
name = "foo"
version = "0.3.0"
authors = ["foo <foo@example.com>"]
edition = "2018"
license = "MIT"
description = "foo"
keywords = ["foo", "foo"]
repository = ""
readme = "README.md"
[dependencies]
....
kpreid
October 29, 2021, 10:42pm
4
No, I was just speculating about a possible cause for the problem.
Could you run this command, which enables extra logging, and show us the results?
CARGO_LOG=debug cargo run
ustu
October 29, 2021, 11:17pm
6
username@M1-Mac-mini mqstoreserver % CARGO_LOG=debug cargo run
[2021-10-29T23:16:40Z DEBUG cargo::core::workspace] find_root - trying /Users/username/devel/ffmq/Cargo.toml
[2021-10-29T23:16:40Z DEBUG cargo::core::workspace] find_root - found pointer
[2021-10-29T23:16:40Z DEBUG cargo::core::workspace] find_root - pointer /Users/username/devel/ffmq/../Cargo.toml
[2021-10-29T23:16:40Z DEBUG cargo] exit_with_error; err=CliError { error: Some(failed to read `/Users/username/devel/Cargo.toml`
Caused by:
No such file or directory (os error 2)), exit_code: 101 }
[2021-10-29T23:16:40Z DEBUG cargo] display_error; err=failed to read `/Users/username/devel/Cargo.toml`
Caused by:
No such file or directory (os error 2)
error: failed to read `/Users/username/devel/Cargo.toml`
Caused by:
No such file or directory (os error 2)
username@M1-Mac-mini mqstoreserver %
I believe the problem is that the parent directory has a Cargo.toml
with an invalid workspace
field, something like this:
/Users/username/devel/ffmq/Cargo.toml
[package]
name = "foo"
workspace = ".."
This makes Cargo look for a workspace in /Users/username/devel/Cargo.toml
, which does not exist. To fix this, change or remove the workspace
value in /Users/username/devel/ffmq/Cargo.toml
.
2 Likes
ustu
October 30, 2021, 12:11am
8
You sir, were perfectly correct.
system
Closed
January 28, 2022, 12:11am
9
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.