Skip to content

Names of intermediate files collide when running rustc in parallel #10971

Description

@SiegeLord

For example, given an empty lib.rs, this happens:

rustc --lib lib.rs & rustc --rlib lib.rs
error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64' '-L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib' '-o' 'liblib-9ed81b85-0.0.so' 'lib.o' 'lib.metadata.o' '-Wl,--as-needed' '-L/tmp/.rust' '-L/tmp' '-L/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib' '-lstd-04ff901e-0.9-pre' '-lrt' '-ldl' '-lm' '-lpthread' '-lstdc++' '-shared' '-lmorestack' '-Wl,-rpath,$ORIGIN/../usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib' '-Wl,-rpath,/usr/local/lib/rustc/x86_64-unknown-linux-gnu/lib'
note: /usr/bin/ld: reopening lib.o: No such file or directory

/usr/bin/ld: final link failed: No such file or directory
collect2: error: ld returned 1 exit status

error: aborting due to previous error
task 'rustc' failed at 'explicit failure', /home/siege/src/rust2/src/libsyntax/diagnostic.rs:102
task '<main>' failed at 'explicit failure', /home/siege/src/rust2/src/librustc/lib.rs:398

This could be fixed in two main ways.

  1. Add an option (e.g. --temps-path) to store the intermediates in a specific location
  2. Add some kind of hash to the names of the intermediates to stop them from colliding. Can't just be the pkgid hash, as it'd still fail the above test.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-linkageArea: linking into static, shared libraries and binariesC-enhancementCategory: An issue proposing an enhancement or a PR with one.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions