Stream: beginners

Topic: how are platform files detected/compiled


view this post on Zulip Pei Yang Ching (Feb 19 2024 at 00:17):

Hi! I'm looking at the example platforms in platform-switching, but I don't understand how roc build can magically detect and compile platforms in C, zig etc. as far as I can see there's no build file, are they hard coded?

how can I modify the build step? for example, in a C platform how do I use a shared lib, include a header, etc.

I've seen an example of compiling the platform and then the roc app separately with --no-link, but I'm wondering if there's a standard way to all this

view this post on Zulip Brendan Hansknecht (Feb 19 2024 at 00:20):

The build system is mostly a hack rn in the link.rs file.

view this post on Zulip Brendan Hansknecht (Feb 19 2024 at 00:21):

If you need more control, you have to use --no-link and then have another build system deal with things.

view this post on Zulip Pei Yang Ching (Feb 19 2024 at 00:22):

ah I see, thanks for the quick reply

view this post on Zulip Brendan Hansknecht (Feb 19 2024 at 00:22):

Long term, we plan to have platforms have their own build scripts. They will compile into a special format that enable roc to deal with all the rest of the linking without knowing anything about the language the platform is written in.

view this post on Zulip Luke Boswell (Feb 19 2024 at 00:41):

Related issue https://github.com/roc-lang/roc/issues/6414


Last updated: Jul 05 2025 at 12:14 UTC