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

static-nobundle option #143

Open
lightyear15 opened this issue Jan 17, 2023 · 0 comments
Open

static-nobundle option #143

lightyear15 opened this issue Jan 17, 2023 · 0 comments

Comments

@lightyear15
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant