Skip to content

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

Open

Description

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

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