backtrace-sys still compiled when the backtrace feature is turned off #161
Description
Apparently the backtrace-sys
dependency is always compiled, regardless of whether the backtrace
feature is present. This bit me because when compiling for the x86_64-unknown-linux-musl
target and the musl C library isn't installed, backtrace-sys
can't be compiled.
My question is, why is error-chain
depending on backtrace-sys
even when the backtrace
feature isn't activated?
This is roughly what I was doing to replicate a failed travis build for my mdbook
PR, azerupi/mdbook#361.
$ rustup target add x86_64-unknown-linux-musl
$ cargo build --target x86_64-unknown-linux-musl
Compiling rustc-demangle v0.1.4
Compiling backtrace-sys v0.1.11
error: failed to run custom build command for `backtrace-sys v0.1.11`
...
--- stderr
configure: error: in `/home/michael/Documents/forks/mdBook/target/x86_64-unknown-linux-musl/debug/build/backtrace-sys-9b035f64636a9441/out':
configure: error: C compiler cannot create executables
I then thought I could work around this by telling error-chain
to not use the backtrace
feature. With the backtrace
feature removed this shouldn't try to compile anything related to backtraces.
// Cargo.toml
- error-chain = "0.10.0"
+ error-chain = { version = "0.10.0", features = [] }
Recompiling then gives you the same error.
The build succeeds if you install musl gcc wrapper (pacman -S musl
), but that means you are still building the backtrace-sys
crate even when the backtrace
feature isn't enabled.