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

cargo nightly build with RUSTFLAGS having --remap-path-prefix broke since last nightly on Windows #7211

Closed
pocesar opened this issue Aug 5, 2019 · 6 comments · Fixed by #7219
Labels
C-bug Category: bug

Comments

@pocesar
Copy link

pocesar commented Aug 5, 2019

Problem

When using remap-path-prefix before, I was able to set the paths to a common root like : "build/src/", now the generated .d files had wrong paths when trying to set the RUSTFLAGS with remap-path-prefix and cargo fails with:

   Compiling proc-macro2 v0.4.30
   Compiling unicode-xid v0.1.0
   Compiling serde v1.0.98
error: could not parse/generate dep info at: C:\ard\target\debug\deps\unicode_xid-d89e93a95ce7a9a5.d

Caused by:
  The system cannot find the path specified. (os error 3)
warning: build failed, waiting for other jobs to finish...
error: could not parse/generate dep info at: C:\ard\target\debug\build\serde-cbe4cec761dd61b5\build_script_build-cbe4cec761dd61b5.d

Caused by:
  The system cannot find the file specified. (os error 2)
warning: build failed, waiting for other jobs to finish...
error: could not parse/generate dep info at: C:\ard\target\debug\build\proc-macro2-c6a71a674b70c483\build_script_build-c6a71a674b70c483.d

Caused by:
  The system cannot find the file specified. (os error 2)
build failed, exit code 101 null

So at the moment, the builds are non reproducible (for me at least)

Steps

  1. Setup a simple bin with any dependencies, put some code that uses it
  2. set RUSTFLAGS=--remap-path-prefix=C:\ard\=\build\src\ on the console
  3. try to cargo build

N.B: used to work fine before
PS: if you put "quotes" around the value as in "C:\ard\=\build\src\", the remap fails

Possible Solution(s)

It seems that some commits regarding the remap-path-prefix and dealing with Windows paths, might have broken it:

d99b7fe
1140c52
c8a9f88
65e3885
3595de3
4f6553a

Notes

Output of cargo version: cargo 1.38.0-nightly (26092da 2019-07-31)

Windows 10 x64
rustc 1.38.0-nightly (d3f8a0b5d 2019-08-04)

@pocesar pocesar added the C-bug Category: bug label Aug 5, 2019
@pocesar pocesar changed the title cargo nightly build with RUSTFLAGS having --remap-path-prefix broke since last update on Windows cargo nightly build with RUSTFLAGS having --remap-path-prefix broke since last nightly on Windows Aug 5, 2019
@ehuss
Copy link
Contributor

ehuss commented Aug 5, 2019

Thanks for the report. I'm having a hard time reproducing the issue. Can you tell me which terminal you are using (cmd, powershell, mingw, etc.) and exactly which commands you ran? Also, does it happen with any project, or does it require certain dependencies?

@pocesar
Copy link
Author

pocesar commented Aug 5, 2019

I'll try to make a minimal repro, meanwhile, if I set to --remap-path-prefix=C:\ard\=, it works as before (which has the same reproducible result but the paths are empty)

@alexcrichton
Copy link
Member

@ehuss I think this may be caused by #7030 where we're expecting absolute paths coming out of the compiler but actually the dep-info files are likely lying since they're respecting remap-path-prefix which means they point to paths which don't exist...

cc @Mark-Simulacrum, you're likely interested in this as well

@Mark-Simulacrum
Copy link
Member

That's quite likely, yes, I wasn't aware that dep-info files are remapped by --remap-path-prefix, in fact that feels a bit odd? Presumably independent of the mapped path in the binary and such you'd want Cargo to receive the real on-the-disk path...

@ehuss
Copy link
Contributor

ehuss commented Aug 6, 2019

I see what's happening. It's due to this line I added to canonicalize the path. I'll post a PR to try to work around it.

As to whether or not the .d file should include remapped files or not is a rustc issue. I'll file an issue over there to track that.

@ehuss
Copy link
Contributor

ehuss commented Aug 6, 2019

Posted #7219 with a fix.

Posted rust-lang/rust#63329 for the rustc side. Rebuild detection is broken in Cargo when using --remap-path-prefix, so if/when it is fixed, we should probably add a test for that.

bors added a commit that referenced this issue Aug 6, 2019
Fix remap-path-prefix from failing.

rustc currently remaps the source paths in the dep-info file, causing them to potentially point to a non-existent path. This causes the call to `canonicalize` added in #7137 to fail.  Just ignore the error.

Closes #7211
@bors bors closed this as completed in #7219 Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants