I'm trying to do a opengl triangle with the main logic written in zig, but glad and glfw in C.
The build runs without any errors when I don't have any errors in the shader code.
I have something like this for dealing with shader compile errors:
var success: c_int = undefined;
const infoLog: *[LOG_SIZE]c.GLchar = undefined;
c.glGetShaderiv(vertexShader, c.GL_COMPILE_STATUS, &success);
if (success == 0) {
c.glGetShaderInfoLog(vertexShader, LOG_SIZE, null, infoLog);
std.debug.print("ERROR::SHADER::VERTEX::COMPILATION_FAILED\n {s}", .{infoLog});
}
When I intentionally write wrong shader source, I get this:
❯ ./zig-out/bin/zig_build
Segmentation fault at address 0x0
???:?:?: 0x728f41b8284b in ??? (libgallium-24.2.4-arch1.1.so)
Unwind information for `libgallium-24.2.4-arch1.1.so:0x728f41b8284b` was not available, trace may be incomplete
/home/sableye/media/.gittens/learnopengl_zig/.zig-cache/o/f7c7beb359659c376f1407610d06e81b/cimport.zig:6629:37: 0x103f57f in main (zig_build)
return glad_glGetShaderInfoLog.?(arg_1171, arg_1172, arg_1173, arg_1174);
^
/usr/lib/zig/std/start.zig:524:37: 0x1040d5e in main (zig_build)
const result = root.main() catch |err| {
^
???:?:?: 0x728f69b60e07 in ??? (libc.so.6)
???:?:?: 0x728f69b60ecb in ??? (libc.so.6)
???:?:?: 0x1037ac4 in ??? (???)
zsh: IOT instruction (core dumped) ./zig-out/bin/zig_build
I have seen a post mention something about linking libunwind for GNU build target when building from windows. I have tried exe.linkSystemLibrary() with both libunwind and unwind (I'm building on linux for Debug native) but it did not change anything (no build errors too).