japaric / cargo-call-stack

Whole program static stack analysis
Apache License 2.0
560 stars 50 forks source link

src/main.rs not applicable? #91

Open overheat opened 1 year ago

overheat commented 1 year ago

I got this error:

$cargo call-stack > cg.dot

error: Please specify either --example <NAME> or --bin <NAME>.
japaric commented 1 year ago

you need to specify the name of the crate even if the Cargo package contains only a single binary crate in it. the crate with root at src/main.rs has the same name as the Cargo package (this is specified in the package's Cargo.toml).

so for a project created with cargo new --bin hello you would have to use cargo call-stack --bin hello --target x86_64-unknown-linux-gnu. note that the --target flag is required if you have not set a compilation target in .cargo/config.toml (yes, even if you are doing native compilation)