I'm trying to run a roc program (outside of repl). I saw on the installation page that i can use a zig based platform, but the examples i've downloaded are, apparently, rust based. Is there anywhere i can learn about how to use a zig based platform? or more on working with platforms in general? it's not clear to me how to get a hello world program running at the moment without downloading rust . Really there's a lot more about platforms that I don't understand, aside from the general gist of the idea behind them.
On https://github.com/lukewilliamboswell/roc-awesome?tab=readme-ov-file I have linked to a few Zig platforms. The most minimal example is probably the Zig platform switching example https://github.com/roc-lang/roc/tree/main/examples/platform-switching/zig-platform
Roc WASI is also a Zig platform https://github.com/ostcar/roc-wasi-platform
For general information there is the guide https://www.roc-lang.org/platforms
To add to that: If you just want to use a platform, you should not have to care about the language of the platform.
At the moment if you are using a platform locally it will rebuild from source everytime, unless you use --prebuilt-platform
. If you use from a URL package then it will default to use the archive for your system architecture.
Fabian Schmalzried said:
To add to that: If you just want to use a platform, you should not have to care about the language of the platform.
Thank you! I'm not quite sure what you mean by "should not have to care about the language of the platform". If a platform is, loosely, a sort of runtime, don't i need to know what the requirements of that runtime are, up to and including what language they might depend on? what's the best way to do that?
The platform is normally compiled to machine code for each architecture and distributed as a package, so end users can just use a URL and they do not need any tooling for the platform's host language installed, as roc will compile the users app and link with the platform to build the final executable.
So you only need host tooling, e.g. cargo for a rust platform, or zig for a zig platform if you are developing a platform or would like to build the platform from source.
Last updated: Jul 06 2025 at 12:14 UTC