Stream: beginners

Topic: Roc on WSL


view this post on Zulip Viktor Ferenczi (Apr 20 2022 at 22:28):

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

view this post on Zulip Richard Feldman (Apr 20 2022 at 22:55):

so roc with no arguments launches the editor - try roc help to use the command line

view this post on Zulip Viktor Ferenczi (Apr 21 2022 at 19:36):

I attempted to launch the editor, actually. The CLI works.

view this post on Zulip Richard Feldman (Apr 21 2022 at 21:21):

ah I see - @Folkert de Vries is this the error you see on Linux?

view this post on Zulip Folkert de Vries (Apr 21 2022 at 21:24):

yeah, or it's very similar at least

view this post on Zulip Anton (Apr 22 2022 at 07:12):

@Viktor Ferenczi I have a fix in the works for the Bgra8Unorm issue, I'll try to finish that next week.

view this post on Zulip Anton (Apr 22 2022 at 07:14):

@Richard Feldman I've removed your message to prevent confusing Viktor.

view this post on Zulip Anton (Apr 26 2022 at 17:10):

@Viktor Ferenczi the fix is available on the color_format_support branch, can you give it a try?

view this post on Zulip Taylor Allred (May 04 2022 at 17:00):

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.

view this post on Zulip Folkert de Vries (May 04 2022 at 17:01):

you can use the ROC_ZIG="some/path" variable to point the build to a specific zig binary

view this post on Zulip Folkert de Vries (May 04 2022 at 17:01):

though it should be able to find it, of course

view this post on Zulip Taylor Allred (May 04 2022 at 17:13):

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"?)

view this post on Zulip Anton (May 04 2022 at 17:16):

Can you post the full error? It might contain useful details.

view this post on Zulip Taylor Allred (May 04 2022 at 17:20):

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

view this post on Zulip Anton (May 04 2022 at 17:26):

Could this issue be what's wrong?

view this post on Zulip Taylor Allred (May 04 2022 at 17:29):

That seems to be on the right track. Thanks!

view this post on Zulip Taylor Allred (May 04 2022 at 20:15):

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

view this post on Zulip Anton (May 05 2022 at 07:26):

Not to me, can you post the output of llvm-as --version?

view this post on Zulip Taylor Allred (May 17 2022 at 02:31):

» 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

view this post on Zulip Brendan Hansknecht (May 17 2022 at 02:33):

looks like you need to update llvm-as

view this post on Zulip Brendan Hansknecht (May 17 2022 at 02:33):

Trunk is now at llvm-13. So it is generating llvm ir that llvm-as-10 can't parse

view this post on Zulip Taylor Allred (May 17 2022 at 02:34):

is there an easy way to upgrade or should I just install 13?

view this post on Zulip Brendan Hansknecht (May 17 2022 at 02:35):

I personally use nix because dependency management can be a bit painful.

view this post on Zulip Brendan Hansknecht (May 17 2022 at 02:42):

Otherwise, basically just follow the building from source guide and install 13 + any other deps you might be missing

view this post on Zulip Taylor Allred (May 17 2022 at 17:29):

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 )

view this post on Zulip Folkert de Vries (May 17 2022 at 17:32):

ah, we also moved to zig 0.9.1

view this post on Zulip Folkert de Vries (May 17 2022 at 17:32):

llvm and zig upgrade in tandem

view this post on Zulip Taylor Allred (May 17 2022 at 17:35):

Aha!

view this post on Zulip Anton (May 17 2022 at 17:54):

Nix is great to get dependencies set up fast, we have instructions on how to use it here.

view this post on Zulip Taylor Allred (May 17 2022 at 18:19):

I got it all working now. Thanks for your help.
I'll have to familiarize myself better with Nix

view this post on Zulip Luke Boswell (Oct 10 2023 at 21:41):

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?

view this post on Zulip Folkert de Vries (Oct 10 2023 at 21:47):

Totally

view this post on Zulip Folkert de Vries (Oct 10 2023 at 21:48):

One important thing is to put all code and tooling in the wsl partition. Crossing the boundaries is slow

view this post on Zulip Hannes (Oct 11 2023 at 05:30):

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?

view this post on Zulip Brian Carroll (Oct 11 2023 at 06:56):

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

view this post on Zulip Brian Carroll (Oct 11 2023 at 06:59):

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