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

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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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