Stream: t-compiler/help

Topic: rust-lld not found


osa1 (Jul 08 2020 at 12:31, on Zulip):

I made a rustc build using this config:

[llvm]
targets = "WebAssembly;X86"

[build]
target = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]

[install]

[rust]
optimize = true
debug = true
codegen-units = 0
debug-assertions = true
debuginfo-level = 2

[target.x86_64-unknown-linux-gnu]
llvm-config = "/usr/bin/llvm-config-10"

[dist]

but it fails with this error:

$ ~/rust/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustc lib.rs --target=wasm32-unknown-unknown
error: linker `rust-lld` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error

Any tips?

Tshepang Lekhonkhobe (Jul 08 2020 at 13:11, on Zulip):

had the same, and was fixed by adding rust.lld = true to config.toml

Tshepang Lekhonkhobe (Jul 08 2020 at 13:13, on Zulip):

sidenote: it was not clear whether I should that or rust.use-lld = true after reading descriptions in config.toml.example

osa1 (Jul 08 2020 at 13:32, on Zulip):

Thanks @Tshepang Lekhonkhobe , that fixed the issue. I'm not getting

$ ~/rust/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc lib.rs --target=wasm32-unknown-unknown
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to previous error

I guess I have to add wasm to host as well? (That's the only relevant field other than the ones I updated I think)

osa1 (Jul 08 2020 at 13:33, on Zulip):

That doesn't seem to work -- huge wall of error printed

Tshepang Lekhonkhobe (Jul 08 2020 at 13:34, on Zulip):

I found I had to x.py clean to avoid errors

Tshepang Lekhonkhobe (Jul 08 2020 at 13:34, on Zulip):

... no need to add wasm to host

osa1 (Jul 08 2020 at 13:38, on Zulip):

/me tries x.py clean

osa1 (Jul 08 2020 at 14:00, on Zulip):

Tried with clean -- if I add wasm to host then it doesn't build. If I don't I get a stage 2 build, but it fails with "can't find crate 'core'"

Eric Huss (Jul 08 2020 at 14:26, on Zulip):

What x.py command did you use to build the compiler?

osa1 (Jul 08 2020 at 14:26, on Zulip):

x.py build

Eric Huss (Jul 08 2020 at 14:37, on Zulip):

If you ran just x.py build, then that built a stage2 compiler, and the wasm32 target is in the stage2 directory. The error message you posted says it ran the stage1 compiler, which won't have the target.

osa1 (Jul 08 2020 at 14:37, on Zulip):

Ahh, you're right. I can compile if I use stage 2 compiler thanks.

eddyb (Jul 08 2020 at 15:36, on Zulip):

@osa1 if you want to use stage1/bin/rustc w/ the non-host targets you presumably need to pass --stage 1 to x.py build

Last update: Sep 28 2020 at 16:15UTC