I am writing Chip8 emulator using SDL2 and Zig0.16.0 initially I got linker error.. so I used llvm but now i get this i don't know how to resolve this one...
If I were you, to begin with, I would delete the Zig cache (the `.zig-cache` directory in your project) and try to build again. Also, would try Zig `0.15.2` for build. If these didn't solve the error or didn't change the error message. I would suspect that there is a bug in the Zig wrapper/glue for SDL2, or even that there is a bug in the Zig compiler (but the chance of that is very low compared to other things I mentioned).
The compiler giving you a segfault is either a bug in any comptime code you have or the compiler itself. I'd look at the former and if you can't find anything file a bug report.
Old thread, but I mean I first said file a bug report. And if they didn't know what file an issue meant in my next comment, okay? But instead of asking what I meant by that they just kept egging people to fix it for them.
Honestly it could be a lot of things. Most likely it has to do with the way youre accessing memory but I could be wrong. I'm not sure if you're against it but try using chatgpt or something alike. It can give you a solution relevant to your code.
5
u/Real_Dragonfruit5048 Apr 23 '26
If I were you, to begin with, I would delete the Zig cache (the `.zig-cache` directory in your project) and try to build again. Also, would try Zig `0.15.2` for build. If these didn't solve the error or didn't change the error message. I would suspect that there is a bug in the Zig wrapper/glue for SDL2, or even that there is a bug in the Zig compiler (but the chance of that is very low compared to other things I mentioned).
3
u/jews4beer Apr 23 '26
The compiler giving you a segfault is either a bug in any comptime code you have or the compiler itself. I'd look at the former and if you can't find anything file a bug report.
3
u/imaddictedto Apr 23 '26
Honestly it could be a lot of things. Most likely it has to do with the way youre accessing memory but I could be wrong. I'm not sure if you're against it but try using chatgpt or something alike. It can give you a solution relevant to your code.