median blog

Compiling Bevy and Comfy on WSL

I was attempting to follow the getting started of bevy and comfy on WSL. In both cases, due to WGPU getting a little confused about the environment being linux but also windows, a window would open and then promptly crash with an Invalid Surface error.

After a lot of digging trying to get WGPU to work on WSL I remembered one of the cooler parts of WSL is you can run an exe. I installed the rust toolchain for windows, built for that target and presto. Things work.

If you're similarly stuck I ran:

rustup target add x86_64-pc-windows-gnu
sudo apt-get install mingw-w64
cargo run --target x86_64-pc-windows-gnu

A few installs later, I had a compiled exe running from WSL. That way I can keep using WSL and neovim to write code.

This works as of today (Jan 25 2024) but WGPU, Bevy and Comfy are all in active development so things may get better/worse in the future.

Good luck.