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

Specifying build target #23

Closed
ethindp opened this issue Jun 12, 2021 · 4 comments
Closed

Specifying build target #23

ethindp opened this issue Jun 12, 2021 · 4 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@ethindp
Copy link

ethindp commented Jun 12, 2021

I'm building an OS kernel and use rust-script for some build tasks. However, cargo's config.toml file is still used for the script, and that TOML file contains actions for building parts of the rust standard library (core, alloc, ...). (This is a known issue for cargo.) Is there a way of getting around this? I'm using cargo-make, and I'd explicitly like the build script I use to not be influenced by anything in .cargo/config.toml.

@fornwall fornwall added help wanted Extra attention is needed question Further information is requested labels Jul 10, 2021
@fornwall
Copy link
Owner

@ethindp Have you found any way around this?

Does anyone know of a workaround (either to apply manually, or that can be added to rust-script)?

@Hecatron
Copy link

Hecatron commented Oct 30, 2021

I ran into this problem recently, I have a project setup which targets an embedded device with a specific platform.
But also a subdirectory inside that with a rust based script I'd like to run
unfortunately it looks like cargo searches up the directory tree for .config/config.toml in any of the parent directories which then influences how the script is built (which typically in my case is for the wrong target)

Under windows I had to use the -o option to see the compile fail message

I suspect it might be related to
rust-lang/cargo#8643
https://github.com/rust-lang/cargo/blob/master/src/doc/src/reference/config.md

@chemicstry
Copy link

I also stumbled on this problem. You can solve it by using unstable package.forced-target option (added in rust-lang/cargo#9030) in Cargo.toml instead of setting target in .cargo/config.toml. It's nightly only, but it works.

@fornwall
Copy link
Owner

But also a subdirectory inside that with a rust based script I'd like to run
unfortunately it looks like cargo searches up the directory tree for .config/config.toml in any of the parent directories which then influences how the script is built (which typically in my case is for the wrong target)

The just released version 0.23.0 avoids building the project in the current working directory (instead standing inside of the generated package), so should fix this. Let me know if any problem remains!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants