-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Names of intermediate files collide when running rustc in parallel #10971
Comments
This is sort of a duplicate of #10922. Does these libraries have link metadata that isn't converted to pkgids? |
lib.rs is an empty file, so there is no custom metadata. |
Then it's not really a dupe of that bug as this behavior existed before the change to pkgids. One workaround would be to change crate name inference to use the something like the last component of the path of the dirname of the file if the file has one of hte well known names (lib.rs, test.rs, main.rs and bench.rs). |
Well, note that this only affects the intermediate files. If I do this:
I get the two files (liblib-9ed81b85-0.0.rlib and liblib-9ed81b85-0.0.so) as expected. I am perfectly content with the library names being what they are. The issue is that the intermediate files are named lib.o, lib.bc and so on, for both calls to rustc. Therefore, running them in parallel leads to a race condition. In C/C++ I would have done this:
In D, which has a similar situation as Rust, I'd have used the equivalent of the
Where |
A lot has changed here, but with an empty
Which seems like a similar error. |
Triage: a slightly different error today:
|
Triage: apparently PowerShell doesn't make this easy, so I cannot attempt to reproduce. Can anyone else? |
The error from 2016 still happens on Linux. |
@rustbot claim |
I had trouble reproducing with
|
I think hashing the command line arguments would work. |
OK, I just checked that my PR does fix that (using |
Added the --temps-dir option Fixes rust-lang#10971. The new `--temps-dir` option puts intermediate files in a user-specified directory. This provides a fix for the issue where parallel invocations of rustc would overwrite each other's intermediate files. No files are kept in the intermediate directory unless `-C save-temps=yes`. If additional files are specifically requested using `--emit asm,llvm-bc,llvm-ir,obj,metadata,link,dep-info,mir`, these will be put in the output directory rather than the intermediate directory. This is a backward-compatible change, i.e. if `--temps-dir` is not specified, the behavior is the same as before.
Added the --temps-dir option Fixes rust-lang#10971. The new `--temps-dir` option puts intermediate files in a user-specified directory. This provides a fix for the issue where parallel invocations of rustc would overwrite each other's intermediate files. No files are kept in the intermediate directory unless `-C save-temps=yes`. If additional files are specifically requested using `--emit asm,llvm-bc,llvm-ir,obj,metadata,link,dep-info,mir`, these will be put in the output directory rather than the intermediate directory. This is a backward-compatible change, i.e. if `--temps-dir` is not specified, the behavior is the same as before.
…ix, r=dswij Check for fully qualified paths in `unnecessary_cast` Noticed this doesn't pick up `::std::primitive::u32` or the sort, now it does changelog: none
For example, given an empty lib.rs, this happens:
This could be fixed in two main ways.
--temps-path
) to store the intermediates in a specific locationThe text was updated successfully, but these errors were encountered: