Skip to content

not able to build my sqlite example app #195

Open

Description

@enverbisevac

sqlite-example zig build
install
└─ install sqlite-example
└─ compile exe sqlite-example Debug native failure
error: the following command terminated unexpectedly:
/Users/enver/zig/zig build-exe -ODebug --dep sqlite -Mroot=/Users/enver/Projects/zig/sqlite-example/src/main.zig .zig-cache/o/010cecb204293f2dffed29a93cf0a23e/libsqlite.dylib -rpath .zig-cache/o/010cecb204293f2dffed29a93cf0a23e -I /Users/enver/.cache/zig/p/sqlite-3.48.0-F2R_a52ODgDFoOf0S8ZamFe2k7JJwqM0cDzOF6nxr_uO/c -I /Users/enver/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I .zig-cache/o/9e2f47ce5883e2d0ec36dcf6a0703c14 -Msqlite=/Users/enver/.cache/zig/p/sqlite-3.48.0-F2R_a52ODgDFoOf0S8ZamFe2k7JJwqM0cDzOF6nxr_uO/sqlite.zig -lc --cache-dir .zig-cache --global-cache-dir /Users/enver/.cache/zig --name sqlite-example --zig-lib-dir /Users/enver/zig/lib/ --listen=-

Build Summary: 2/5 steps succeeded; 1 failed
install transitive failure
└─ install sqlite-example transitive failure
└─ compile exe sqlite-example Debug native failure

error: the following build command failed with exit code 1:
.zig-cache/o/85836422099462cd4980ea16f5a7ce24/build /Users/enver/zig/zig /Users/enver/zig/lib /Users/enver/Projects/zig/sqlite-example .zig-cache /Users/enver/.cache/zig --seed 0x77c80409 -Z5b5cb8dfef11fa49

Activity

  1. tadejg commented on Aug 29, 2025

    @tadejg

    +1 same issue here. I'm using Zig 0.15.1 with branch zig-0.15.1 (master branch also doesn't work). I'm on x86_64 linux. Looks like CI caught the issue a few commits ago, but it hasn't been noticed/fixed yet. Last known working version: be8b496

    EDIT: Last known working version doesn't have support for zig 0.15.1

  2. vrischmann commented on Aug 29, 2025

    @vrischmann
    Owner

    https://github.com/vrischmann/zig-sqlite-demo works fine with zig 0.15.1; please create a reproducer that I can easily clone and test myself, I can't help you with just this report.

  3. tadejg commented on Aug 29, 2025

    @tadejg

    https://github.com/vrischmann/zig-sqlite-demo works fine with zig 0.15.1; please create a reproducer that I can easily clone and test myself, I can't help you with just this report.

    This demo app also fails to compile for me

    install
    └─ install zig-sqlite-demo
       └─ compile exe zig-sqlite-demo Debug native failure
    error: the following command terminated unexpectedly:
    /home/user/.night.zig/zig-x86_64-linux-0.15.1/zig build-exe -ODebug --dep sqlite -Mroot=/tmp/zig-sqlite-demo/src/main.zig .zig-cache/o/843479677efb62fc79217c781faea9ed/libsqlite.so -rpath .zig-cache/o/843479677efb62fc79217c781faea9ed -I /home/user/.cache/zig/p/sqlite-3.48.0-F2R_a52ODgDFoOf0S8ZamFe2k7JJwqM0cDzOF6nxr_uO/c -I /home/user/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I .zig-cache/o/60d458a4c931254c1a0aeafdc99fc02c -Msqlite=/home/user/.cache/zig/p/sqlite-3.48.0-F2R_a52ODgDFoOf0S8ZamFe2k7JJwqM0cDzOF6nxr_uO/sqlite.zig -lc --cache-dir .zig-cache --global-cache-dir /home/user/.cache/zig --name zig-sqlite-demo --zig-lib-dir /home/user/.night.zig/zig-x86_64-linux-0.15.1/lib/ --listen=-
    
    Build Summary: 2/5 steps succeeded; 1 failed
    install transitive failure
    └─ install zig-sqlite-demo transitive failure
       └─ compile exe zig-sqlite-demo Debug native failure
    
    error: the following build command failed with exit code 1:
    .zig-cache/o/819e4b7df81e8b2cd3274ffa65475120/build /home/user/.night.zig/zig-x86_64-linux-0.15.1/zig /home/user/.night.zig/zig-x86_64-linux-0.15.1/lib /tmp/zig-sqlite-demo .zig-cache /home/user/.cache/zig --seed 0x3244ee75 -Zc17cbf649def8480
    
    
  4. tadejg commented on Aug 29, 2025

    @tadejg

    UPDATE: I found that building with --release=safe (or -Doptimize=ReleaseSafe; also fast release) works as expected. The issue only appears with -Doptimize=Debug

  5. tadejg commented on Aug 29, 2025

    @tadejg

    @vrischmann if it helps, here's a Dockerfile which reproduces the issue.

    FROM ubuntu:25.10
    
    RUN apt update && apt install -y ca-certificates git wget xz-utils
    
    ARG ZIG_VERSION="0.15.1"
    
    RUN wget -O /tmp/zig.tar.xz https://ziglang.org/download/${ZIG_VERSION}/zig-x86_64-linux-${ZIG_VERSION}.tar.xz && \
        mkdir -p /opt/zig && tar -xf /tmp/zig.tar.xz -C /opt/zig && \
        echo "export PATH=\"/opt/zig/zig-x86_64-linux-${ZIG_VERSION}:/usr/bin:$$PATH\"" >~/.profile
    
    RUN git clone https://github.com/vrischmann/zig-sqlite-demo
    # Debug mode is broken
    RUN bash -l -c "cd zig-sqlite-demo && zig build"
    # Release mode works
    # RUN bash -l -c "cd zig-sqlite-demo && zig build --release=safe"
    Output
    [+] Building 12.8s (8/8) FINISHED                                                                                                                                                                                                               docker:default
     => [internal] load build definition from Dockerfile                                                                                                                                                                                                      0.0s
     => => transferring dockerfile: 653B                                                                                                                                                                                                                      0.0s
     => [internal] load metadata for docker.io/library/ubuntu:25.10                                                                                                                                                                                           0.0s
     => [internal] load .dockerignore                                                                                                                                                                                                                         0.0s
     => => transferring context: 2B                                                                                                                                                                                                                           0.0s
     => [1/5] FROM docker.io/library/ubuntu:25.10                                                                                                                                                                                                             0.0s
     => CACHED [2/5] RUN apt update && apt install -y ca-certificates git wget xz-utils                                                                                                                                                                       0.0s
     => CACHED [3/5] RUN wget -O /tmp/zig.tar.xz https://ziglang.org/download/0.15.1/zig-x86_64-linux-0.15.1.tar.xz &&     mkdir -p /opt/zig && tar -xf /tmp/zig.tar.xz -C /opt/zig &&     echo "export PATH="/opt/zig/zig-x86_64-linux-0.15.1:/usr/bin:$$PA  0.0s
     => CACHED [4/5] RUN git clone https://github.com/vrischmann/zig-sqlite-demo                                                                                                                                                                              0.0s
     => ERROR [5/5] RUN bash -l -c "cd zig-sqlite-demo && zig build"                                                                                                                                                                                         12.7s
    ------
     > [5/5] RUN bash -l -c "cd zig-sqlite-demo && zig build":
    12.63 install
    12.63 +- install zig-sqlite-demo
    12.63    +- compile exe zig-sqlite-demo Debug native failure
    12.63 error: the following command terminated unexpectedly:
    12.63 /opt/zig/zig-x86_64-linux-0.15.1/zig build-exe -ODebug --dep sqlite -Mroot=/zig-sqlite-demo/src/main.zig .zig-cache/o/b6eba042132138d967cc8b80d9ddb2d4/libsqlite.so -rpath .zig-cache/o/b6eba042132138d967cc8b80d9ddb2d4 -I /root/.cache/zig/p/sqlite-3.48.0-F2R_a52ODgBD8xSs3fcLI3I3Axy3eZ2HmT2V3Giy9ETV/c -I /root/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I .zig-cache/o/60d458a4c931254c1a0aeafdc99fc02c -Msqlite=/root/.cache/zig/p/sqlite-3.48.0-F2R_a52ODgBD8xSs3fcLI3I3Axy3eZ2HmT2V3Giy9ETV/sqlite.zig -lc --cache-dir .zig-cache --global-cache-dir /root/.cache/zig --name zig-sqlite-demo --zig-lib-dir /opt/zig/zig-x86_64-linux-0.15.1/lib/ --listen=-
    12.63
    12.63 Build Summary: 2/5 steps succeeded; 1 failed
    12.63 install transitive failure
    12.63 +- install zig-sqlite-demo transitive failure
    12.63    +- compile exe zig-sqlite-demo Debug native failure
    12.63
    12.63 error: the following build command failed with exit code 1:
    12.63 .zig-cache/o/d3e3e561b7905abef7192a47fc05bc3c/build /opt/zig/zig-x86_64-linux-0.15.1/zig /opt/zig/zig-x86_64-linux-0.15.1/lib /zig-sqlite-demo .zig-cache /root/.cache/zig --seed 0x2e317e41 -Z9483360f9eef5bd5
    ------
    Dockerfile:13
    --------------------
      11 |     RUN git clone https://github.com/vrischmann/zig-sqlite-demo
      12 |     # Debug mode is broken
      13 | >>> RUN bash -l -c "cd zig-sqlite-demo && zig build"
      14 |     # Release mode works
      15 |     # RUN bash -l -i -c "cd zig-sqlite-demo && zig build --release=safe"
    --------------------
    ERROR: failed to solve: process "/bin/sh -c bash -l -c \"cd zig-sqlite-demo && zig build\"" did not complete successfully: exit code: 1
    
  6. enverbisevac commented on Aug 29, 2025

    @enverbisevac
    Author

    Yes it works for me too with --release=safe

  7. tadejg commented on Aug 30, 2025

    @tadejg

    @vrischmann I also noticed you switched to dynamic linking for 0.15.1. What was the reasoning behind that? I'd prefer to keep it static, if possible.

  8. vrischmann commented on Aug 30, 2025

    @vrischmann
    Owner

    So, there was no reason to change to dynamic linking, that was an oversight when merging a PR.

    But that is not the issue here, executing the zig build-exe command shows zig crashing:

    $ zig build -freference-trace=40 --verbose-cc --verbose-link --verbose
    /home/vincent/.zvm/0.15.1/zig build-lib -freference-trace=40 -cflags -std=c99 -- /home/vincent/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/sqlite3.c -cflags -std=c99 -- /home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/c/workaround.c -ODebug -I /home/vincent/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I /home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/c -Mroot -lc --verbose-link --verbose-cc --cache-dir .zig-cache --global-cache-dir /home/vincent/.cache/zig --name sqlite -static --zig-lib-dir /home/vincent/.zvm/0.15.1/lib/ --listen=-
    /home/vincent/.zvm/0.15.1/zig build-exe -freference-trace=40 -ODebug --dep sqlite -Mroot=/home/vincent/dev/perso/projects/zig-sqlite-demo/src/main.zig .zig-cache/o/8759b2f1d78ad869704a6ba1507547f4/libsqlite.a -I /home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/c -I /home/vincent/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I .zig-cache/o/60d458a4c931254c1a0aeafdc99fc02c -Msqlite=/home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/sqlite.zig -lc --verbose-link --verbose-cc --cache-dir .zig-cache --global-cache-dir /home/vincent/.cache/zig --name zig-sqlite-demo --zig-lib-dir /home/vincent/.zvm/0.15.1/lib/ --listen=-
    install
    └─ install zig-sqlite-demo
       └─ compile exe zig-sqlite-demo Debug native failure
    error: the following command terminated unexpectedly:
    /home/vincent/.zvm/0.15.1/zig build-exe -freference-trace=40 -ODebug --dep sqlite -Mroot=/home/vincent/dev/perso/projects/zig-sqlite-demo/src/main.zig .zig-cache/o/8759b2f1d78ad869704a6ba1507547f4/libsqlite.a -I /home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/c -I /home/vincent/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I .zig-cache/o/60d458a4c931254c1a0aeafdc99fc02c -Msqlite=/home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/sqlite.zig -lc --verbose-link --verbose-cc --cache-dir .zig-cache --global-cache-dir /home/vincent/.cache/zig --name zig-sqlite-demo --zig-lib-dir /home/vincent/.zvm/0.15.1/lib/ --listen=-
    
    Build Summary: 2/5 steps succeeded; 1 failed
    install transitive failure
    └─ install zig-sqlite-demo transitive failure
       └─ compile exe zig-sqlite-demo Debug native failure
    
    error: the following build command failed with exit code 1:
    .zig-cache/o/e1e22d0ed70e7d474c0c19117905118c/build /home/vincent/.zvm/0.15.1/zig /home/vincent/.zvm/0.15.1/lib /home/vincent/dev/perso/projects/zig-sqlite-demo .zig-cache /home/vincent/.cache/zig --seed 0x7c0a1d22 -Z33d17853ac97c538 -freference-trace=40 --verbose-cc --verbose-link --verbose
    
    $ /home/vincent/.zvm/0.15.1/zig build-exe -freference-trace=40 -ODebug --dep sqlite -Mroot=/home/vincent/dev/perso/projects/zig-sqlite-demo/src/main.zig .zig-cache/o/8759b2f1d78ad869704a6ba1507547f4/libsqlite.a -I /home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/c -I /home/vincent/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I .zig-cache/o/60d458a4c931254c1a0aeafdc99fc02c -Msqlite=/home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/sqlite.zig -lc --verbose-link --verbose-cc --cache-dir .zig-cache --global-cache-dir /home/vincent/.cache/zig --name zig-sqlite-demo --zig-lib-dir /home/vincent/.zvm/0.15.1/lib/
    fish: Job 1, '/home/vincent/.zvm/0.15.1/zig b…' terminated by signal SIGSEGV (Address boundary error)
    

    Seems to only affect Linux, on macOS it builds fine.

  9. tadejg commented on Aug 30, 2025

    @tadejg

    Maybe related to ziglang/zig#25060

    Adding .use_llvm = true to the demo build.zig seems to work

        ...
        const exe = b.addExecutable(.{
            .name = "zig-sqlite-demo",
            .root_module = exe_mod,
            .use_llvm = true,
        });
        ...
  10. vrischmann commented on Aug 30, 2025

    @vrischmann
    Owner

    I rebuilt zig myself because the version installed with zvm does not have debug symbols, now I see this:

    $ ~/tools/zig/build/stage3/bin/zig build run
    run
    └─ run exe zig-sqlite-demo
       └─ install
          └─ install zig-sqlite-demo
             └─ compile exe zig-sqlite-demo Debug native failure
    error: thread 93560 panic: reached unreachable code
    /home/vincent/tools/zig/src/link/Dwarf.zig:4175:35: 0x4a60058 in updateLazyValue (main.zig)
                            .field => unreachable,
                                      ^
    /home/vincent/tools/zig/src/link/Dwarf.zig:2310:46: 0x3e0e579 in updateLazy (main.zig)
                try wip_nav.dwarf.updateLazyValue(wip_nav.pt, src_loc, pending_val, &wip_nav.pending_lazy)
                                                 ^
    /home/vincent/tools/zig/src/link/Dwarf.zig:3477:27: 0x3d0efa2 in updateComptimeNavInner (main.zig)
        try wip_nav.updateLazy(nav_src_loc);
                              ^
    /home/vincent/tools/zig/src/link/Dwarf.zig:3021:34: 0x3d12d25 in updateComptimeNav (main.zig)
        return updateComptimeNavInner(dwarf, pt, nav_index) catch |err| switch (err) {
                                     ^
    /home/vincent/tools/zig/src/link/Elf/ZigObject.zig:1596:64: 0x3122960 in updateNav (main.zig)
        } else if (self.dwarf) |*dwarf| try dwarf.updateComptimeNav(pt, nav_index);
                                                                   ^
    /home/vincent/tools/zig/src/link/Elf.zig:1701:43: 0x29ca96f in updateNav (main.zig)
        return self.zigObjectPtr().?.updateNav(self, pt, nav);
                                              ^
    /home/vincent/tools/zig/src/link.zig:725:81: 0x23547bc in updateNav (main.zig)
                    return @as(*tag.Type(), @fieldParentPtr("base", base)).updateNav(pt, nav_index);
                                                                                    ^
    /home/vincent/tools/zig/src/link.zig:1464:29: 0x2924df3 in doZcuTask (main.zig)
                    lf.updateNav(pt, nav_index) catch |err| switch (err) {
                                ^
    /home/vincent/tools/zig/src/link/Queue.zig:287:23: 0x28ec52f in flushTaskQueue (main.zig)
            link.doZcuTask(comp, tid, task);
                          ^
    /home/vincent/tools/zig/lib/std/Thread/Pool.zig:180:50: 0x28ecde0 in runFn (std.zig)
                @call(.auto, func, .{id.?} ++ closure.arguments);
                                                     ^
    /home/vincent/tools/zig/lib/std/Thread/Pool.zig:293:27: 0x221977d in worker (std.zig)
                runnable.runFn(runnable, id);
                              ^
    /home/vincent/tools/zig/lib/std/Thread.zig:510:13: 0x1fbed20 in callFn__anon_182862 (std.zig)
                @call(.auto, f, args);
                ^
    /home/vincent/tools/zig/lib/std/Thread.zig:782:30: 0x1ded539 in entryFn (std.zig)
                    return callFn(f, args_ptr.*);
                                 ^
    ???:?:?: 0x7f4572ba9f53 in ??? (libc.so.6)
    Unwind information for `libc.so.6:0x7f4572ba9f53` was not available, trace may be incomplete
    
    ???:?:?: 0x7f4572c2d32b in ??? (libc.so.6)
    
    error: the following command terminated unexpectedly:
    /home/vincent/tools/zig/build/stage3/bin/zig build-exe -ODebug --dep sqlite -Mroot=/home/vincent/dev/perso/projects/zig-sqlite-demo/src/main.zig .zig-cache/o/39b8b81b9b7cb6458583ba7f04fbada5/libsqlite.a -I /home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/c -I /home/vincent/.cache/zig/p/N-V-__8AAH-mpwB7g3MnqYU-ooUBF1t99RP27dZ9addtMVXD/. -I .zig-cache/o/60d458a4c931254c1a0aeafdc99fc02c -Msqlite=/home/vincent/.cache/zig/p/sqlite-3.48.0-F2R_a5yODgDFvwwsytm7ZONcSqYBo3qv1PmXOtw3tqLA/sqlite.zig -lc --cache-dir .zig-cache --global-cache-dir /home/vincent/.cache/zig --name zig-sqlite-demo --zig-lib-dir /home/vincent/tools/zig/build/stage3/lib/zig/ --listen=-
    
    Build Summary: 2/7 steps succeeded; 1 failed
    run transitive failure
    └─ run exe zig-sqlite-demo transitive failure
       ├─ compile exe zig-sqlite-demo Debug native failure
       └─ install transitive failure
          └─ install zig-sqlite-demo transitive failure
             └─ compile exe zig-sqlite-demo Debug native (+3 more reused dependencies)
    
    error: the following build command failed with exit code 1:
    .zig-cache/o/11a8bcae84a38a60a17b37abb8c974aa/build /home/vincent/tools/zig/build/stage3/bin/zig /home/vincent/tools/zig/build/stage3/lib/zig /home/vincent/dev/perso/projects/zig-sqlite-demo .zig-cache /home/vincent/.cache/zig --seed 0xaaf471b5 -Z1d7225647fd66201 run
    

    Looks like a bug in the compiler which I can't do much about unfortunately.

  11. vrischmann commented on Aug 30, 2025

    @vrischmann
    Owner

    Maybe related to ziglang/zig#25060

    Adding .use_llvm = true to the demo build.zig seems to work

    ...
    const exe = b.addExecutable(.{
        .name = "zig-sqlite-demo",
        .root_module = exe_mod,
        .use_llvm = true,
    });
    ...
    

    Nice find, the stack trace looks the same.

  12. enverbisevac commented on Aug 30, 2025

    @enverbisevac
    Author

    Thanks @tadejg, @vrischmann , works with .use_llvm = true

  13. Koeng101 commented on Sep 27, 2025

    @Koeng101

    Looks like a bug in the compiler which I can't do much about unfortunately.

    Have you reported it to zig? I ran into this error as well, so hopefully reporting could get a fix in the queue.

  14. chung-leong commented on Nov 11, 2025

    @chung-leong

    I see that the linking has been switched back to static on master. Please make the same change in the 0.15.1 branch.

  15. pollend commented on Dec 26, 2025

    @pollend

    I think this is related to comptime. I narrowed it down to db.prepare but im guessing its any type of method processing the sql statement.

  16. smlavine commented on Jan 7, 2026

    @smlavine

    I investigated this a bit after running into this issue with a program of mine.

    I can reproduce unexpected compiler crash with x86_64 Debug backend, but not with llvm backend.

    Example code:

    const std = @import("std");
    const sqlite = @import("sqlite");
    
    pub fn main() !void {
        var db = try sqlite.Db.init(.{
            .mode = .{ .File = "testing.db" },
            .open_flags = .{ .write = true, .create = true },
        });
        defer db.deinit();
        db.exec(
            "CREATE TABLE IF NOT EXISTS page_cache(URL TEXT, response TEXT)",
            .{},
            .{},
        ) catch unreachable;
    }
    

    I comment-traced the Db.exec to Statement.bind, and I think the problem (or at least a problem) is that with the above example, query doesn't have expected fields:

            /// bind binds values to every bind marker in the prepared statement.
            ///
            /// The `values` variable must be a struct where each field has the type of the corresponding bind marker.
            /// For example this query:
            ///   SELECT 1 FROM user WHERE name = ?{text} AND age < ?{u32}
            ///
            /// Has two bind markers, so `values` must have at least the following fields:
            ///   struct {
            ///     name: Text,
            ///     age: u32
            ///   }
            ///
            /// The types are checked at comptime.
            fn bind(self: *Self, options: anytype, values: anytype) !void {
                // smlavine
                _ = &self;
                _ = &options;
                _ = &values;
    
                const StructType = @TypeOf(values);
                if (!comptime isStruct(StructType)) {
                    @compileError("options passed to Statement.bind must be a struct (DynamicStatement supports runtime slices)");
                }
    
                const StructTypeInfo = @typeInfo(StructType).@"struct";
                _ = &StructTypeInfo;
    
                comptime marker_len_check: {
                    // problem is with `query.bind_markers.len` expression
                    @compileLog(@hasField(query, "bind_markers"));
                    break :marker_len_check;
                    //if (query.bind_markers.len != StructTypeInfo.fields.len) {
                    //    break :marker_len_check;
                    //    //if (query.bind_markers.len > StructTypeInfo.fields.len) {
                    //    //    var found_markers = 0;
                    //    //    for (query.bind_markers) |bind_marker| {
                    //    //        if (bind_marker.name) |name| {
                    //    //            if (@hasField(StructType, name)) {
                    //    //                found_markers += 1;
                    //    //            }
                    //    //        }
                    //    //    }
                    //    //    if (found_markers == query.bind_markers.len) {
                    //    //        break :marker_len_check;
                    //    //    }
                    //    //}
                    //    //@compileError(std.fmt.comptimePrint("expected {d} bind parameters but got {d}", .{
                    //    //    query.bind_markers.len,
                    //    //    StructTypeInfo.fields.len,
                    //    //}));
                    //}
                }
    
                //inline for (StructTypeInfo.fields, 0..) |struct_field, _i| {
                //    const bind_marker = query.bind_markers[_i];
                //    if (bind_marker.typed) |typ| {
                //        const FieldTypeInfo = @typeInfo(struct_field.type);
                //        switch (FieldTypeInfo) {
                //            .@"struct", .@"enum", .@"union" => comptime assertMarkerType(
                //                if (@hasDecl(struct_field.type, "BaseType")) struct_field.type.BaseType else struct_field.type,
                //                typ,
                //            ),
                //            else => comptime assertMarkerType(struct_field.type, typ),
                //        }
                //    }
                //}
    
                //return self.dynamic().bind(options, values) catch |e| switch (e) {
                //    errors.Error.SQLiteNotFound => unreachable, // impossible to have non-existent field
                //    else => e,
                //};
            }
    

    Gives compiler output

    Compile Log Output:
    @as(bool, false)
    

    The above compile log output does not change with .use_llvm = true, but the compiler does not crash or error out.

  17. jozip commented on Jan 7, 2026

    @jozip
    Contributor

    This is fixed in https://codeberg.org/ziglang/zig/pulls/30667 and will be available in a master build soonish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions