Skip to content

Whole archive is not working when we do static linkingΒ #179

@0xbentang

Description

@0xbentang

When I run

pkg-config --libs --static <libname>

It will wrap all the static libs with -Wl,--whole-archive ... -Wl,--no-whole-archive -Wl,--export-dynamic

But when I run it with pkg-config-rs

pkg_config::Config::new()
        .statik(true)
        .print_system_libs(true)
        .probe(<libname>)?;

All the -Wl flags are grouped in the end

... -C link-arg=-Wl,--whole-archive -C link-arg=-Wl,--no-whole-archive -C link-arg=-Wl,--export-dynamic -C link-arg=-Wl,--as-needed

It has been causing some runtime errors due to missing objects. Just curious if this is the expected behaviour, or is it I'm not using the crate correctly? Thanks in advance

Metadata

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