Stream: beginners

Topic: Roc on Alpine Linux


view this post on Zulip removewingman (Aug 02 2026 at 00:08):

I am trying to use roc on Alpine Linux.
So far it is not going so great, with either binary using the https://github.com/roc-lang/nightlies/releases/tag/nightly-2026-August-01-1c1cecc (roc_nightly-linux_x86_64-2026-08-01-1c1cecc.tar.gz) or building from source https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/106329 I get this error:
copyimagetmp.avif

Could not build it on my own Laptop, because it needs to much memory. (I have 4 GB and 4 GB SWAP)

view this post on Zulip Luke Boswell (Aug 02 2026 at 00:25):

Are you on an arm or intel architecture? I'm thinking about how we might repro this, maybe Docker could help.
nvm I see in your build

view this post on Zulip Luke Boswell (Aug 02 2026 at 00:35):

My immediate suspicion is that we now target the x86-64-v3 CPU level for SIMD ... maybe that is related?

view this post on Zulip Luke Boswell (Aug 02 2026 at 00:45):

I was able to reproduce the Illegal instruction failure with the help of Codex.

Roc targets the x86-64-v3 CPU level, which requires features including AVX2 and BMI2. On a CPU that does not provide that instruction set, the operating system terminates Roc with SIGILL, which the shell displays as Illegal instruction.

We verified the CPU boundary using QEMU emulation:

Emulated CPU Result
Nehalem Illegal instruction (exit 132)
Sandy Bridge Illegal instruction (exit 132)
Ivy Bridge Illegal instruction (exit 132)
Haswell Roc starts successfully

Could you please share your CPU model and flags? On Alpine/Linux, this command should provide the relevant information:

grep -m1 -E 'model name|flags' /proc/cpuinfo

The source build running out of memory on a machine with 4 GB RAM and 4 GB swap is unrelated.

view this post on Zulip Luke Boswell (Aug 02 2026 at 00:52):

At the very least we should probably have all this documented somewhere...

I'm not sure if the cli itself needs this. I know Richard landed https://github.com/roc-lang/roc/pull/10302 recently which added the requirement for generated code.

I would assume it is possible to patch the compiler and should be possible to use the interpreter on these cpu's.

view this post on Zulip removewingman (Aug 02 2026 at 01:09):

The source build running out of memory on a machine with 4 GB RAM and 4 GB swap is unrelated. (I know, but I would like to have that documented as well, how much approximately is needed to build roc)

CPU (pretty old, 2 cores) : model name : Intel(R) Celeron(R) N4020 CPU @ 1.10GHz

Idk if this helps, but zig works, and they also have llvm backend

view this post on Zulip Luke Boswell (Aug 02 2026 at 01:20):

Thank you for the feedback, I made an issue so we can track this and roll it into our docs https://github.com/roc-lang/roc/issues/10538

view this post on Zulip removewingman (Aug 02 2026 at 11:48):

The documentation is a nice to have, but this actually does not solve my problem. Will I be able to use roc? Or will there be specific system requirements like windows has

view this post on Zulip Richard Feldman (Aug 02 2026 at 13:51):

@removewingman just to clarify, is the issue that you can't run roc at all, or that you can't run the roc programs that it builds, or both?

view this post on Zulip Richard Feldman (Aug 02 2026 at 13:52):

I assume it's the Celeron processor not having the instructions we're expecting, and there are different potential solutions depending on which is the issue

view this post on Zulip removewingman (Aug 02 2026 at 14:52):

@Richard Feldman The first thing, if I try to compile a .roc file, I get the error, so I don't even get to the second step. I tried to get a hello world up and running.
![show](https://roc.zulipchat.com/user_uploads/22008/MIMcu2ElsZ5Q0ASjCDXYjOJA/copyimagetmp.avif)

view this post on Zulip Richard Feldman (Aug 03 2026 at 01:47):

@removewingman can you try it out on current main? This PR should hopefully have fixed it!

view this post on Zulip removewingman (Aug 03 2026 at 07:45):

@Richard Feldman Nice, it actually fixed the problem with the Celeron processor, thanks.

Now there is a problem with linking, probably Alpine Linux and musl libc related:
copyimagetmp.avif

(if the commit is in the next nightly build, gonna try with this one again, maybe it will work did not work)

view this post on Zulip removewingman (Aug 03 2026 at 08:06):

@Anton Feedback for: https://github.com/roc-lang/nightlies/releases/

For building nightly one needs the source code from the current nightly build, this can be obtained by: https://github.com/roc-lang/roc/archive/$_commit.tar.gz

This would make it simpler and one does not have to rely on the github archive feature of commits.

I hope it is ok to ping and give feedback/make suggestions :upside_down:

view this post on Zulip Richard Feldman (Aug 03 2026 at 21:22):

removewingman said:

Now there is a problem with linking, probably Alpine Linux and musl libc related:
copyimagetmp.avif

@removewingman can you try on https://github.com/roc-lang/roc/pull/10582 and see if it works on that branch?

view this post on Zulip removewingman (Aug 03 2026 at 22:35):

@Richard Feldman It worked, lets go, much appreciated.
copyimagetmp.avif

I will wait until the changes in roc-lang/nightlies are landed and finish the aport.

view this post on Zulip Notification Bot (Aug 03 2026 at 23:38):

removewingman has marked this topic as resolved.

view this post on Zulip Notification Bot (Aug 04 2026 at 00:05):

removewingman has marked this topic as unresolved.

view this post on Zulip removewingman (Aug 04 2026 at 00:06):

@Richard Feldman Sorry, have to unresolve, while trying to run hello world

Got the following error (main.roc works tho):
copyimagetmp.avif

view this post on Zulip Luke Boswell (Aug 04 2026 at 01:06):

It would be good to know if thats on the platform or roc side... not sure how to figure that out

view this post on Zulip Richard Feldman (Aug 04 2026 at 01:09):

I'm on it

view this post on Zulip Richard Feldman (Aug 04 2026 at 01:19):

it turned out to be kinda both: selecting which host to use for the platform: https://github.com/roc-lang/roc/pull/10593

view this post on Zulip removewingman (Aug 04 2026 at 02:26):

This is currently the branch default-platform-no-libc, got this:
copyimagetmp.avif
it this the expected behavior? I am confused, would be best if https://github.com/roc-lang/roc/pull/10582 is merged, to eliminate that this is the mistake

view this post on Zulip Richard Feldman (Aug 04 2026 at 02:30):

it's definitely not the expected behavior! and I'll merge that PR as soon as it passes CI :smile:

view this post on Zulip Anton (Aug 04 2026 at 12:47):

@removewingman, this will be published starting tomorrow

view this post on Zulip removewingman (Aug 04 2026 at 22:17):

Also with https://github.com/roc-lang/roc/pull/10593 landed and the others, I still get the following error, maybe it is the platform now? Idk.

copyimagetmp.avif

view this post on Zulip Richard Feldman (Aug 05 2026 at 01:17):

yep, that's a platform issue! I'll open a PR to the platform

view this post on Zulip Richard Feldman (Aug 05 2026 at 03:16):

https://github.com/lukewilliamboswell/roc-platform-template-zig/pull/37

view this post on Zulip Luke Boswell (Aug 05 2026 at 03:18):

I'm just hardening up the test infra while I'm looking at this platform again, lessons I've learnt elsewhere

view this post on Zulip Luke Boswell (Aug 05 2026 at 03:18):

Almost done

view this post on Zulip Luke Boswell (Aug 05 2026 at 03:27):

https://github.com/lukewilliamboswell/roc-platform-template-zig/releases/tag/1.1.0

view this post on Zulip removewingman (Aug 05 2026 at 08:59):

Lets go, the second time :)
Works:
copyimagetmp.avif

Thanks for the work, much appreciated.
If one wants to have actual BSD support or other targets, one needs Compiler and Plattform support, imo these should be tracked together.

view this post on Zulip Notification Bot (Aug 05 2026 at 08:59):

removewingman has marked this topic as resolved.

view this post on Zulip Notification Bot (Aug 05 2026 at 12:05):

removewingman has marked this topic as unresolved.

view this post on Zulip removewingman (Aug 05 2026 at 12:09):

Would it be also possible after the zig roc platform template has now support for x64v1musl and arm64v1musl with: https://github.com/lukewilliamboswell/roc-platform-template-zig/pull/37

To add these here aswell:

view this post on Zulip removewingman (Aug 18 2026 at 20:01):

I had similar issues with other binaries built with zig. So I opened an issue in zig: https://codeberg.org/ziglang/zig/issues/36421 and found out that one only needs to build like this zig build build-release -Dcpu=baseline and it should work.
So the targets x64v1musl and arm64v1musl can be removed, this was the pr that added them: https://github.com/roc-lang/roc/pull/10615/files

view this post on Zulip removewingman (Aug 19 2026 at 12:01):

Would it be possible to have instead of default and v1 a build option compatible and performant and one can choose when building rock which to use, it is somewhat annoying with the different versions and to tinker around what works with what and how to get it running.

view this post on Zulip Anton (Aug 19 2026 at 12:41):

a build option compatibleand performant

Yeah, I'm in favor of that. We can add max compatibility nightly releases too and have the install script check your CPU so it automatically downloads the right one for your system.

view this post on Zulip Richard Feldman (Aug 19 2026 at 13:00):

sorry, I'm struggling to follow this thread :sweat_smile:

view this post on Zulip Richard Feldman (Aug 19 2026 at 13:00):

there are at least 3 things going on here:

view this post on Zulip Richard Feldman (Aug 19 2026 at 13:01):

  1. what OS and CPU architecture is the roc binary itself targeting?

view this post on Zulip Richard Feldman (Aug 19 2026 at 13:01):

  1. when you do roc build on a Roc application, what OS and CPU architecture does the resulting binary target?

view this post on Zulip Richard Feldman (Aug 19 2026 at 13:01):

  1. what are the names for Roc's --target flags?

view this post on Zulip Richard Feldman (Aug 19 2026 at 13:02):

I'm not sure which of these 3 are being discussed in this conversation - can we clarify that?

view this post on Zulip removewingman (Aug 20 2026 at 01:33):

  1. Alpine Linux, x86_64, musl, cpu: goldmont_plus
  2. Alpine Linux, x86_64, musl, std.Target.x86.cpu.x86_64
  3. target: x64v1musl

The default roc compiler is built for std.Target.x86.cpu.x86_64_v3, which my CPU is not compatible with, that is why I need v1 which uses std.Target.x86.cpu.x86_64. Now the roc compiler works, but I have to go to every platform and ask, can you please implement v1 so I can use them, e.g. basic-cli.

Would it be possible to make this controllable via a build option in both the compiler and platforms, so I can build both (the compiler and platform) in compatible mode and they work and if one wants to have maximum performance but not so old hardware support built in performance mode.

view this post on Zulip Anton (Aug 21 2026 at 12:45):

It's tricky to have a one size fits all solution for the platform because those can be built with any language.

view this post on Zulip Anton (Aug 21 2026 at 12:46):

I think compatible and performance mode would be the same thing for local builds because you would just build with the full instruction set your CPU supports.


Last updated: Sep 03 2026 at 15:16 UTC