Using @Luke Boswell 's roc-platform-template-zig:
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.6/2BfGn4M9uWJNhDVeMghGeXNVDFijMfPsmmVeo6M4QjKX.tar.zst"
}
main! = |_args| {
Err(Exit(1)) # You can put Ok({}) as well, and it fails
}
I've tried about 10 different programs adding and removing certain language features, but they all fail. This is _likely_ a platform issue - maybe specific to mac. I can build very small programs successfully with the test/fx platform, but it is limited (no cli args for example)
Error output:
❯ ../roc/zig-out/bin/roc examples/CommandLineArgs/main.roc || echo $?
thread 206406346 panic: reached unreachable code
???:?:?: 0x1024c40eb in ??? (main.roc)
???:?:?: 0x1024d288f in ??? (main.roc)
???:?:?: 0x1024bd9c3 in ??? (main.roc)
???:?:?: 0x1024ba703 in ??? (main.roc)
???:?:?: 0x1024ba1a7 in ??? (main.roc)
???:?:?: 0x10285f383 in ??? (main.roc)
???:?:?: 0x10241fec7 in ??? (main.roc)
???:?:?: 0x18f5b6b97 in ??? (???)
???:?:?: 0x0 in ??? (???)
134
Obviously the stack trace is less than helpful
Interestingly enough, this runs successfully with a locally built version of the platform
Hmm strange, are you on intel mac?
No M1
Here's what's stranger
I actually get the same error with the local built platform when called from where I was.
# Root of roc-examples repo (roc is a sibling dir)
../roc/zig-out/bin/roc examples/CommandLineArgs/main.roc
with this output:
❯ ../roc/zig-out/bin/roc examples/CommandLineArgs/main.roc
thread 206427882 panic: reached unreachable code
???:?:?: 0x102ba00eb in ??? (main.roc)
???:?:?: 0x102bae88f in ??? (main.roc)
???:?:?: 0x102b999c3 in ??? (main.roc)
???:?:?: 0x102b96703 in ??? (main.roc)
???:?:?: 0x102b961a7 in ??? (main.roc)
???:?:?: 0x102f3b383 in ??? (main.roc)
???:?:?: 0x102afbec7 in ??? (main.roc)
???:?:?: 0x18f5b6b97 in ??? (???)
???:?:?: 0x0 in ??? (???)
But when I cd out one level to the parent of roc,roc-example, and roc-platform-template-zig:
./roc/zig-out/bin/roc roc-examples/examples/CommandLineArgs/main.roc
I get the following output (and success):
debug: [HOST] Building args...
debug: [ALLOC] ptr=0x103160008 size=40 align=8
debug: [ALLOC] ptr=0x103180008 size=117 align=8
debug: [HOST] args_list ptr=0x103160018 len=1
debug: [HOST] Calling roc__main_for_host...
debug: [ALLOC] ptr=0x103160048 size=45 align=8
dbg: "???"
debug: [ALLOC] ptr=0x103160088 size=45 align=8
debug: [ALLOC] ptr=0x103340008 size=256 align=8
debug: [DEALLOC] ptr=0x103340008 align=8
debug: [ALLOC] ptr=0x103180088 size=64 align=8
Part 1 (demo): 3
debug: [DEALLOC] ptr=0x103180088 align=8
debug: [ALLOC] ptr=0x103360008 size=256 align=8
debug: [DEALLOC] ptr=0x103360008 align=8
debug: [ALLOC] ptr=0x103180108 size=64 align=8
Part 1: 3
debug: [DEALLOC] ptr=0x103180108 align=8
debug: [ALLOC] ptr=0x103380008 size=256 align=8
debug: [DEALLOC] ptr=0x103380008 align=8
debug: [ALLOC] ptr=0x103180188 size=64 align=8
Part 2 (demo): 0
debug: [DEALLOC] ptr=0x103180188 align=8
debug: [ALLOC] ptr=0x1033a0008 size=256 align=8
debug: [DEALLOC] ptr=0x1033a0008 align=8
debug: [ALLOC] ptr=0x103180208 size=64 align=8
Part 2: 0
debug: [DEALLOC] ptr=0x103180208 align=8
debug: [DEALLOC] ptr=0x103160088 align=8
debug: [DEALLOC] ptr=0x103160048 align=8
debug: [DEALLOC] ptr=0x103180008 align=8
debug: [DEALLOC] ptr=0x103160008 align=8
debug: [HOST] Returned from roc, exit_code=0
BUT, when I call it from the roc-platform-template-zig directory, I get the following output:
❯ ../roc/zig-out/bin/roc ../roc-examples/examples/CommandLineArgs/main.roc
dbg: "???"
Part 1 (demo): 3
Part 1: 3
Part 2 (demo): 0
Part 2: 0
All using the same code / object files / binary
This works for me with latest main roc on m2 cpu:
app [main!] {
pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.6/2BfGn4M9uWJNhDVeMghGeXNVDFijMfPsmmVeo6M4QjKX.tar.zst"
}
main! = |_args| {
Err(Exit(1)) # You can put Ok({}) as well, and it fails
}
I recommend doing a git clean -fdx to remove old platform files.
Screen Recording 2025-12-26 at 9.41.29 AM.mov
Here's a video
Same behavior after git clean -xfd AND rm -rf ~/.cache/roc
This is obviously with a program with some behavior now
Hmm, how about with roc main.roc --no-cache?
Also, Hi Anton, I hope you have ben well
Hi Anthony, I have been doing well :) How about you?
Wow. Adding --no-cache (thanks for that) makes them all behave the same...
Anthony Bullard said:
This is obviously with a program with some behavior now
I don't know what that means :p
Where is this magical cache
Anton said:
Anthony Bullard said:
This is obviously with a program with some behavior now
I don't know what that means :p
Sorry, I meant that I put some actual code back into this file once I had it working with the locally built platform
Are we rebuilding ./zig-out/lib/libroc_shim.a?
I'm not sure, let me check
Anthony Bullard said:
Where is this magical cache
I think it's ~/Library/Caches/roc/
Yep, just found it too
So interesting. I don't still understand why calling the same code with the same binary from different locations would differ
But, I'm unblocked so thank you my good sir. I will now use --no-cache first before I raise an issue
I learned this the hard way as well lol
Last updated: Jan 12 2026 at 12:19 UTC