nix-community / fenix

Rust toolchains and rust-analyzer nightly for Nix [maintainer=@figsoda]
Mozilla Public License 2.0
608 stars 39 forks source link

For non-Rustup setups, the wasm32-unknown-unknown target needs to be installed manually #112

Closed deser closed 1 year ago

deser commented 1 year ago

Any suggestions why it doesn't work?

[INFO]: 🎯  Checking for the Wasm target...
Error: wasm32-unknown-unknown target not found in sysroot: "/nix/store/6g30r9aqi7q43mjxvgkg3956ss2ykdm7-rust-stable-with-components-2023-06-01"

Used rustc from the following path: "/nix/store/6g30r9aqi7q43mjxvgkg3956ss2ykdm7-rust-stable-with-components-2023-06-01/bin/rustc"
It looks like Rustup is not being used. For non-Rustup setups, the wasm32-unknown-unknown target needs to be installed manually. See https://rustwasm.github.io/wasm-pack/book/prerequisites/non-rustup-setups.html on how to do this.

Caused by: wasm32-unknown-unknown target not found in sysroot: "/nix/store/6g30r9aqi7q43mjxvgkg3956ss2ykdm7-rust-stable-with-components-2023-06-01"
figsoda commented 1 year ago

You can install it like this

(with fenix; combine [
  minimal.cargo
  minimal.rustc
  targets.wasm32-unknown-unknown.latest.rust-std
])
deser commented 1 year ago

Thanks for prompt response.

Sorry, I'm noob. I have


buildInputs = [
      (fenix.stable.withComponents [
          "cargo"
          "clippy"
          "rust-src"
          "rustc"
          "rustfmt"
      ])
      rust-analyzer-nightly
    ];

Where should I add it?

figsoda commented 1 year ago

you can do something like this

  buildInputs = [
    (with fenix; with stable; combine [
      cargo
      clippy
      rust-src
      rustc
      rustfmt
      targets.wasm32-unknown-unknown.stable.rust-std
    ])
    rust-analyzer-nightly
  ];
deser commented 1 year ago

Thanks a lot!

deser commented 1 year ago

Sorry again, maybe you know what can I do with

  = note: ld: library not found for -liconv
          clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

?

I'm using wasm-pack

figsoda commented 1 year ago

you would need to add libiconvto buildInputs

deser commented 1 year ago

Man, I owe you a beer! :) Thank you very much!