For people who are not interested in becoming platform authors or contributors, but just want to try out roc for "end-applications", is trying it out on Windows for small cli apps etc. still discouraged?
It's something I could for example do at $(dayJob) for small-ish script type of applications where I'm not risking much by using roc, but everywhere I've looked it still seems to be discouraged.
Is it still the case that a breakthrough update of the compiler has to happen until you feel comfortable recommending people to try out roc on Windows?
I'm not fully aware of the status here, but I think we still recommend wsl. @Luke Boswell should know best though.
You are correct it's still not recommended unless your more comfortable diving into compiler bugs and compiling from source.
There has been a fair amount of work in the background making changes that will help get us to this point soon. For example we've been working on refactoring basic-cli so it will be much easier to build it for Windows.
Ideally we need a contributor who is also a Windows user to use roc and help find and fix the bugs. There's no major changes in the compiler though, its all there and %99 working fine.
I have tested roc-wasm4 and that works really well on Windows. All the zig platforms I've tested work fine using the legacy linker. There's a bug with the Windows surgical linker at the moment.
The main hurdle I think is upgrading our platforms and testing those so they support Windows. This isn't a change in the compiler though.
Could leveraging on something like MSYS2/mingw potentially mean that a Windows release could keep better pace with a Linux release?
If I remember correctly nim does this, and it works well for them.
I dont think that's necessary. We have it in CI all native Windows and it's working well.
We don't include a release in nightly (I think) because it just hasnt been tested much and we know of some bugs. So if someone comes along they aren't likely to have a great experience unless they are comfortable with rust and building from source.
maybe we’re at the point where a nightly release would actually help surface bugs
I just spent an hour or so hacking around with things manually on basic-cli, and we're much closer, but still not quite there to make a release that will "just work" using the legacy linker. It looks like it should just work, but we've got a few libs that aren't linked in by roc cli; and I'm struggling a little with Windows linking. libMSVCRT.a
and libOLDNAMES.a
.
Also, I'm testing against this branch, which refactors the rust out into separate crates which is easier to follow
Building manually with zig I get the following
zig build-exe .\examples\hello-world.obj .\platform\windows-x64.lib -lc
error: lld-link: could not open 'libMSVCRT.a': No such file or directory
error: lld-link: could not open 'libOLDNAMES.a': No such file or directory
So it could just be my local setup
No joy with zig 0.13.0
PS C:\Users\bosyl\Documents\GitHub\basic-cli> C:\Users\bosyl\zig-windows-x86_64-0.13.0\zig-windows-x86_64-0.13.0\zig.exe build-exe .\examples\hello-world.obj .\platform\windows-x64.lib -lc
error: lld-link: could not open 'libMSVCRT.a': No such file or directory
error: lld-link: could not open 'libOLDNAMES.a': No such file or directory
ahh gotcha - but very exciting to hear about the progress on this! :smiley:
We're so close...
So if anyone, knows anyone, who knows how linking works on Windows and would like to look into this, that would be super. :smiley:
Luke Boswell schrieb:
No joy with zig 0.13.0
PS C:\Users\bosyl\Documents\GitHub\basic-cli> C:\Users\bosyl\zig-windows-x86_64-0.13.0\zig-windows-x86_64-0.13.0\zig.exe build-exe .\examples\hello-world.obj .\platform\windows-x64.lib -lc error: lld-link: could not open 'libMSVCRT.a': No such file or directory error: lld-link: could not open 'libOLDNAMES.a': No such file or directory
I don't know much about zig, but doesn't the ".a" extension suggest it is actually expecting something like mingw to be installed? It would be ".lib" if it were native, right?
That does seem strange. I've searched through the roc codebase and can't find any reference to these libs. Also the linking for windows just deferes to zig like so;
let child = zig()
.args(["build-exe"])
.args(input_paths)
.args([
"-target",
"native",
"--subsystem",
"console",
"-lc",
&format!("-femit-bin={}", output_path.to_str().unwrap()),
])
.spawn()?;
So I'm not sure where lld-link
get these from.
I'm trying to build from source by following BUILDING_FROM_SOURCE.md, and ran into this when doing cargo run examples/platform-switching/rocLovesRust.roc
:
Failed to rebuild src/lib.rs:
The executed command was:
rustup run nightly-2023-12-21 cargo build --lib
stderr of that command:
error: toolchain 'nightly-2023-12-21-x86_64-pc-windows-msvc' is not installed
I will install that with rustup, but just wanted to point that out. Is there any other checklist for building from source that I'm maybe missing?
There's no checklist or anything yet.
I think the only gotcha is installing LLVM but if you follow this you'll be fine https://github.com/roc-lang/roc/blob/main/BUILDING_FROM_SOURCE.md#llvm-installation-on-windows
Yes it turned out the guide was actually sufficient for building roc, I guess only building some of the example platforms had different requirements. Anyway I think I'm done playing with it in Windows for now considering neither of basic-cli or basic-webserver work. :big_smile:
In case it's of interest, and not simply an outdated example, I could report a runtime error I got with the rocLovesZig.roc example. (it compiled without errors)
But I have that on another laptop that I don't have access to right now.
Last updated: Jul 06 2025 at 12:14 UTC