After todays meetup I thought I would test out Roc on Windows again.
I have used this machine previously to build Roc from source, so I may have already installed some dependencies like LLVM. However I had no issues today. I updated Visual Studio Build Tools 2019 with C++ to the latest version and then built roc using;
cargo build --release --locked
Running cargo test --release --locked
builds and runs with 4 passed; 123 failed; 2 ignored.
Here is the cargo-test-output.log if that is of any interest @Folkert de Vries
To build basic-cli
I had to install a specific version of the rust nightly toolchain with
rustup toolchain install nightly-2022-12-09-x86_64-pc-windows-msvc
The examples build, however, I immediately hit a strange bug. For some reason Stdout.line
does not print. However, when I add a dbg!
statement in the platform it works (and also prints the dbg). I suspect there is something that is causing rust to not generate the code or it is being optimised away somehow. I'll do some further investigation.
Cool, I have no idea what I am doing, but I managed to open the .exe
and attach a debugger which looks like this Screenshot-2023-07-23-193238.png.
Building with roc build --optimize
seems to also be a workaround.
Looks like the roc parser might be getting confused (there are not multi-line strings in the .roc example file).
roc build --optimize .\examples\args.roc
── INSUFFICIENT INDENT IN MULTI-LINE STRING ──────── .\examples\../src\Arg.roc ─
This multiline string is not sufficiently indented:
582│ """
583│
^
Lines in a multi-line string must be indented at least as much as the
beginning """. This extra indentation is automatically removed from
the string during compilation.
Not working. Builds ok (with --optimize) but then hangs when run. Debugging gives 0xC0000005: Access violation
roc build --optimize .\examples\countdown.roc
🔨 Rebuilding platform...
warning: ignoring debug info with an invalid version (0) in app
0 errors and 0 warnings found in 799 ms while successfully building:
.\examples\countdown.exe
PS C:\Users\bosyl\Documents\GitHub\basic-cli> .\examples\countdown.exe
Let's count down from 3 together - all you have to do is press <ENTER>.
thread 'main' has overflowed its stack
Debugging also gives 0xC0000005: Access violation
The examples build, however, I immediately hit a strange bug. For some reason Stdout.line does not print. However, when I add a dbg! statement in the platform it works (and also prints the dbg).
Maybe stdout on Windows performs some buffering of output that is different than on Unix?
Does Stderr.line
have the same problem or not?
I'll have a look
Looks like the roc parser might be getting confused (there are not multi-line strings in the .roc example file).
The path .\examples\../src\Arg.roc
looks very suspicious. Like Unix-style paths with forward slashes and Windows-style paths with backwards slashes get intermingled. Maybe that is what is confusing the parser?
Ok, so confirmed Stderr.line
has the same issue. I'm 90% confident there is an issue in the Roc compiler here causing this.
For the Args example, I think it might be a roc parser issue. When git checkouts file on Windows it defaults to clrf \r\n
line endings, but the parser assumes it is \n
. We could maybe fix this with a gitattribute but I'm not sure what else that would affect, e.g. rust tooling etc.
Here is a gist which shows the output from roc format
on that file.
And for good measure I thought I'd check the REPL out too
PS C:\Users\bosyl\Documents\GitHub\roc-things> roc repl
The rockin’ roc repl
────────────────────────
Enter an expression, or :help, or :q to quit.
» 1+1
warning: ignoring debug info with an invalid version (0) in
thread 'main' panicked at 'extern function roc_mmap is not defined by the builtins', crates\compiler\gen_llvm\src\llvm\externs.rs:176:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Last updated: Jul 06 2025 at 12:14 UTC