I’m working on a Rust library and I tried adding the following flake.nix file so I can get a development shell with all needed dependencies:
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let
pkgs = import nixpkgs { inherit system; };
in
{
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustup
wasm-bindgen-cli
wasm-pack
binaryen
protobuf
];
};
}
);
}
When I try to compile to WASM by running cargo build --target wasm32-unknown-unknown --release
, I get an error but I have no idea what it is saying.
Compiling shared v0.1.0 (/home/user/src/lib)
error: linking with `rust-lld` failed: exit status: 1
|
= note: LC_ALL="C" PATH=" <I omitted this due to the character limit on discourse>
= note: rust-lld: error: unknown file type: /home/user/src/lib/target/wasm32-unknown-unknown/release/deps/libsecp256k1_sys-73da753343bc1281.rlib(lax_der_parsing.o)
error: could not compile `shared` due to previous error
Could someone please help me understand what this error means?
I am new to Rust so it could just be something simple I’m getting wrong.
I have also put a reproducible copy on GitHub: GitHub - emccorson/shared
I had to omit part of the error message due to the character limits on Discourse, but the full message is in the GitHub README.