Skip to content

static-nobundle option #143

Open
Open

Description

In use cases where rust code is used to build a static library

[lib]
crate-type = ["staticlib"]

which is then integrated into a bigger shared library that includes some C/C++ code as well, and both the rust and the C/C++ parts depend on a common static library, the only possible way to make the build process work without the linker complaining about duplicate symbols is to compile and link the rust static library with the

cargo:rustc-link-lib=static-nobundle=<common-static-lib>

option, briefly described in here

Going with the classic

cargo:rustc-link-lib=static=<common-static-lib>

makes rustc include symbols coming from <common-static-lib> which will then conflict during the final linking process of C/C++/Rust shared library.
The temporary solution for such cases is to do an intermediate step to strip away symbols belonging to <common-static-lib> from the rust static library.

Would it be possible to somehow include the static-nobundle option in pkg-config ?

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