Skip to content

Linking error with --emit=obj,metadata #67294

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
0dvictor opened this issue Dec 14, 2019 · 2 comments
Closed

Linking error with --emit=obj,metadata #67294

0dvictor opened this issue Dec 14, 2019 · 2 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries A-metadata Area: Crate metadata C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@0dvictor
Copy link
Contributor

rustc --emit=obj,metadata helloworld.rs generates a linking error as below:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L"
... 
,-Bdynamic" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-lutil"
  = note: cc: error: helloworld.helloworld.7rcbfp3g-cgu.0.rcgu.o: No such file or directory
error: aborting due to previous error

Both rustc --emit=obj helloworld.rs and rustc --emit=metadata helloworld.rs work.

To reproduce, the code of helloworld.rs is:

// This is the main function
fn main() {
    println!("Hello World!");
}
@0dvictor 0dvictor changed the title Linking error with --emit=llvm-bc,metadata Linking error with --emit=obj,metadata Dec 14, 2019
@0dvictor
Copy link
Contributor Author

--emit=[llvm-bc|llvm-ir|asm],metadata also generates similar error.

@jonas-schievink jonas-schievink added A-linkage Area: linking into static, shared libraries and binaries A-metadata Area: Crate metadata C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 14, 2019
@ehuss
Copy link
Contributor

ehuss commented Jan 26, 2021

I believe this is now fixed via #81118.

@ehuss ehuss closed this as completed Jan 26, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-linkage Area: linking into static, shared libraries and binaries A-metadata Area: Crate metadata C-bug Category: This is a bug. 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

3 participants