Stream: contributing

Topic: Help prepare for AoC 2025 - Testing a platform from URL


view this post on Zulip Luke Boswell (Nov 27 2025 at 05:51):

Is there anyone online who could help me test running roc with a platform from URL?

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 05:51):

Sure thing. :blush:

view this post on Zulip Luke Boswell (Nov 27 2025 at 05:51):

Can you build roc from source off this branch https://github.com/roc-lang/roc/pull/8464

view this post on Zulip Luke Boswell (Nov 27 2025 at 05:52):

zig build roc

view this post on Zulip Luke Boswell (Nov 27 2025 at 05:52):

And then run this app

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/LKroJZnzRzHS2JPYcWa6bEdFN129zawLf5ub8CrYgcH.tar.zst" }

import pf.Stdout

main! = || {
    Stdout.line!("Hello World")
}

view this post on Zulip Luke Boswell (Nov 27 2025 at 05:54):

Let me know what machine / os / arch your on if you run it please -- it's working for me on my arm64 Mac

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 05:55):

Seems to be working nicely. I'm running on a M1 MBP (macOS 15.6.1).

view this post on Zulip Luke Boswell (Nov 27 2025 at 06:00):

For anyone interested here is the zig platform template I used to generate that package https://github.com/lukewilliamboswell/roc-platform-template-zig/tree/0.1

view this post on Zulip Notification Bot (Nov 27 2025 at 06:02):

8 messages were moved here from #announcements > Help prepare for AoC 2025 by Luke Boswell.

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 06:14):

@Luke Boswell would it make sense to have a way to read the entirely of Stdin or are we imagining people just looping over Stdin.line! until "" is reached?

view this post on Zulip Luke Boswell (Nov 27 2025 at 06:15):

This is just a template to show how to create a simple platform... I copied the Fx test platform verbatim.

view this post on Zulip Luke Boswell (Nov 27 2025 at 06:16):

I would love to see people experiment with different ideas for platform API's and capabilities

view this post on Zulip Luke Boswell (Nov 27 2025 at 06:16):

My immediate goal is to get something working for AoC

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 06:16):

I see, that makes sense. :slight_smile:

view this post on Zulip Luke Boswell (Nov 27 2025 at 06:19):

Pushed some fixes to that branch... and now we have x64 Windows running from a URL too! :smiley:

C:\Users\bosyl\Documents\Github\roc>zig build roc

C:\Users\bosyl\Documents\Github\roc>roc test.roc
Hello World

view this post on Zulip Luke Boswell (Nov 27 2025 at 06:34):

And ... I get a segfault on x64 linux :tear:

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 08:47):

I just tried to build the Roc compiler using zig build test and now my "hello, world" program isn't running anymore. I just get error: Failed to set up shared memory with ModuleEnv: error.InvalidAppPath when trying to run the program.

This is on d28a978d8b957f3b88dbc92dcbbc6a87ffb0e8f4 on a M1 MBP on macOS 15.16.1.

view this post on Zulip Luke Boswell (Nov 27 2025 at 08:52):

Interesting... I'll have a closer look tomorrow

view this post on Zulip Richard Feldman (Nov 27 2025 at 12:45):

@Kevin Hovsäter just to make sure we're on the same page, these details would be helpful:

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 12:53):

@Richard Feldman

what's the source code of the .roc file?

~/prj/advent-of-code $ cat hello.roc
app [main!] { pf: platform "./platform/main.roc" }

import pf.Stdout

main! = || {
    Stdout.line!("Hello, world!")
}

what directory is the .roc file in?

~/prj/advent-of-code $ tree
.
├── hello.roc
└── platform
    ├── host.zig
    ├── libhost.a
    ├── main.roc
    ├── Stderr.roc
    ├── Stdin.roc
    └── Stdout.roc

2 directories, 7 files
~/prj/advent-of-code $ roc hello.roc
error: Failed to set up shared memory with ModuleEnv: error.InvalidAppPath
~/prj/advent-of-code $ which roc
/Users/kevin/src/roc/zig-out/bin/roc

Roc was built using zig build test and I copied the platform from test/fx/platform into ~/prj/advent-of-code.

view this post on Zulip Richard Feldman (Nov 27 2025 at 12:53):

excellent, thank you!

view this post on Zulip Richard Feldman (Nov 27 2025 at 13:29):

fix for this: https://github.com/roc-lang/roc/pull/8471

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 13:33):

Tried to build your branch but got the following errors:

~/src/roc (fix-dir-bug) $ zig build test
test
└─ tests_summary
   └─ run test fx_platform_test 14/16 passed, 2 failed
error: 'fx_platform_test.test.fx platform opaque type with method' failed: Run failed with exit code 1
STDOUT:
STDERR: error: Child process /Users/kevin/Library/Caches/roc/3db62731d7e536d5d9c27137f68b7c5a/temp/roc-tmp-knVzb0gLfOcUKmevHkXrzfZb8Q6PxsNs/roc_run_1170380953 killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)

/Users/kevin/src/roc/src/cli/test/fx_platform_test.zig:585:17: 0x102489d67 in test.fx platform opaque type with method (fx_platform_test)
                return error.RunFailed;
                ^
error: 'fx_platform_test.test.fx platform run from different cwd' failed: Run failed with exit code 1
STDOUT:
STDERR: error: Failed to set up shared memory with ModuleEnv: error.InvalidAppPath

/Users/kevin/src/roc/src/cli/test/fx_platform_test.zig:672:17: 0x10248ad37 in test.fx platform run from different cwd (fx_platform_test)
                return error.RunFailed;
                ^
error: while executing test 'fx_platform_test.test.fx platform run from different cwd', the following test command failed:
./.zig-cache/o/a3568d4bddc2e60f4e000977a4db93f6/fx_platform_test --cache-dir=./.zig-cache --seed=0x75600522 --listen=-

Build Summary: 54/57 steps succeeded; 1 failed; 1615/1617 tests passed; 2 failed
test transitive failure
└─ tests_summary transitive failure
   └─ run test fx_platform_test 14/16 passed, 2 failed

error: the following build command failed with exit code 1:
.zig-cache/o/e6d6ec7fb8dbc0a4bd0962fb69f26247/build /Users/kevin/.asdf/installs/zig/0.15.2/zig /Users/kevin/.asdf/installs/zig/0.15.2/lib /Users/kevin/src/roc .zig-cache /Users/kevin/.cache/zig --seed 0x75600522 -Zf8f5c3ff46d8dde4 test

view this post on Zulip Richard Feldman (Nov 27 2025 at 13:38):

ah it's a stale roc binary - I just pushed something to that branch to force rebuilding it for the tests

view this post on Zulip Kevin Hovsäter (Nov 27 2025 at 13:44):

That did indeed work! And now both absolute and relative paths seem to work as expected! :tada:

view this post on Zulip Luke Boswell (Nov 27 2025 at 22:43):

Can I get more folks to help me test this?

view this post on Zulip Luke Boswell (Nov 27 2025 at 22:43):

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/LKroJZnzRzHS2JPYcWa6bEdFN129zawLf5ub8CrYgcH.tar.zst" }

import pf.Stdout

main! = || {
    Stdout.line!("Hello World")
}

view this post on Zulip Luke Boswell (Nov 27 2025 at 22:43):

Build roc from source on the bundle-changes branch

view this post on Zulip Luke Boswell (Nov 27 2025 at 22:43):

9:33:19 ~/Documents/GitHub/roc bundle-changes $ zig build roc
9:42:28 ~/Documents/GitHub/roc bundle-changes $ roc test.roc
Hello World

view this post on Zulip Luke Boswell (Nov 27 2025 at 22:44):

Specifically any linux users

view this post on Zulip Luke Boswell (Nov 28 2025 at 00:08):

I've got it working on all three OS's now -- if https://github.com/roc-lang/roc/pull/8464 passes we should be good for supporting basic platforms from URL's

view this post on Zulip isaactfa (Nov 28 2025 at 07:04):

I hate to say it, but on x86_64 linux I get

$ zig-out/bin/roc main.roc
error: Child process /home/timob/.cache/roc/c17e6c1672ab85bbfeb20617f7710e69/temp/roc-tmp-Rj9qhjzcZYcolwSXZm4NfPCDD31RecAU/roc_run_733124949 killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)

with

$ cat main.roc

app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/LKroJZnzRzHS2JPYcWa6bEdFN129zawLf5ub8CrYgcH.tar.zst" }

import pf.Stdout

main! = || {
    Stdout.line!("Hello World")
}

and

$ zig-out/bin/roc version
Roc compiler version debug-c4550425

$ git show --oneline
c455042522 (HEAD) Merge pull request #8464 from roc-lang/bundle-changes

main doesn't build for me right now and bundle-changes seems to have been deleted, so I checked out the merge commit directly.

view this post on Zulip Anton (Nov 28 2025 at 10:28):

main doesn't build for me right now

I'm looking into this.

view this post on Zulip Luke Boswell (Nov 28 2025 at 10:45):

I've been updating the release URL as I fix things, maybe that is related?


Last updated: Nov 28 2025 at 12:16 UTC