Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang-sys features not additive #128

Open
jethrogb opened this issue Apr 14, 2021 · 0 comments
Open

Clang-sys features not additive #128

jethrogb opened this issue Apr 14, 2021 · 0 comments

Comments

@jethrogb
Copy link

jethrogb commented Apr 14, 2021

If you have two different dependencies that both depend on clang-sys, but dependency A uses static linking and dependency B using dynamic linking, this will fail to build.

You can test this easily with the following Cargo.toml:

[dependencies]
bindgen57 = { version = "0.57", package = "bindgen", default-features = false, features = ["static"] }
bindgen58 = { version = "0.58", package = "bindgen", default-features = false, features = ["runtime"] }

Cargo features are supposed to be additive, i.e. one crate in your dependency tree should never fail to build because another crate elsewhere in your dependency tree enables some feature.

There's also a related issue where if you do something like this:

[dependencies]
bindgen57 = { version = "0.57", package = "bindgen", default-features = false }
bindgen58 = { version = "0.58", package = "bindgen", default-features = false, features = ["runtime"] }

This will build, but it will panic at runtime:

thread 'main' panicked at 'a `libclang` shared library is not loaded on this thread', .../.cargo/registry/src/github.com-1ecc6299db9ec823/clang-sys-1.2.0/src/lib.rs:1682:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant