Like many others, I'm back for AOC after a while of not using roc. I'm going through Richard's gist:
app [main!] {
cli: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst"
}
import cli.Stdout
main! = |_| {
Stdout.line!("Hello, World!")
Ok({})
}
I get the following error:
error: Failed to extract platform spec from app file: error.NotAppFile
Does anyone have the same issue? Or am I doing something wrong?
Are you running roc built from source? zig build roc?
No, latest release: Roc compiler version release-fast-77e8bbc1
I just built from source: Roc compiler version debug-2ac12ee6. Still happening there unfortunately. What is weird is that it worked before. I then made some change (idk what exactly anymore) which would be a compiler error, but instead gave the error above. But after undoing the change, the above error stays. Is there some caching in place in a config or shared folder anywhere?
On what OS are you?
MacOS arm64
I'm able to reproduce it
Ah good first news! Not just my laptop being weird then. Hope the example helps with debugging the compiler!
In the meantime, do you have a workaround?
Yes, use roc build from source (zig build roc) and this roc source code:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst" }
import pf.Stdout
main! : List(Str) => Try({}, [Exit(I32)])
main! = |_args| {
Stdout.line!("Hello Roc!")
Ok({})
}
It seems like the header being multiline caused the issue
Thanks for helping out!
Kilian Vounckx said:
It seems like the header being multiline caused the issue
Can you make a github issue for that?
Done!
Is there some caching in place in a config or shared folder anywhere?
Yes, there is a roc cache -- when you first run an app, the roc cli links the pre-built host library from the platform with an interpreter shim into an executable and caches that. From then on whenever you "run" a roc app that uses the same platform you will be using a cached executable -- and just the Roc app parts will be recompiled and then interpreted.
There is a --no-cache flag you can give roc to not use the cache and force a re-link of that interpreted host.
Hi, I was also playing around with the the Roc compiler built from source (Roc compiler version debug-3df2aab6). I was following Richard's gist and tried this program:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.1-test/7iDKk44no3gF9Nrh2VyF8Y5yvy1jUBhrbhHURN1WQptB.tar.zst" }
import pf.Stdout
import pf.Stdin
main! = |_args| {
Stdout.line!("What's your name?")
name = Stdin.line!()
Stdout.line!("Hello, ${name}!")
}
Doing so gave this:
-- TYPE MISMATCH ---------------------------------
This expression is used in an unexpected way:
┌─ main.roc:6:1
│
6 │ main! = |_args| {
│ ^^^^^
It has the type:
List(Str) => { }
But the type annotation says it should have the type:
List(Str) => Try({ }, [Exit(I32)])
Found 1 error(s) and 0 warning(s) for main.roc.
What's your name?
Yanni
Hello, Yanni!
Roc crashed: Error evaluating from shared memory: TypeMismatch
So I added Ok({}) at the end of main! and the error disappeared but I am now seeing this and I am not sure if its expected:
What's your name?
Yanni
Hello, Yanni!
error(gpa): memory address 0x105820000 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo
(The status code is okay) - is this due to how I am building the compiler? Though I saw something similar with the release of the new compiler
I suspect this is fixed in https://github.com/lukewilliamboswell/roc-platform-template-zig/pull/13
That looks like a memory leak in the platform host
If you are open to building the platform from source and testing to confirm, that would be amazing
Happy to try this out - I'm a bit new to Roc so not sure the workflow for building a platform from source? I have cloned the roc repo and can build the compiler using the nix devshell. I see instructions here https://github.com/lukewilliamboswell/roc-platform-template-zig/tree/main for building the platform - I'm guessing I should get the latest from the PR branch, build then somehow use this in the program above instead?
I just marged that PR so from main branch should be fine
To build it just use zig build native -- zig build will also work but that will also build all the cross-compiled objects which you dont need
I probably need to update that URL
Then in your app you can use a relative path to the platform/main.roc file instead of a URL
@Richard Feldman I haven't made a new build/release yet -- I can do that now
@Luke Boswell thanks - will try now :)
Give me 2secs I'll have a URL for you instead of needing to build from source
Give this a try
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.2/2q3DaiQx3nYLwKbwwVbPrBeRhbxrWuYZxnPpYfJrdQJF.tar.zst" }
Thanks Luke, using that I see:
$ ./zig-out/bin/roc --no-cache main.roc
What's your name?
Yanni
Hello, Yanni!
error(gpa): memory address 0x103940000 leaked:
Unable to print stack trace: Unable to open debug info: MissingDebugInfo
error: Memory leak detected!
for reference this is the program:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.2/2q3DaiQx3nYLwKbwwVbPrBeRhbxrWuYZxnPpYfJrdQJF.tar.zst" }
import pf.Stdout
import pf.Stdin
main! = |_args| {
Stdout.line!("What's your name?")
name = Stdin.line!()
Stdout.line!("Hello, ${name}!")
Ok({})
}
so the error message changed a bit and I get an status code of 1 instead of 0..
ok great, I can reproduce the leak! I'll look into it
thanks Luke!
I'm in the middle of a big refactor rn, but should be able to look at it in a few hours
Thanks, no rush at all!
Yanni Papandreou said:
Thanks Luke, using that I see:
$ ./zig-out/bin/roc --no-cache main.roc What's your name? Yanni Hello, Yanni! error(gpa): memory address 0x103940000 leaked: Unable to print stack trace: Unable to open debug info: MissingDebugInfo error: Memory leak detected!for reference this is the program:
app [main!] { pf: platform "https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/download/0.2/2q3DaiQx3nYLwKbwwVbPrBeRhbxrWuYZxnPpYfJrdQJF.tar.zst" } import pf.Stdout import pf.Stdin main! = |_args| { Stdout.line!("What's your name?") name = Stdin.line!() Stdout.line!("Hello, ${name}!") Ok({}) }so the error message changed a bit and I get an status code of 1 instead of 0..
New release with the fix for this
https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/tag/0.3
@Richard Feldman if you wanted to update your URL in the notes
thanks - url updated!
Last updated: Dec 21 2025 at 12:15 UTC