With the help of user @Wunka I recently added support for capturing SIGWINCH resize signals while waiting on an input event for my TUI lib dabeob. The solution uses std.posix.ppoll to wait for an input event OR a SIGWINCH signal. (executed fn)
Generally, that works very good when compiling for my own machine (Void Linux x86_64 glibc) or for other Linux archs (I testes aarch64 with glibc and musl libc).
However, now I tried cross-compiling for aarch64-macos-none and x86_64-macos-none, but both failed with error undefined symbol: _ppoll.
Extended error message
$ zig build -Dtarget=x86_64-macos-none
install
└─ install example-my-tui
└─ compile exe example-my-tui debug x86_64-macos-none 1 errors
error: undefined symbol: _ppoll
note: referenced by /home/lukeflo/Documents/coding/zig/dabeob/.zig-cache/o/997f1c3beafeaf4abee51469f3262c56/example-my-tui_zcu.o:_posix.ppoll
error: 1 compilation errors
failed command: /home/lukeflo/.cache/zxc/versions/0.17.1/zig build-exe -Odebug -target x86_64-macos-none -mcpu baseline --dep dabeob -Mroot=examples/my_tui.zig -target x86_64-macos-none -mcpu baseline -Mdabeob=src/root.zig --cache-dir .zig-cache --global-cache-dir /home/lukeflo/.cache/zig --build-root . --name example-my-tui --zig-lib-dir /home/lukeflo/.cache/zxc/versions/0.17.1/lib/ --listen=-
Build Summary: 0/3 steps succeeded (1 failed)
install transitive failure
└─ install example-my-tui transitive failure
└─ compile exe example-my-tui debug x86_64-macos-none 1 errors
That was surprising, because before I added the usage of ppoll, the lib used plain std.posix.poll() for polling only input events. With the plain poll() function cross-compiling for the named targets was no problem. (example code with old setup)
Since I neither have access to a real Mac for testing, nor am I an expert for the backend stuff going on regarding “C stuff” (std.posix.(p)poll are resolved to std.c.(p)poll for macos) when cross-compiling for a different target, I would be very thankful for some insights or tipps. Could it be a flaw in my code or maybe the respective std-lib namespace?