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

rustc fails in the linker when compiling foo.rs with a sibling directory called foo #13098

Closed
huonw opened this issue Mar 23, 2014 · 4 comments
Closed
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@huonw
Copy link
Member

huonw commented Mar 23, 2014

$ echo 'fn main() {}' > foo.rs
$ mkdir foo
$ rustc foo.rs
error: linking with `cc` failed: exit code: 1
note: cc arguments: '-m64' '-L/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-o' 'foo' 'foo.o' '-lmorestack' '-nodefaultlibs' '-Wl,--as-needed' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgreen-2892ff35-0.10-pre.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-413a5926-0.10-pre.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustuv-0d450bab-0.10-pre.rlib' '/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-31b43f22-0.10-pre.rlib' '-L/home/huon/tmp/.rust' '-L/home/huon/tmp' '-L/home/huon/.rust' '-lpthread' '-lrt' '-lc' '-ldl' '-lm' '-lpthread' '-lgcc_s' '-Wl,-rpath,$ORIGIN/../../../usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-Wl,-rpath,/usr/local/lib/rustlib/x86_64-unknown-linux-gnu/lib' '-lcompiler-rt'
note: /usr/bin/ld: cannot open output file foo: Is a directory
collect2: error: ld returned 1 exit status

error: aborting due to previous error
@pnkfelix
Copy link
Member

I assume the desired behavior here is that we should check well ahead of time if any file/directory already exists at the path for the output build product, and fail with an error then instead of waiting until we get this far into it?

@huonw
Copy link
Member Author

huonw commented Mar 23, 2014

That would make the error messages nicer, yes.

@steveklabnik
Copy link
Member

Triage: same today.

@steveklabnik
Copy link
Member

Triage: no change.

@steveklabnik steveklabnik added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 20, 2017
bors added a commit that referenced this issue Feb 6, 2018
…y, r=estebank

Warn when rustc output conflicts with existing directories

When the compiled executable would conflict with a directory, display a
rustc error instead of a verbose and potentially-confusing linker
error. This is a usability improvement, and doesn’t actually change
behaviour with regards to compilation success. This addresses the
concern in #35887. Fixes #13098.
bors added a commit that referenced this issue Feb 6, 2018
…y, r=estebank

Warn when rustc output conflicts with existing directories

When the compiled executable would conflict with a directory, display a
rustc error instead of a verbose and potentially-confusing linker
error. This is a usability improvement, and doesn’t actually change
behaviour with regards to compilation success. This addresses the
concern in #35887. Fixes #13098.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants