-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
--crate-type cdylib causes errors looking for rlib dependencies #10356
Comments
Relevant tracking issue: #10083 |
The root cause is that #10093 handles rustc's Here is a simple patch for // object code must be useful in some fashion
&& !dep.requires_upstream_objects()
&& dep.mode == CompileMode::Build
+ && !self.bcx.rustc_crate_types_args_for(parent)
+ .map_or(false, |v| v.iter()
+ .map(|s| s.into())
+ .any(|ty: super::CrateType| ty.requires_upstream_objects()))
+} However, there are lots of places calling An intuitive solution is setting crate types into @ehuss Any insight into this? |
EDIT: I misused (P.S. if you want an example you can see the past edit of this comment) |
I feel like you didn't use Could you try |
Oh I see. Glad you figured it out :) |
Problem
When running
cargo rustc --crate-type cdylib -Z unstable-options
, I see errors that dependencies were expected to be available inrlib
format. If I put the crate-type in theCargo.toml
, I don't see these errors.Output:
Steps
Here's a minimal repro:
http = "*"
works.lib.rs
, addpub extern "C" fn yeet() { println!("{:?}", http::StatusCode::OK) }
.cargo rustc --crate-type cdylib -Z unstable-options
.I originally discovered this by trying to convert hyper to use it:
[lib]
andcrate-type = ["cdylib", "staticlib", "lib"]
lines.cargo rustc --crate-type cdylib -Z unstable-options
.Possible Solution(s)
No response
Notes
Cargo.toml
, then hyper builds properly.Version
The text was updated successfully, but these errors were encountered: