-
Notifications
You must be signed in to change notification settings - Fork 25
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
Build script using std can't compile #10
Comments
That's strange. Do you have your code somewhere online so that I can test myself? |
The code for the library using the build script is here. The target specification I'm using is here if that makes any difference. |
Thanks! I'm able to reproduce it. cc @lachlansneff I think this is the same error as you had with the new version of raw_cpuid. |
That's really strange. Without the build dependencies it compiles fine, but with the build script it somehow activates the
Minimized
I think the problem is that both |
Minimal example:
In [features]
default = ["use_std"]
use_std = [] In #[cfg_attr(not(feature = "use_std"), no_std)]
pub fn return_42() -> u32 { 42 }
#[cfg(feature = "use_std")]
pub fn print_42() {
println!("{}", return_42());
} In [dependencies.foo]
path = "foo"
default-features = false
[build-dependencies.foo]
path = "foo" In #![no_std]
extern crate foo;
pub fn return_42() -> u32 {
foo::return_42()
} Compiling with
We see that The problem is that compilation for custom targets using |
I opened rust-lang/cargo#5730 for this. |
@phil-opp I run into this today -- I agree that #5730 is an issue in cargo, but I think that is not the "real cause" of this issue. The real cause is that when using My experience is that if I try to use
Here cargo is applying |
@phil-opp In your comment above beginning "that's really strange" we have this line:
Even if the issue of |
@phil-opp I think you are right -- I guess it means that OP is using |
@cbeck88 I'm not sure how OP is using |
@phil-opp So you think there's no way that cargo-xbuild can work around this, it can only be fixed upstream in cargo? |
Yes, I don't think there's a way how |
Hi, @cbeck88. It seems that the error you mentioned happened again when I build tvm in sgx. How did you solve it?
|
As of nightly 2020-02-23, Cargo should resolve dependencies correctly in this scenario when executed with |
This thread helped me figure out that adding I'm using nightly 2020-05-08, but using |
Did you ever find a solution to this problem ? I am stock in the same situation. I have a dev-dependency (serde_json) that enable the"std" feature of serde. I don't expect this feature to be enabled on non test build but it is ... |
Try enabling the unstable |
I'm trying to use a
build.rs
file with the cc crate to compile C code as part of a library I'm using in my OS. This doesn't seem to work when used with cargo-xbuild as thestd
crate doesn't exist in the sysroot:Is there a way to make the build script compilation use the host's target and default sysroot (so that the build script can actually do it's job), and then use the target passed to cargo-xbuild and the newly built sysroot for the compilation of the crate itself?
The text was updated successfully, but these errors were encountered: