Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

backtrace-sys still compiled when the backtrace feature is turned off #161

Open
@Michael-F-Bryan

Description

@Michael-F-Bryan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions