Stream: show and tell

Topic: Early progress migrating `roc-ray` graphics platform


view this post on Zulip Luke Boswell (Jan 11 2026 at 10:47):

Thought I'd share some cool progress on roc-ray -- I've been using this to help fix bugs in the platform/host side of things and validate the platform packages and linking designs. I got it to a pretty cool point today and wanted to share with everyone here.

roc-ray-alpha-1.gif

app [Model, program] { rr: platform "https://github.com/lukewilliamboswell/roc-ray/releases/download/alpha-0-test/HB6qgLwjKqjmVXTxJEzFqnC72SJEfif98CnJ8ZVN86UE.tar.zst" }

import rr.Draw
import rr.Color
import rr.PlatformState

Model : {
    message: Str,
}
program = { init!, render! }

init! : () => Try(Model, [Exit(I64), ..])
init! = || Ok({
    message: "Roc :heart: Raylib!",
})

render! : Model, PlatformState => Try(Model, [Exit(I64), ..])
render! = |model, state| {

    # Circle follows the mouse, changes color when clicked
    circle_color = if state.mouse.left { Color.Red } else { Color.Green }

    Draw.draw!(RayWhite, || {
        Draw.text!({ pos: { x: 10, y: 10 }, text: model.message, size: 30, color: Color.DarkGray })
        Draw.rectangle!({ x: 100, y: 200, width: 100, height: 80, color: Color.Red })
        Draw.line!({ start: { x: 100, y: 500 }, end: { x: 600, y: 550 }, color: Color.Blue })

        # Draw circle last so it is drawn over the top of other shapes
        Draw.circle!({ center: { x: state.mouse.x, y: state.mouse.y }, radius: 50, color: circle_color })
    })

    Ok(model)
}

This is using a very alpha release that only has macos pre-built host binaries included, and definitely requires roc built from source. I'd like to get Linux and Windows hosts supported next I think before adding too many more features and making a real branch in the roc-ray repository.

$ roc build examples/hello_world.roc

Note* that we have a bug that prevents using the run subcommand, so you just have to build it first then run the executable.

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:02):

Yay linux seems to be working now also :smiley:

image.png

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:03):

lbw@lbw-B850-GAMING-X-WIFI6E:~/Documents/Github/roc-platform-template-zig$ file hello_world
hello_world: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/x86_64-linux-gnu/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, with debug_info, not stripped

It's not a fully static binary though, I couldn't find a way to make it work with musl

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:11):

I've found an issue with linking math symbols libm I'm digging into

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:13):

Already this is way cooler than the original roc-ray implementation... no need to have a complete dev toolchain installed like cargo for application authors, just roc and your good to go!! (needs further testing to confirm this works for everyone)

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:23):

Ok cool, fixed my maths symbols I think.

Anyone running linux... can you help me test this?

app [Model, program] { rr: platform "https://github.com/lukewilliamboswell/roc-ray/releases/download/alpha-0-test/EydNNTemUX6GMbTE4sY9JWqvLpPxvp2ZcwKDSn3WaDmB.tar.zst" }

import rr.Draw
import rr.Color
import rr.PlatformState

Model : {
    message: Str,
}
program = { init!, render! }

init! : () => Try(Model, [Exit(I64), ..])
init! = || Ok({
    message: "Roc :heart: Raylib!",
})

render! : Model, PlatformState => Try(Model, [Exit(I64), ..])
render! = |model, state| {

    # Circle follows the mouse, changes color when clicked
    circle_color = if state.mouse.left { Color.Red } else { Color.Green }

    Draw.draw!(RayWhite, || {
        Draw.text!({ pos: { x: 10, y: 10 }, text: model.message, size: 30, color: Color.DarkGray })
        Draw.rectangle!({ x: 100, y: 200, width: 100, height: 80, color: Color.Red })
        Draw.line!({ start: { x: 100, y: 500 }, end: { x: 600, y: 550 }, color: Color.Blue })

        # Draw circle last so it is drawn over the top of other shapes
        Draw.circle!({ center: { x: state.mouse.x, y: state.mouse.y }, radius: 50, color: circle_color })
    })

    Ok(model)
}

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:24):

@Dan G Knutson you might be interested

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:27):

Next up is Windows... though it might be worthwhile revisiting this issue first :shrug: https://github.com/roc-lang/roc/issues/8779

view this post on Zulip nandi (Jan 12 2026 at 23:33):

image.png

on linux

view this post on Zulip nandi (Jan 12 2026 at 23:35):

single file gui app lets goooo

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:35):

Which distro are you running? what OS/Arch too?

view this post on Zulip nandi (Jan 12 2026 at 23:36):

ubuntu 24.04 x64, musl failed but glibc worked

view this post on Zulip Dan G Knutson (Jan 12 2026 at 23:55):

Same over here! (on PopOS, which is basically ubuntu) I'm stoked for this

view this post on Zulip Luke Boswell (Jan 12 2026 at 23:56):

Sounds like I need to move this into a branch in roc-ray so we can start adding more features

view this post on Zulip nandi (Jan 13 2026 at 02:40):

The problem here is different: libraylib.a is a static library (.a), not a compiled binary. It contains object files with
unresolved symbols that expect to be linked against glibc at build time.

When raylib was compiled on an older system with _FORTIFY_SOURCE, the compiler generated calls to __sprintf_chk etc. Those symbols
existed in old glibc but have different signatures or are gone in glibc 2.42.

Backwards compat only works for:

 - Fully linked executables/shared libraries (.so)
 - They embed symbol versions like printf@GLIBC_2.2.5

Doesn't work for:

 - Static .a files that still need to be linked
 - They just have raw symbol references

So this is a build-time incompatibility, not a runtime one. The solution is rebuilding raylib on your system.

view this post on Zulip nandi (Jan 13 2026 at 02:40):

When I try to run with arch linux

view this post on Zulip Luke Boswell (Jan 13 2026 at 02:42):

Ok I had a similar issue with the Rust version... I think the solution here is to bundle the published raylib libraries and then write our own C wrapper instead of using zigraylib

view this post on Zulip Luke Boswell (Jan 13 2026 at 02:43):

They're published here https://github.com/raysan5/raylib/releases/tag/5.5

view this post on Zulip Will Alexander (Jan 13 2026 at 21:08):

Luke Boswell said:

Sounds like I need to move this into a branch in roc-ray so we can start adding more features

Yes please.

view this post on Zulip Luke Boswell (Jan 14 2026 at 10:56):

It's been a busy day with work and I didn't achieve what I hoped to.

My goals at the start of the day:

What I ended up doing instead

I'll try and finish cleaning up and migrate to a repo tomorrow. I'd love to add Windows support and cut an alpha release sometime this week.

I'll be travelling for work all next week and it would be nice to know the harder integration issues (like linking hosts and dependencies) are resolved, and I can focus on adding features leading up to the online meetup.


Last updated: Feb 20 2026 at 12:27 UTC