Trying to run roc on WSL Ubuntu 20.04 with X11 installed (xcalc works). Getting this error:
viktor@SIRIUS:~$ roc
[2022-04-20T22:22:33Z ERROR wgpu_hal::vulkan::instance] enumerate_adapters: Initialization of a object has failed
thread 'main' panicked at 'Error in Surface::configure: requested format Bgra8Unorm is not in list of supported formats: [Rgba8UnormSrgb, Bgra8UnormSrgb]', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.11.0/src/backend/direct.rs:204:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Have you got this error as well?
Found only this issue which may be related, looks like something with Rust and X: https://github.com/lapce/lapce/issues/53
so roc
with no arguments launches the editor - try roc help
to use the command line
I attempted to launch the editor, actually. The CLI works.
ah I see - @Folkert de Vries is this the error you see on Linux?
yeah, or it's very similar at least
@Viktor Ferenczi I have a fix in the works for the Bgra8Unorm
issue, I'll try to finish that next week.
@Richard Feldman I've removed your message to prevent confusing Viktor.
@Viktor Ferenczi the fix is available on the color_format_support
branch, can you give it a try?
I'm currently trying to build Roc on WSL. When I run cargo build
, it throws an error about not being able to find a zig installation. I checked, and zig is definitely on my WSL (I can run zig
from the prompt) so I'm not sure what the build is looking for.
you can use the ROC_ZIG="some/path"
variable to point the build to a specific zig binary
though it should be able to find it, of course
Ok. I tried setting export ROC_ZIG="/usr/bin/zig"
but it's still giving the same error. I think it wants something other than just the binary ("installation directory"?)
Can you post the full error? It might contain useful details.
error: failed to run custom build command for `roc_builtins v0.1.0 (/home/tallred/repos/roc/compiler/builtins)`
Caused by:
process didn't exit successfully: `/home/tallred/repos/roc/target/debug/build/roc_builtins-88c944ea58fa3aaa/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=build.rs
Compiling host ir to: /home/tallred/repos/roc/compiler/builtins/bitcode/builtins-host.ll
--- stderr
thread 'main' panicked at '/usr/bin/zig failed: error: unable to find zig installation directory: FileNotFound
', compiler/builtins/build.rs:182:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
Could this issue be what's wrong?
That seems to be on the right track. Thanks!
Does this error look familiar (cargo build
)
error: failed to run custom build command for `roc_builtins v0.1.0 (/home/tallred/repos/roc/compiler/builtins)`
Caused by:
process didn't exit successfully: `/home/tallred/repos/roc/target/debug/build/roc_builtins-88c944ea58fa3aaa/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=build.rs
Compiling host ir to: /home/tallred/repos/roc/compiler/builtins/bitcode/builtins-host.ll
Compiling 64-bit bitcode to: /home/tallred/repos/roc/compiler/builtins/bitcode/builtins-host.bc
--- stderr
thread 'main' panicked at 'llvm-as failed: llvm-as: /home/tallred/repos/roc/compiler/builtins/bitcode/builtins-host.ll:513:99: error: expected ')' at end of argument list
define void @roc_builtins.dec.from_str(%"num.NumParseResult(i128)"* noalias nocapture nonnull sret(%"num.NumParseResult(i128)") %0, %str.RocStr* nocapture nonnull readonly byval(%str.RocStr) align 8 %1) local_unnamed_addr #1 {
^
', compiler/builtins/build.rs:182:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...
error: build failed
Not to me, can you post the output of llvm-as --version
?
» llvm-as --version tallred@TAYLOR-XPS
LLVM (http://llvm.org/):
LLVM version 10.0.0
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: skylake
looks like you need to update llvm-as
Trunk is now at llvm-13. So it is generating llvm ir that llvm-as-10 can't parse
is there an easy way to upgrade or should I just install 13?
I personally use nix because dependency management can be a bit painful.
Otherwise, basically just follow the building from source guide and install 13 + any other deps you might be missing
I managed to fix a few other things and then I pulled from trunk and tried to build again and I got this zig error.
process didn't exit successfully: `/home/tallred/repos/roc/target/debug/build/roc_builtins-88c944ea58fa3aaa/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-changed=build.rs
Compiling host ir to: /home/tallred/repos/roc/compiler/builtins/bitcode/builtins-host.ll
Compiling 64-bit bitcode to: /home/tallred/repos/roc/compiler/builtins/bitcode/builtins-host.bc
--- stderr
thread 'main' panicked at '/home/tallred/zig-linux-x86_64-0.8.0/zig failed: ./build.zig:60:24: error: expected type 'bool', found '(enum literal)'
obj.emit_llvm_ir = .emit;
^
', compiler/builtins/build.rs:155:17
( zig version: 0.8.0 )
ah, we also moved to zig 0.9.1
llvm and zig upgrade in tandem
Aha!
Nix is great to get dependencies set up fast, we have instructions on how to use it here.
I got it all working now. Thanks for your help.
I'll have to familiarize myself better with Nix
I'm just helping a friend get started with Roc for the first time. They're on Windows and I recommended they use WSL. Is anyone else using Roc on WSL at the moment? Does it work well enough? I assume nightlies are good to go?
Also, would it be worth adding any comments in the Getting Started guide for Windows?
Totally
One important thing is to put all code and tooling in the wsl partition. Crossing the boundaries is slow
Folkert de Vries said:
Crossing the boundaries is slow
I haven't used WSL since WSL2 came out, but didn't WSL2 solve the slow boundary problem? Or does it still exist?
Yeah I think WSL2 made interop between the kernels faster, but this is a filesystem issue.
I was the one who ran into this problem. I was storing the Roc project in a Windows-owned folder, but my ~/.cargo
cache was in an ext4 filesystem under Linux. When I compiled the Rust code, cargo would often copy files cached in ~/.cargo
into the project target/
. And copying across different filesystems was slow. When I put everything on the same filesystem, my compilation time got 20x faster or something.
I made a note of it in BUILDING_FROM_SOURCE.md
I assume that if you had two different filesystems under the same OS, you'd have the same problem. But that's rare. Whereas with WSL it's normal to have two filesystems.
Last updated: Jul 06 2025 at 12:14 UTC