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: linker rust-lld not found #52362

Closed
shishtpal opened this issue Jul 14, 2018 · 18 comments
Closed

error: linker rust-lld not found #52362

shishtpal opened this issue Jul 14, 2018 · 18 comments
Labels
A-linkage Area: linking into static, shared libraries and binaries

Comments

@shishtpal
Copy link

shishtpal commented Jul 14, 2018

I installed Rust on my Raspberry pi3 but when i tried hello-world example from this page.
https://rustwasm.github.io/book/hello-world.html
it shows this error

pi@raspberrypi:~/RustTuts/hello-world $ 
cargo +nightly build --target wasm32-unknown-unknown --release --verbose
   
Compiling hello-world v0.1.0 (file:///home/pi/RustTuts/hello-world)
     
Running `rustc --crate-name hello_world src/lib.rs --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C metadata=c2b67d4c4ad89cb4 --out-dir /home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps -L dependency=/home/pi/RustTuts/hello-world/target/release/deps`

error: linker `rust-lld` not found                                       ] 0/1: hello-world
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

error: Could not compile `hello-world`.

Caused by:
  process didn't exit successfully: `rustc --crate-name hello_world src/lib.rs --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C metadata=c2b67d4c4ad89cb4 --out-dir /home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps -L dependency=/home/pi/RustTuts/hello-world/target/release/deps` (exit code: 101)

@steveklabnik
Copy link
Member

Hm, there was some changes around this recently: intermezzOS/kernel@f341033

But that's in target specs, which you don't have.

What's your `rustc +nightly --version'?

@shishtpal
Copy link
Author

pi@raspberrypi:~ $ rustc +nightly --version
rustc 1.29.0-nightly (64f7de9 2018-07-12)

@mati865
Copy link
Contributor

mati865 commented Jul 30, 2018

Looks like docs are outdated, could you try installing llvm-tools-preview component?

rustup component add llvm-tools-preview --toolchain=nightly

@ZoeyR
Copy link

ZoeyR commented Jul 31, 2018

I'm seeing the same thing. This may be specific to the arm toolchains since it doesn't occur on my x64 linux machine.

@shishtpal
Copy link
Author

@mati865 I installed llvm-tools-preview but error remains the same

pi@raspberrypi:~/RustTuts/hello-world $ rustup component add llvm-tools-preview --toolchain=nightly
info: downloading component 'llvm-tools-preview'
332.7 KiB / 332.7 KiB (100 %) 135.7 KiB/s ETA:   0 s
info: installing component 'llvm-tools-preview'
pi@raspberrypi:~/RustTuts/hello-world $ cargo +nightly build --target wasm32-unknown-unknown --release --verbose
   Compiling hello-world v0.1.0 (file:///home/pi/RustTuts/hello-world)
     Running `rustc --crate-name hello_world src/lib.rs --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C metadata=c2b67d4c4ad89cb4 --out-dir /home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps -L dependency=/home/pi/RustTuts/hello-world/target/release/deps`
error: linker `rust-lld` not found                                       ] 0/1: hello-world
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

error: Could not compile `hello-world`.

Caused by:
  process didn't exit successfully: `rustc --crate-name hello_world src/lib.rs --crate-type cdylib --emit=dep-info,link -C opt-level=3 -C metadata=c2b67d4c4ad89cb4 --out-dir /home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps --target wasm32-unknown-unknown -L dependency=/home/pi/RustTuts/hello-world/target/wasm32-unknown-unknown/release/deps -L dependency=/home/pi/RustTuts/hello-world/target/release/deps` (exit code: 101)

@mati865
Copy link
Contributor

mati865 commented Aug 1, 2018

Indeed issue affects arm but not x86.
For x86_64 rust-lld is located in /rust-nightly-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin/ while on arm /rust-nightly-x86_64-unknown-linux-gnu/rustc/lib/rustlib/x86_64-unknown-linux-gnu/bin/ doesn't even exist.

@ZoeyR
Copy link

ZoeyR commented Aug 2, 2018

the directory does exist on mine, but that was after I installed the llvm tools. It doesn't contain the rust-lld though so I'm guessing it doesn't ship on arm. I wonder if that's an underlying issue with lld or it just hasn't been packaged into rust for arm yet.

Edit: I found out why it isn't built: --enable-full-tools isn't passed in for arm builds.

@mati865
Copy link
Contributor

mati865 commented Aug 2, 2018

As per #48125 rust-lld is shipped only for Tier 1 platforms.
If somebody knows if it's fine to enable it for ARMs builds it's @japaric

@japaric
Copy link
Member

japaric commented Aug 2, 2018

@mati865

If somebody knows if it's fine to enable it for ARMs builds it's @japaric

actually that would be @alexcrichton. If it were for me I would enable LLD everywhere it can be built but I don't know how that would affect CI time.

PR #48125 says:

Like Emscripten the LLD target is currently only enabled for Tier 1 platforms,
notably OSX/Windows/Linux, and will need to be installed manually for compiling
to wasm on other platforms.

So you would have to install LLD on ARM Linux if want to compile to wasm. After #51936 you would have to pass -C linker=lld to rustc to use system LLD, or we would have to add logic to rustc to make it fallback to system LLD if rust-lld is not available in the sysroot. However, system LLD may not work if it's "too old" (e.g. installed via package manager) because, as of #51966, the wasm target expects LLD ~7.0.

@alexcrichton
Copy link
Member

Yes currently we unfortunately don't have enough time on CI to produce these artifacts for all platforms, only those with self-hosted compilers (which build one fewer compiler than the cross-compiled platforms)

@berkus
Copy link
Contributor

berkus commented Feb 3, 2019

Bah... compiling rust-lld on a rpi3 might prove difficult/more time consuming that on CI. 😭

@vielmetti
Copy link

I've run into this problem in that I can't generate wasm on arm64.

I'm testing this change to the build flags to see just how long Travis will take: https://github.com/vielmetti/rust/pull/1/commits/684f997e40038729d865e6e0cab59b8f50b99f79

@vielmetti
Copy link

Based on Plume-org/Plume#394 I can recommend this script as being suitable for installing the lld dependency:

https://github.com/mcrosson/Plume/blob/master/script/wasm-deps.sh

and then you invoke with RUSTFLAGS="-C linker=lld" cargo buildper the example at

https://github.com/mcrosson/Plume/blob/master/script/plume-front.sh

The note in the PR at Plume-org/Plume#402 says

  • The rust wasm packages do NOT include rustc-lld for arm
  • The lld binaries published by llvm.org will NOT build plume-front with linker=lld rust args
  • lld built from sources (what this patch does) on arm DOES build plume-front with linker=lld rust args

@lukateras
Copy link

For the record, LLVM 8 lld is good enough, but LLVM 7 lld isn't. In Nix, one can just add llvmPackages_8.lld to nativeBuildInputs and set RUSTFLAGS = "-C linker=lld"; in the derivation.

@Mark-Simulacrum
Copy link
Member

I'm going to close this as it's not really an actionable issue at this point.

@reynoldsbd
Copy link

@alexcrichton I know the Rust's CI situation has changed a bit since this issue was first opened. Is it still the case that there isn't enough CI time available to build LLVM tools for (at least some) tier 2 platforms?

@alexcrichton
Copy link
Member

Unfortunately we haven't had any major changes to CI in the meantime.

@phil-opp
Copy link
Contributor

I don't want to spam this issue, but I wanted to ask if the situation maybe changed with the switch to GitHub actions?

Also, is there any tracking issue for things blocked on CI capacity? In a quick search, I found #42639, #57438, and #59637, but there are probably more.

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
Projects
None yet
Development

No branches or pull requests