Skip to content

Doesn't build with Zig 0.14.0 #16

@dbohdan

Description

@dbohdan

The readme says "Zig 0.13.0 or later", but it looks like Zig 0.14 broke compatibility.

$ ../zig/zig version
0.14.0
$ ../zig/zig build -Doptimize=ReleaseFast 2> log.txt
install
+- install moondream
   +- zig build-exe moondream ReleaseFast native 4 errors
src/core/slab_reusing_allocator.zig:50:97: error: expected type 'mem.Alignment', found 'comptime_int'
                        self.backing_allocator.rawFree(ptr[0..self.sizeFromBucket(bucket_idx)], log2_align, @returnAddress());
                                                                                                ^~~~~~~~~~
/scratch/zig/lib/std/mem.zig:22:23: note: enum declared here
pub const Alignment = enum(math.Log2Int(usize)) {
                      ^~~~
/scratch/zig/lib/std/mem/Allocator.zig:146:62: note: parameter type declared here
pub inline fn rawFree(a: Allocator, memory: []u8, alignment: Alignment, ret_addr: usize) void {
                                                             ^~~~~~~~~
src/core/slab_reusing_allocator.zig:61:22: error: expected type '*const fn (*anyopaque, usize, mem.Alignment, usize) ?[*]u8', found '*const fn (*anyopaque, usize, u8, usize) ?[*]u8'
                    .alloc = alloc,
                    ~^~~~~~~~~~~~~
src/core/slab_reusing_allocator.zig:61:22: note: pointer type child 'fn (*anyopaque, usize, u8, usize) ?[*]u8' cannot cast into pointer type child 'fn (*anyopaque, usize, mem.Alignment, usize) ?[*]u8'
src/core/slab_reusing_allocator.zig:61:22: note: parameter 2 'u8' cannot cast into 'mem.Alignment'
/scratch/zig/lib/std/mem.zig:22:23: note: enum declared here
pub const Alignment = enum(math.Log2Int(usize)) {
                      ^~~~
src/core/slab_reusing_allocator.zig:137:61: error: expected type 'mem.Alignment', found 'u6'
                return self.backing_allocator.rawAlloc(len, log2_ptr_align, ret_addr);
                                                            ^~~~~~~~~~~~~~
/scratch/zig/lib/std/mem.zig:22:23: note: enum declared here
pub const Alignment = enum(math.Log2Int(usize)) {
                      ^~~~
/scratch/zig/lib/std/mem/Allocator.zig:128:61: note: parameter type declared here
pub inline fn rawAlloc(a: Allocator, len: usize, alignment: Alignment, ret_addr: usize) ?[*]u8 {
                                                            ^~~~~~~~~
src/moondream.zig:190:19: error: root source file struct 'std' has no member named 'rand'
    var rng = std.rand.DefaultPrng.init(seed);
                  ^~~~
/scratch/zig/lib/std/std.zig:1:1: note: struct declared here
pub const ArrayHashMap = array_hash_map.ArrayHashMap;
^~~
error: the following command failed with 4 compilation errors:
/scratch/zig/zig build-exe /scratch/moondream-zig/.zig-cache/o/79d3f044cb99ea79a7112e0095133430/libstb_image.a /scratch/moondream-zig/.zig-cache/o/184a3bedcbb3f846d57ab943aa3e8406/libstb_image_resize2.a -OReleaseFast -I src/dependencies -I /scratch/moondream-zig/.zig-cache/o/ee37129807542079360a73b5258f6822 -I /scratch/moondream-zig/.zig-cache/o/ee37129807542079360a73b5258f6822 -Mroot=src/moondream.zig -lc --cache-dir /scratch/moondream-zig/.zig-cache --global-cache-dir /home/dbohdan/.cache/zig --name moondream --zig-lib-dir /scratch/zig/lib/ --listen=- 
install
+- install moonchat
   +- zig build-exe moonchat ReleaseFast native 4 errors
src/core/slab_reusing_allocator.zig:50:97: error: expected type 'mem.Alignment', found 'comptime_int'
                        self.backing_allocator.rawFree(ptr[0..self.sizeFromBucket(bucket_idx)], log2_align, @returnAddress());
                                                                                                ^~~~~~~~~~
/scratch/zig/lib/std/mem.zig:22:23: note: enum declared here
pub const Alignment = enum(math.Log2Int(usize)) {
                      ^~~~
/scratch/zig/lib/std/mem/Allocator.zig:146:62: note: parameter type declared here
pub inline fn rawFree(a: Allocator, memory: []u8, alignment: Alignment, ret_addr: usize) void {
                                                             ^~~~~~~~~
src/core/slab_reusing_allocator.zig:61:22: error: expected type '*const fn (*anyopaque, usize, mem.Alignment, usize) ?[*]u8', found '*const fn (*anyopaque, usize, u8, usize) ?[*]u8'
                    .alloc = alloc,
                    ~^~~~~~~~~~~~~
src/core/slab_reusing_allocator.zig:61:22: note: pointer type child 'fn (*anyopaque, usize, u8, usize) ?[*]u8' cannot cast into pointer type child 'fn (*anyopaque, usize, mem.Alignment, usize) ?[*]u8'
src/core/slab_reusing_allocator.zig:61:22: note: parameter 2 'u8' cannot cast into 'mem.Alignment'
/scratch/zig/lib/std/mem.zig:22:23: note: enum declared here
pub const Alignment = enum(math.Log2Int(usize)) {
                      ^~~~
src/core/slab_reusing_allocator.zig:137:61: error: expected type 'mem.Alignment', found 'u6'
                return self.backing_allocator.rawAlloc(len, log2_ptr_align, ret_addr);
                                                            ^~~~~~~~~~~~~~
/scratch/zig/lib/std/mem.zig:22:23: note: enum declared here
pub const Alignment = enum(math.Log2Int(usize)) {
                      ^~~~
/scratch/zig/lib/std/mem/Allocator.zig:128:61: note: parameter type declared here
pub inline fn rawAlloc(a: Allocator, len: usize, alignment: Alignment, ret_addr: usize) ?[*]u8 {
                                                            ^~~~~~~~~
src/model/weights.zig:88:61: error: no field named 'Struct' in union 'builtin.Type'
            inline for (@typeInfo(@TypeOf(expected_shapes)).Struct.fields) |field| {
                                                            ^~~~~~
/scratch/zig/lib/std/builtin.zig:563:18: note: union declared here
pub const Type = union(enum) {
                 ^~~~~
error: the following command failed with 4 compilation errors:
/scratch/zig/zig build-exe /scratch/moondream-zig/.zig-cache/o/79d3f044cb99ea79a7112e0095133430/libstb_image.a /scratch/moondream-zig/.zig-cache/o/184a3bedcbb3f846d57ab943aa3e8406/libstb_image_resize2.a -OReleaseFast -I src/dependencies -I /scratch/moondream-zig/.zig-cache/o/ee37129807542079360a73b5258f6822 -I /scratch/moondream-zig/.zig-cache/o/ee37129807542079360a73b5258f6822 -Mroot=src/moonchat.zig -lc --cache-dir /scratch/moondream-zig/.zig-cache --global-cache-dir /home/dbohdan/.cache/zig --name moonchat --zig-lib-dir /scratch/zig/lib/ --listen=- 
Build Summary: 6/11 steps succeeded; 2 failed
install transitive failure
+- install moonchat transitive failure
|  +- zig build-exe moonchat ReleaseFast native 4 errors
+- install moondream transitive failure
   +- zig build-exe moondream ReleaseFast native 4 errors
error: the following build command failed with exit code 1:
/scratch/moondream-zig/.zig-cache/o/17d5002b35ea2e498420c269481a088c/build /scratch/zig/zig /scratch/zig/lib /scratch/moondream-zig /scratch/moondream-zig/.zig-cache /home/dbohdan/.cache/zig --seed 0x82be571b -Za8df9c82dfd0cda5 -Doptimize=ReleaseFast

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions