Skip to content

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

Closed
@huonw

Description

@huonw
Member
$ 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

Activity

pnkfelix

pnkfelix commented on Mar 23, 2014

@pnkfelix
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

huonw commented on Mar 23, 2014

@huonw
MemberAuthor

That would make the error messages nicer, yes.

steveklabnik

steveklabnik commented on Jan 23, 2015

@steveklabnik
Member

Triage: same today.

steveklabnik

steveklabnik commented on Feb 2, 2016

@steveklabnik
Member

Triage: no change.

added
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
on Mar 9, 2017
added a commit that references this issue on Feb 6, 2018

Auto merge of #47203 - varkor:output-filename-conflicts-with-director…

dd7be09

4 remaining items

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@pnkfelix@huonw@Mark-Simulacrum

        Issue actions

          rustc fails in the linker when compiling `foo.rs` with a sibling directory called `foo` · Issue #13098 · rust-lang/rust