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

RUSTFLAGS + a sysroot with spaces in its path = 😭 #54856

Closed
steveklabnik opened this issue Oct 5, 2018 · 3 comments
Closed

RUSTFLAGS + a sysroot with spaces in its path = 😭 #54856

steveklabnik opened this issue Oct 5, 2018 · 3 comments

Comments

@steveklabnik
Copy link
Member

When using cargo-xbuild to do things like "build an OS", you need to set the sysroot via RUSTFLAGS.

Here's an example rustc invocation on my machine that builds:

rustc --crate-name ux "C:\Users\Steve Klabnik\.cargo\registry\src\git.luolix.top-1ecc6299db9ec823\ux-0.1.2\src\lib.rs" --color always --crate-type lib --emit=dep-info,link -C panic=abort -C debuginfo=2 -C metadata=b446262c41a4777f -C extra-filename=-b446262c41a4777f --out-dir "C:\Users\Steve Klabnik\src\intermezzos\kernel\target\intermezzos\debug\deps" --target "\\?\C:\Users\Steve Klabnik\src\intermezzos\kernel\intermezzos.json" -L "dependency=C:\Users\Steve Klabnik\src\intermezzos\kernel\target\intermezzos\debug\deps" -L "dependency=C:\Users\Steve Klabnik\src\intermezzos\kernel\target\debug\deps" --cap-lints allow --sysroot "C:\Users\Steve Klabnik\src\intermezzos\kernel\target\sysroot"

The last bit is the important part:

--sysroot "C:\Users\Steve Klabnik\src\intermezzos\kernel\target\sysroot"

It appears the space in my username causes this to be impossible to set via RUSTFLAGS. With an invocation like this:

~\src\intermezzos\kernel [master ↑1]> $env:RUSTFLAGS="--sysroot ""C:\Users\Steve Klabnik\src\intermezzos\kernel\target\sysroot"""
~\src\intermezzos\kernel [master ↑1]> $env:RUSTFLAGS
--sysroot "C:\Users\Steve Klabnik\src\intermezzos\kernel\target\sysroot"

You can see that it's all good. However, this fails when passed to rustc:

> cargo build
error: failed to run `rustc` to learn about target-specific information

Caused by:
  process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --sysroot "\"C:\Users\Steve" "Klabnik\src\intermezzos\kernel\target\sysroot\"" --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro` (exit code: 1)
--- stderr
error: multiple input filenames provided

I am not sure what to do here.

@nagisa
Copy link
Member

nagisa commented Oct 5, 2018

This is a cargo issue I think.

@steveklabnik
Copy link
Member Author

steveklabnik commented Oct 5, 2018 via email

@steveklabnik
Copy link
Member Author

Yep, I think this is a Cargo issue. Closing in favor of rust-lang/cargo#6139

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

No branches or pull requests

2 participants