-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Simple dylib linking fails. #19680
Comments
Assuming I'm using the flags correctly, '-C prefer-dynamic':
|
Building a dynamic library defaults to statically linking all dependencies, so |
Ah, that solves it. Thank you! |
@alexcrichton I'm not able to tell cargo to use Edit: Nevermind. I read your comment a little more closely and realized a subtlety. I'm building both a dylib and a binary file with my cargo file, and it was the binary file that was creating the problems when I changed the objective to building a shared library. Removing src/main.rs fixed the error messages. Here is what I was getting: error: cannot satisfy dependencies so |
@Russell91 you may want to be sure that this is part of your Cargo.toml: [lib]
# ...
crate-types = ["rlib", "dylib", "bin"] That way the binary being generated should favor the rlib and you'll also have a dylib available to you. Otherwise I think that error message is likely working as intended, but I'd have to take a peek at the project to make sure. |
@alexcrichton, just adding "rlib" to the list of crate-type fixed the problem. |
Note that it's |
See rust-lang/rust#19680 (comment) for details on why this is necessary.
But wait, doing the |
version: rustc 0.13.0-nightly (8bca470 2014-12-08 00:12:30 +0000)
os: manjaro linux (arch)
main.rs
test_crate.rs
output
The text was updated successfully, but these errors were encountered: