japaric / cargo-call-stack

Whole program static stack analysis
Apache License 2.0
579 stars 52 forks source link

error: options `-C embed-bitcode=no` and `-C lto` are incompatible #25

Closed BlinkyStitt closed 4 years ago

BlinkyStitt commented 4 years ago

I wanted to try this out, but after compiling for a while, it exits with:

error: options `-C embed-bitcode=no` and `-C lto` are incompatible

I'm using nightly-2020-06-08. Is that the problem?

A quick search turned up https://github.com/rust-lang/cargo/pull/8066

BlinkyStitt commented 4 years ago

I'm not sure how to enable embed-bitcode:

$ RUSTFLAGS="-Z embed-bitcode" cargo call-stack --bin daemon --verbose  > cg.dot
"cargo" "rustc" "--bin" "daemon" "--release" "--" "--emit=llvm-ir,obj" "-C" "lto" "-Z" "emit-stack-sizes"
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names -Z embed-bitcode --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
error: unknown debugging option: `embed-bitcode`
BlinkyStitt commented 4 years ago

Aha. Looks like I needed RUSTFLAGS="-C embed-bitcode"

japaric commented 4 years ago

Thanks for the report.

It seems that the compiler flags that Cargo uses in the release profile have changed recently. This has been fixed in master; the fix will be included in the v0.1.5 release.