-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add new feature flag "static" #159
Conversation
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
Not sure why the CI for windows i686 failed. |
@@ -200,7 +200,9 @@ fn main() { | |||
} | |||
|
|||
// println!("cargo:rustc-link-lib=zstd"); | |||
let (defs, headerpaths) = if cfg!(feature = "pkg-config") { | |||
let (defs, headerpaths) = if cfg!(feature = "pkg-config") | |||
&& !cfg!(feature = "static") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should make it an error to have both pkg-config and static features, rather than silently dropping one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer static
to override pkg-config
, since it is possible for one dependency to request pkg-config
and another to request static
.
In this situation, it is not always possible to modify or it maybe hard to remove that and I would prefer statically linked to dynamically linked zstd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a dependency asks for pkg-config, we should honor this decision and not discard it.
Though in general asking for pkg-config
is not something re-usable libraries should be doing, it's more of a end-of-the-line binary decision.
Note that static linking is already the default.
The main reason to add a static feature (and it may be a valid one!) is to detect if the situation ever changes: if some dependency starts requiring Also note that pkg-config does not have to result in dynamic linking. It will try static linking if the In that case, it may be better to detect when pkg-config fails to enable static linking (it uses a private function to check that), and only then trigger a build failure. |
@gyscos I just realized that |
It's an unfortunate decision, as it does not appear to make this very visible to the caller. Seems like there's some demand to change things, but nothing done so far: rust-lang/pkg-config-rs#68 |
Resolved #158
Signed-off-by: Jiahao XU Jiahao_XU@outlook.com