Stream: beginners

Topic: New Compiler: error?


view this post on Zulip Kilian Vounckx (Nov 30 2025 at 21:28):

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?

view this post on Zulip Luke Boswell (Nov 30 2025 at 21:31):

Are you running roc built from source? zig build roc?

view this post on Zulip Kilian Vounckx (Nov 30 2025 at 21:32):

No, latest release: Roc compiler version release-fast-77e8bbc1

view this post on Zulip Kilian Vounckx (Dec 01 2025 at 18:59):

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?

view this post on Zulip Anton (Dec 01 2025 at 19:06):

On what OS are you?

view this post on Zulip Kilian Vounckx (Dec 01 2025 at 19:07):

MacOS arm64

view this post on Zulip Anton (Dec 01 2025 at 19:12):

I'm able to reproduce it

view this post on Zulip Kilian Vounckx (Dec 01 2025 at 19:16):

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?

view this post on Zulip Anton (Dec 01 2025 at 19:17):

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({})
}

view this post on Zulip Kilian Vounckx (Dec 01 2025 at 19:20):

It seems like the header being multiline caused the issue

view this post on Zulip Kilian Vounckx (Dec 01 2025 at 19:21):

Thanks for helping out!

view this post on Zulip Anton (Dec 01 2025 at 19:24):

Kilian Vounckx said:

It seems like the header being multiline caused the issue

Can you make a github issue for that?

view this post on Zulip Kilian Vounckx (Dec 01 2025 at 19:27):

Done!

view this post on Zulip Luke Boswell (Dec 01 2025 at 20:21):

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.

view this post on Zulip Luke Boswell (Dec 01 2025 at 20:22):

There is a --no-cache flag you can give roc to not use the cache and force a re-link of that interpreted host.

view this post on Zulip Yanni Papandreou (Dec 02 2025 at 22:54):

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

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:00):

I suspect this is fixed in https://github.com/lukewilliamboswell/roc-platform-template-zig/pull/13

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:00):

That looks like a memory leak in the platform host

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:01):

If you are open to building the platform from source and testing to confirm, that would be amazing

view this post on Zulip Yanni Papandreou (Dec 02 2025 at 23:11):

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?

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:12):

I just marged that PR so from main branch should be fine

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:13):

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

view this post on Zulip Richard Feldman (Dec 02 2025 at 23:13):

I probably need to update that URL

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:13):

Then in your app you can use a relative path to the platform/main.roc file instead of a URL

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:13):

@Richard Feldman I haven't made a new build/release yet -- I can do that now

view this post on Zulip Yanni Papandreou (Dec 02 2025 at 23:16):

@Luke Boswell thanks - will try now :)

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:18):

Give me 2secs I'll have a URL for you instead of needing to build from source

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:20):

Give this a try

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

view this post on Zulip Yanni Papandreou (Dec 02 2025 at 23:24):

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..

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:25):

ok great, I can reproduce the leak! I'll look into it

view this post on Zulip Yanni Papandreou (Dec 02 2025 at 23:26):

thanks Luke!

view this post on Zulip Luke Boswell (Dec 02 2025 at 23:27):

I'm in the middle of a big refactor rn, but should be able to look at it in a few hours

view this post on Zulip Yanni Papandreou (Dec 02 2025 at 23:33):

Thanks, no rush at all!

view this post on Zulip Luke Boswell (Dec 03 2025 at 00:18):

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

view this post on Zulip Richard Feldman (Dec 03 2025 at 01:18):

thanks - url updated!


Last updated: Dec 21 2025 at 12:15 UTC