Skip to content

Static linking is too restrictive #102

@yshui

Description

@yshui

pkg-config-rs/src/lib.rs

Lines 570 to 581 in ef356f3

fn is_static_available(name: &str, dirs: &[PathBuf]) -> bool {
let libname = format!("lib{}.a", name);
let system_roots = if cfg!(target_os = "macos") {
vec![Path::new("/Library"), Path::new("/System")]
} else {
vec![Path::new("/usr")]
};
dirs.iter().any(|dir| {
!system_roots.iter().any(|sys| dir.starts_with(sys)) && dir.join(&libname).exists()
})
}

Basically any library which falls into /usr/lib/ won't be statically linked (which is basically all libraries found by pkg-config). Why is this logic there?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions