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

error: linking with rust-lld failed: exit status: 1 #9989

Closed
Hankappa opened this issue Oct 21, 2021 · 4 comments
Closed

error: linking with rust-lld failed: exit status: 1 #9989

Hankappa opened this issue Oct 21, 2021 · 4 comments
Labels
C-bug Category: bug

Comments

@Hankappa
Copy link

Hankappa commented Oct 21, 2021

Problem

Hi I following the https://lowenware.com/blog/osdev/aarch64-bare-metal-program-in-rust/
try to test aarch64 bare-metal under QEMU.
Seems meet error and I can't find how to solution.
(I've try a lot way from google search....)

~/.cargo/bin/aarch64-bare-metal$ rustup target add aarch64-unknown-none
info: component 'rust-std' for target 'aarch64-unknown-none' is up to date
~/.cargo/bin/aarch64-bare-metal$ cargo -v xbuild --target=aarch64-unknown-none.json
error: failed to run rustc to learn about target-specific information

Caused by:
process didn't exit successfully: rustc - --crate-name ___ --print=file-names -Cembed-bitcode=yes --target /home/hank/.cargo/bin/aarch64-bare-metal/aarch64-unknown-none.json --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg (exit status: 1)
--- stderr
error: Error loading target specification: may not set is_builtin for targets not built-in. Run rustc --print target-list for a list of built-in targets

error: "/home/hank/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo" "rustc" "-p" "alloc" "--release" "--manifest-path" "/tmp/cargo-xbuildsuBC5o/Cargo.toml" "--target" "aarch64-unknown-none.json" "--" "-Z" "force-unstable-if-unmarked" failed with exit code: Some(101)

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

~/.cargo/bin/aarch64-bare-metal$ cargo version --verbose
cargo 1.57.0-nightly (c7957a74b 2021-10-11)
release: 1.57.0
commit-hash: c7957a74bdcf3b11e7154c1a9401735f23ebd484
commit-date: 2021-10-11
host: x86_64-unknown-linux-gnu
libgit2: 1.3.0 (sys:0.13.23 vendored)
libcurl: 7.79.1-DEV (sys:0.4.49+curl-7.79.1 vendored ssl:OpenSSL/1.1.1l)
os: Ubuntu 18.04 (bionic) [64-bit]
@Hankappa Hankappa added the C-bug Category: bug label Oct 21, 2021
@Eh2406
Copy link
Contributor

Eh2406 commented Oct 21, 2021

What command did you run that gave you that error message? What did you do to set up the environment?

sorry I see it now.

@ehuss
Copy link
Contributor

ehuss commented Oct 22, 2021

You need to remove the is_builtin field from the aarch64-unknown-none.json target spec file. That field is no longer allowed to be set (rust-lang/rust#86062), so it needs to be removed if you are building the spec from --print target-spec-json.

Closing as this isn't related to cargo. If you have further issues with getting started with some bare metal development, I suggest trying one of the user forums or chat platforms like discord.

@ehuss ehuss closed this as completed Oct 22, 2021
@Hankappa
Copy link
Author

Okay~~Many thanks for your help.

@quinn-dougherty
Copy link

quinn-dougherty commented Aug 17, 2022

I encountered this when I tried to wasm_bindgen a struct. It comes with this note: note: rust-lld: error: unknown file type: exp.o

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

4 participants