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

Documentation on how to use the new cargo-std support in place of cargo xbuild #41

Closed
alex opened this issue Sep 7, 2019 · 5 comments · Fixed by rust-lang/cargo#7351

Comments

@alex
Copy link
Member

alex commented Sep 7, 2019

Now that the pieces are starting to come together, having documentation so one can play with migrating to this would be a huge boon.

@phil-opp
Copy link

phil-opp commented Sep 7, 2019

It seems like cargo build -Z build-std=core,alloc is roughly the equivalent to cargo xbuild. I just tried it and it basically works, I just needed to add rlibc as dependency (including extern crate) because the mem feature of compiler_builtins is not activated.

I'm currently looking for a way to automatically pass the -Z build-std argument through a configuration file, similar to build.rustflags in .cargo/config. Does anyone know if this is possible?

@alexcrichton
Copy link
Member

In addition to what @phil-opp wrote above there's also this comment FWIW.

Does anyone know if this is possible?

This is sort of tangentially covered by #5 to "only need" -Z build-std instead of a list of crates, but then the actual final UX of enabling the build-std logic hasn't been discussed too much, so I've opened #43 to track that.

Basically in short, it's not possible yet, you've got to pass -Z build-std to everything. We know it's not great, but the ball's now rolling!

@phil-opp
Copy link

phil-opp commented Sep 9, 2019

@alexcrichton Thanks! Something like the build.std configuration key you proposed sounds like a good solution.

One workaround I found for now is to use cargo aliases, e.g. xbuild for build -Z build-std, which is slightly more ergonomic than typing out the full -Z command.

@alexcrichton
Copy link
Member

Pointed out on #43, we forgot to add documentation to https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for this feature! Adding that should be sufficient for closing out this issue.

alexcrichton added a commit to alexcrichton/cargo that referenced this issue Sep 10, 2019
bors added a commit to rust-lang/cargo that referenced this issue Sep 11, 2019
@alex
Copy link
Member Author

alex commented Sep 11, 2019

Based on fishinabarrel/linux-kernel-module-rust#180, this seems to be working great based on the provided instruction so I'm considering this working!

@alex alex closed this as completed Sep 11, 2019
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

Successfully merging a pull request may close this issue.

3 participants