Failed to run custom build command for `xkbcommon-sys v0.7.4`

After installing rust-analyzer extension in VS code on a default windows machine, I get a rust-analyzer warning the some command in xkbcommon-sys v0.7.4 failed. I put the trace in a pastebin because of new user link restrictions: [ERROR rust_analyzer::reload] failed to switch build data: cargo check failed: -

In all this noise, the actual error is:

called Result::unwrap() on an Err value: CrossCompilation', C:\Users\Adam.cargo\registry\src\\xkbcommon-sys-0.7.4\

which means this library is not configured for cross-compilation.

That crate depends on a native dependency for your operating system (in fact, it looks to be very Linux-specific). There's no such thing for WASM, so it can't work.

You need to remove this dependency from your project, or compile the project on Linux, rather than Windows or WASM.

Thank you! Your help pointed me in the right direction. Somehow I had set "": "wasm32-unknown-unknown", in my vs code settings.json and didn't realize it.

Changing that to "": "x86_64-pc-windows-msvc", solved the issue as you said :blush::tada:

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.