I am trying to use roc on OpenBSD. I am trying to build the latest release from source, with (llvm-21.1.8p4 (installed)).
![]()
Seems like an zig error tho? Idk, I specified -Dllvm-path=/usr/local
I am going to upgrade to OpenBSD snapshot and try with zig as system binary, maybe this will work. (did not work, got the same error)
@removewingman we actually did not have BSD support previously, but I just landed a PR to add it - can you give it a shot on current main?
@Richard Feldman tried it on latest commit, command: zig build build-release -Dcompiler-version=nightly-2026-08-03-72b60af7cf -Dllvm-path=/usr/local
and with:
llvm-21.1.8p6 (installed)
llvm-22.1.8p3 (installed)
Got a lot of: error: unable to find static system library 'lldMinGW' using strategy 'mode_first'.
Full log:
log.txt
ok seems like we'll need to get a BSD machine set up so we aren't flying blind - @Luke Boswell is working on that :smile:
I have such a VM and I am trying to compile now!
I started the compile. I am on FreeBSD 15.1 (FreeBSD 15.1-RELEASE). I will keep you posted. (Slight restart because I installed the wrong version of zig!)
Ive started... but Im very slow with my bsd foo. I almost managed to get the right version of Zig running yesterday, but got distracted by roc-ray
FYI: I think that the problem is
llvm-config that fails andI am getting really close.
Would it be possible for now, to add OpenBSD and other BSDs as Cross Compilation Targets?
Something like this should be right: .{ .name = "x64openbsd", .query = .{ .cpu_arch = .x86_64, .os_tag = .openbsd, .abi = .none } },
yep! I'll make a PR :thumbs_up:
https://github.com/roc-lang/roc/pull/10591
I can test OpenBSD as soon as: https://github.com/roc-lang/roc/pull/10582 (Alpine Linux fix) is merged and included.
I think that I found the last little problem.
For e2e platform support, I'd recommend using this platform and adding support for that target if you can build from source https://github.com/lukewilliamboswell/roc-platform-template-zig
If we get that working we're well on the way to basic-cli and others
@removewingman that PR landed btw, so cross compilation to BSD is now on main
@Richard Feldman Nice, if you update, this one with main, I can try again (then it is in my Alpine Linux build): https://github.com/roc-lang/roc/pull/10582
Took a little longer than I wanted, but I have a compiled roc on FreeBSD.
The outstanding issue is solved right now with a workaround, but I will introduce a PR that explains the problem and contains at least a first-whack at a fix.
@removewingman https://github.com/roc-lang/roc/pull/10582 now has main merged in
@Richard Feldman This is currently the branch default-platform-no-libc, got this:
![]()
fyi if you roc version in your cli when you take a screenshot you can see the roc commit sha and thats helpful for confirming we are tracking the same source
It actually does not, since I am building from source: Roc compiler version nightly-2026-August-04-main
https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/106329
(I should probably remove -Dcompiler-version in the build)
What does roc version give you instead? this is what I see
11:58:52 ~/Documents/Github/roc main$ roc version
Roc compiler version debug-5c51ae1c
I have a fix in progress btw, that was enough to go on :smile:
ok it's gonna need a couple of PRs to fix
one is in progress and another will be the fix for https://github.com/roc-lang/roc/issues/10598 on top of that one
thanks for reporting all this @removewingman - we've never had any BSD, Alpine, or Celeron usage before, so this is shaking out a lot of issues! :sweat_smile:
Are you using Docker to repro the alpine issues Richard? how are you doing that?
thanks for all the work, I know these thing are really small use and edge cases
@Luke Boswell no, the thing about Alpine is just that it doesn't provide libc so you have to link musl (or equivalent) - so I'm not reproducing it, just following paths where we're assuming libc is available and it's not safe to assume that (e.g. passing -lc to lld when we shouldn't because libc isn't available)
it's easy to get wrong because some operating systems require dynamically linking libc (e.g. macOS, Windows, openbsd)
so we have to pass it in the right circumstances and also not pass it in the right circumstances, including when compiling for the local machine vs cross-compiling for a different one :sweat_smile:
Richard Feldman said:
Luke Boswell no, the thing about Alpine is just that it doesn't provide libc so you have to link musl (or equivalent) - so I'm not reproducing it, just following paths where we're assuming libc is available and it's not safe to assume that (e.g. passing
-lctolldwhen we shouldn't because libc isn't available)
That's actually one of the problems with the FreeBSD compilation. The LLVM library that comes packaged with FreeBSD can call backtrace (https://man7.org/linux/man-pages/man3/backtrace.3.html) to build a backtrace. Unfortunately, FreeBSD's libc does not include that function -- it's in a separate library (named execinfo). So, my current fight is to get zig's build system to recognize that it is necessary to link execinfo even though it can't tell that it needs to (sorry about ending a sentence in a preposition). So, the build system keeps dropping my -lexecinfo because it doesn't see any symbols needed from it (but because LLVM's libraries rely on it, ... well, you get the idea).
I tried the branch: https://github.com/roc-lang/roc/tree/issue-10598-bsd-default-platform
To crosscompile for FreeBSD and run (current release 15.1), file is for 12.0 tho:
![]()
Also when compiling for NetBSD (current release 11.0), file is for 8.0 tho: main: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for NetBSD 8.0, BuildID[sha1]=3d6d211fe5bdc18babbca620ded910862c585698, with debug_info, not stripped
If anyone wants to reproduce: https://codeberg.org/removewingman/qemu-setup
I am sorry that I have not yet had a chance to write up the notes that I made on compiling for FreeBSD and to pull together a PR with the necessary changes! I promise that I will get it done this evening!!
Last updated: Aug 12 2026 at 12:35 UTC