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

Cannot link static libraries on Windows MinGW because the Libs.private flags are ignored #152

Open
amyspark opened this issue Aug 19, 2023 · 0 comments

Comments

@amyspark
Copy link
Contributor

Hi,

I'm testing GStreamer's gst-plugins-rs integration in Windows. I got a linker failure when linking against the GStreamer bindings, which does not seem to have an apparent cause (logs in the gist here, since the linker line is massive).

However, upon looking at the reference to CoTaskMemFree, I recalled I'd seen this failure before when testing nuwen.net's flavor of GCC. The probe code here:

pkg-config-rs/src/lib.rs

Lines 395 to 404 in 576f550

let output = self
.run(name, &["--libs", "--cflags"])
.map_err(|e| match e {
Error::Failure { command, output } => Error::ProbeFailure {
name: name.to_owned(),
command,
output,
},
other => other,
})?;

never checks if the library being linked is dynamic or static. If it's the latter, then the objects in Libs.private need to be taken into account, and the --static flag must be passed to pkg-config. Otherwise, those symbols are never resolved. I believe this was written implicitly assuming the ELF model of static libraries.

cc @nirbheek

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