Stream: compiler development

Topic: building zig from source, help setting up local dev


view this post on Zulip drathier (Dec 25 2025 at 21:53):

Hello :) I tried building roc from source, and got a bunch of errors. Saw in ci that it uses zig 13. Why such an old version, if the compiler was recently rewritten in zig?

view this post on Zulip nandi (Dec 25 2025 at 21:55):

pretty sure it uses 0.15.2

view this post on Zulip nandi (Dec 25 2025 at 21:55):

https://github.com/roc-lang/roc/blob/main/BUILDING_FROM_SOURCE.md

view this post on Zulip Richard Feldman (Dec 25 2025 at 21:59):

I think maybe our old Rust compiler is still using zig 13 (the stdlib has always been in Zig, even back when the rest of the compiler was in Rust) because that was the latest version when we started the rewrite

view this post on Zulip drathier (Dec 25 2025 at 22:00):

https://github.com/roc-lang/roc/blob/main/.github/workflows/nightly_linux_x86_64.yml#L23 mentions 13, yes

view this post on Zulip drathier (Dec 25 2025 at 22:00):

I got a bunch of compilation errors with master and with 0.15.2, which is why I checked. Reinstalling zig now to make sure it's 0.15.2 and retrying

view this post on Zulip drathier (Dec 25 2025 at 22:04):

for reference, here's a recent zig master

~/drathier/roc$ /Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/zig build
/Users/drathier/.cache/zig/p/bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi/build.zig:181:14: error: no field or member function named 'addCSourceFile' in 'Build.Step.Compile'
    cffi_test.addCSourceFile(.{
    ~~~~~~~~~^~~~~~~~~~~~~~~
/Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
/Users/drathier/.cache/zig/p/bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi/build.zig:181:14: note: method invocation only supports up to one level of implicit pointer dereferencing
/Users/drathier/.cache/zig/p/bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi/build.zig:181:14: note: use '.*' to dereference pointer
referenced by:
    runBuild__anon_91509: /Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build.zig:2226:33
    dependencyInner__anon_87981: /Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build.zig:2207:29
    8 reference(s) hidden; use '-freference-trace=10' to see all references
/Users/drathier/.cache/zig/p/zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0/build.zig:51:26: error: no field or member function named 'addCSourceFiles' in 'Build.Step.Compile'
    if (compression) zstd.addCSourceFiles(.{ .root = upstream.path("lib"), .files = compression_sources });
                     ~~~~^~~~~~~~~~~~~~~~
/Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
/Users/drathier/.cache/zig/p/zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0/build.zig:51:26: note: method invocation only supports up to one level of implicit pointer dereferencing
/Users/drathier/.cache/zig/p/zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0/build.zig:51:26: note: use '.*' to dereference pointer
build.zig:1797:28: error: operator > not allowed for type 'Io.Timestamp'
        if (roc_stat.mtime > bin_stat.mtime) {
            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Io.zig:875:23: note: struct declared here
pub const Timestamp = struct {

view this post on Zulip nandi (Dec 25 2025 at 22:05):

you try zig build roc?

view this post on Zulip drathier (Dec 25 2025 at 22:07):

~/drathier/roc$ /Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/zig build roc
/Users/drathier/.cache/zig/p/bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi/build.zig:181:14: error: no field or member function named 'addCSourceFile' in 'Build.Step.Compile'
    cffi_test.addCSourceFile(.{
    ~~~~~~~~~^~~~~~~~~~~~~~~
/Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
/Users/drathier/.cache/zig/p/bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi/build.zig:181:14: note: method invocation only supports up to one level of implicit pointer dereferencing
/Users/drathier/.cache/zig/p/bytebox-0.0.1-SXc2seA2DwAUHbrqTMz_mAQQGqO0EVPYmZ89YZn4KsTi/build.zig:181:14: note: use '.*' to dereference pointer
referenced by:
    runBuild__anon_91509: /Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build.zig:2226:33
    dependencyInner__anon_87981: /Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build.zig:2207:29
    8 reference(s) hidden; use '-freference-trace=10' to see all references
/Users/drathier/.cache/zig/p/zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0/build.zig:51:26: error: no field or member function named 'addCSourceFiles' in 'Build.Step.Compile'
    if (compression) zstd.addCSourceFiles(.{ .root = upstream.path("lib"), .files = compression_sources });
                     ~~~~^~~~~~~~~~~~~~~~
/Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Build/Step/Compile.zig:1:1: note: struct declared here
const builtin = @import("builtin");
^~~~~
/Users/drathier/.cache/zig/p/zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0/build.zig:51:26: note: method invocation only supports up to one level of implicit pointer dereferencing
/Users/drathier/.cache/zig/p/zstd-1.5.7-KEItkJ8vAAC5_rRlKmLflYQ-eKXbAIQBWZNmmJtS18q0/build.zig:51:26: note: use '.*' to dereference pointer
build.zig:1797:28: error: operator > not allowed for type 'Io.Timestamp'
        if (roc_stat.mtime > bin_stat.mtime) {
            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/Users/drathier/Downloads/zig-aarch64-macos-0.16.0-dev.1634+b27bdd5af/lib/std/Io.zig:875:23: note: struct declared here
pub const Timestamp = struct {
                      ^~~~~~

view this post on Zulip drathier (Dec 25 2025 at 22:39):

got it building now, thanks for helping out!

view this post on Zulip nandi (Dec 25 2025 at 22:40):

what was the issue?

view this post on Zulip drathier (Dec 25 2025 at 22:42):

not sure, unfortunately. I reinstalled zig with brew


Last updated: Jan 12 2026 at 12:19 UTC