Stream: platform development

Topic: Go Platform with new compiler


view this post on Zulip Oskar Hahn (Aug 05 2026 at 21:00):

Hi, I am trying to build a go platform for the new compiler. But I run into problems, that I do not understand.

The Code is here: https://github.com/ostcar/roc-platform-template-go/tree/new_compiler

The current code does not call into roc. It should just start.

I am able to build the libhost.a with:

CGO_ENABLED=1 CC="zig cc -target x86_64-linux-musl" go build -C host -buildmode c-archive -tags netgo,osusergo -o ../platform/targets/x64musl/libhost.a

And roc also builds some binary:

roc build examples/echo.roc
0 errors and 0 warnings found in 216ms while successfully building:

    echo

But when I try to call it, I get a segmentation fault:

./echo
Segmentation fault         (core dumped) ./echo

I don't know, what the problem could be. When discussing it with the AI, it sounds like it could be a conflict between the musl signal handling and the go signal handling. But I found a lot of other projects, that successfully combine go and musl.

Do you have other ideas, what the problem could be or how to debug it further?

view this post on Zulip Luke Boswell (Aug 05 2026 at 22:17):

You can ask an AI Agent to drive a debugger like gdb or lldb and help you isolate the segfault.

view this post on Zulip Aurélien Geron (Aug 05 2026 at 22:21):

Walking people through the steps to debug (and possibly fix) segfaults would be a great topic for the next meetup!

view this post on Zulip Aurélien Geron (Aug 05 2026 at 22:22):

And a "how-to-best-contribute" talk would be great too. :folded_hands:

view this post on Zulip Luke Boswell (Aug 05 2026 at 22:25):

the checked-in musl crt1.o jumps into Go’s c-archive entry without the initialization sequence Go expects.

Possible suspect

view this post on Zulip Luke Boswell (Aug 05 2026 at 22:50):

I think I've got Go working... there was a lot to modify and I had to vendor a some things from Zig.

I'm setting up CI now with the full cross-compiled matrix so we can be sure it's working on every target.

view this post on Zulip Luke Boswell (Aug 05 2026 at 22:56):

As I suspected we will need to add mingw as a new roc target for Windows support

view this post on Zulip Luke Boswell (Aug 06 2026 at 00:39):

Done https://github.com/lukewilliamboswell/roc-platform-template-go

I'll make an announcement too so it's easier to find


Last updated: Aug 12 2026 at 12:35 UTC