example failed to run on zig 0.11.0-dev.1384+fe6dcdba1
glyh opened this issue · 2 comments
glyh commented
After fixing all FileSource from .path
to .source
, I still can't compile this package.
I keep having this error:
examples/text_extents.zig:34:29: error: root struct of file 'cairo' has no member named 'Surface'
var surface = try cairo.Surface.image(width, height);
^~~~~~~
referenced by:
comptime_0: /usr/lib/zig/lib/std/start.zig:59:50
remaining reference traces hidden; use '-freference-trace' to see all reference traces
error: text_extents...
error: The following command exited with error code 1:
/usr/lib/zig/zig build-exe /home/lyh/Documents/CS/Projects/graphics/hello-cairo/deps/zig-cairo/examples/text_extents.zig -lc -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/pixman-1 -lcairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/pixman-1 -lpangocairo-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lharfbuzz -lcairo --cache-dir /home/lyh/Documents/CS/Projects/graphics/hello-cairo/deps/zig-cairo/zig-cache --global-cache-dir /home/lyh/.cache/zig --name text_extents --pkg-begin cairo /home/lyh/Documents/CS/Projects/graphics/hello-cairo/deps/zig-cairo/src/cairo.zig --pkg-end --enable-cache
error: the following build command failed with exit code 1:
/home/lyh/Documents/CS/Projects/graphics/hello-cairo/deps/zig-cairo/zig-cache/o/76add10f8da7d3a1d307aa13c08d0d49/build /usr/lib/zig/zig /home/lyh/Documents/CS/Projects/graphics/hello-cairo/deps/zig-cairo /home/lyh/Documents/CS/Projects/graphics/hello-cairo/deps/zig-cairo/zig-cache /home/lyh/.cache/zig text_extents
telamon commented
I got all tests passed on zig version 0.11.0-dev.939+5bde627f9
after i changed:
usingnamespace @import("surfaces/surface.zig");
to
pub usingnamespace @import("surfaces/surface.zig");
edit: seems like all usingnamespace exports in cairo.zig
could use the pub
keyword.
I don't know if pango was left out intentionally but i've also appended:
pub const Pango = struct {
pub usingnamespace @import("pangocairo.zig");
};
to the same file.
telamon commented
I'm a zig-newb, very dislike LSP, but it's a tiny bit nice when new/typed-language.
I've noticed that zls
shows no suggestions when:
pub usingnamespace @import("surfaces/surface.zig");
versus
pub const Surface = @import("surfaces/surface.zig").Surface;
Can somebody explain to me what's going on here?
I see both patterns in zig std
; what's the best approach for a zig-library?
Edit: NVM, i accidentally jumped to conclusions. both patterns same result. no err.