-
Notifications
You must be signed in to change notification settings - Fork 439
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
Issue linking dynamic libraries #155
Comments
Oh typically you'll want to mange this through the build script rather than the crate itself. It looks like this is related to linking the boost runtime? If the static version can be located but the dynamic version can't that may mean you need an extra Can you gist the error messages you're seeing? |
Hmmm... I should probably mention this only happens in recent nightly versions (my app used to work a few weeks ago and just recently stopped working). I just tested: rustc 1.18.0-nightly (2564711e8 2017-04-04) works fine. So maybe this is due to some recent change in rustc/cargo? Here's the gist. Note that this is not just about Boost. I used boost in the toy example because that's a common library. In my actual application this happens with boost, mpfr, gmp, and gomp (basically all libraries that I'm dynamically linking). Also both the dynamic and static versions of boost (for the example) are in /usr/lib/, so I don't think this is a path issue. Thanks |
Hm I can't think of a change that'd affect this, but it'd be good to narrow in on the changes! This looks like it may not be a gcc-rs issue regardless, but rather a configuration or rustc/cargo issue |
Hello,
I'm having issues linking to dynamic libraries. Not sure if the problem is with rust's FFI, this crate, my system's gcc, or something else entirely.
In rust, when I declare the extern block I add
#[link(name="libname")]
but I get linking issues. If I instead add#[link(name="libname", kind="static")]
everything works fine. I created a super simple toy example to show this. I also tested compiling and linking against the dynamic library using g++ as:g++ <file.cpp> -l<libname>
and it works fine.The code is available at: https://github.com/sga001/rust-linking-issue
My gcc/g++ is version 6.3.1. I'm using Arch Linux 4.9.11. Rustc version 1.18.0-nightly (2bd4b5c6d 2017-04-23).
Thanks!
The text was updated successfully, but these errors were encountered: