-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run on macOS #10
Comments
Update: I changed the code a bit to rely on the var winsz: std.c.winsize = undefined;
const rv = std.c.ioctl(tty, std.c.T.IOCGWINSZ, @intFromPtr(&winsz)); Unfortunately, I get a different runtime error now when rendering the fire animation:
|
Thank you, I am incorporating your patches into the latest zig 13 compatible build!!! I really appreciate your hard work & thorough investigation! |
You are 100% correct - the secret is to use Bug #1 - rv==0 vs rv>=0the ioctl function returns success on Swapping from rv==0 to rv>=0 fixes that behavior. Bug #2 - rv>0 is still a problemHowever, it exposes another problem, where the ioctl invocation worked, but didn't actually retrieve a terminal size...this results in a positive return value, with a 0x0 size terminal window. The terminal size (width and height) is used to allocate various memory buffers, so a zero value will cause the math, somewhere, to under-allocate buffers, including...0 bytes...which, simply will not work. The DOOM-fire rendering pipeline will fail spectacularly somewhere along the line. So I added a check to make that easier to catch for a person running the program to say ... hey, we got here, but it looks like we have a 0x0 window; another future TODO would be to trigger an error if we fail some basic memory sanity checks. Very Close!*You were very very close with your patch...converting to It's a bit counter-intuitive compared to the modern age, where we ask a question and it does it all for us, but that is the nature of these system level calls which are over 40+ years old at this point, and still trucking! Kind of neat. Thank you again for your help! I really appreciate it, very cool that you spent some time researching. |
Zig verison: 0.13.0
macOS version: 14.5 (64-bit)
When trying to run the project I initially got some build errors, so I applied a few patches:
But even after this, when I ran
zig build run
I got an error running the binary:If I run
lldb /Users/rybickic/Developer/DOOM-fire-zig/zig-out/bin/DOOM-fire
and executerun
to step through the debug build, I get an error suggesting the syscall is invalid:The text was updated successfully, but these errors were encountered: