# Cross-compile for macos fails with "undefined symbol \_ppoll" (works with posix.poll)

**URL:** <https://ziggit.dev/t/cross-compile-for-macos-fails-with-undefined-symbol-ppoll-works-with-posix-poll/18230>\
**Category:** Help\
**Tags:** language, build-system, standard-library, cross-compile\
**Created:** [November 5, 2026, 6:20pm UTC](https://ziggit.dev/t/cross-compile-for-macos-fails-with-undefined-symbol-ppoll-works-with-posix-poll/18230 "2026-11-05T18:20:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukeflo](https://ziggit.dev/user_avatar/ziggit.dev/lukeflo/32/7514_2.png) [@lukeflo](https://ziggit.dev/u/lukeflo)\
**Post date:** [November 5, 2026, 6:20pm UTC](https://ziggit.dev/t/cross-compile-for-macos-fails-with-undefined-symbol-ppoll-works-with-posix-poll/18230/1 "2026-11-05T18:20:48Z")

</div>

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`](https://codeberg.org/lukeflo/dabeob). The solution uses [`std.posix.ppoll`](https://ziglang.org/documentation/0.17.0/std/#std.posix.ppoll) to wait for an input event OR a SIGWINCH signal. ([executed fn](https://codeberg.org/lukeflo/dabeob/src/commit/24b960073081394f3089d9970d594a5635a760e4/src/event.zig#L328-L337))

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
> $ 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](https://codeberg.org/lukeflo/dabeob/src/commit/ae244f2508574762e6a4dfbee3512e5f2a88379e/src/event.zig#L296-L303) 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?

---

<div class="post-metadata">

**Author:** ![Wunka](https://ziggit.dev/user_avatar/ziggit.dev/wunka/32/7510_2.png) [@Wunka](https://ziggit.dev/u/Wunka)\
**Post date:** [November 5, 2026, 6:49pm UTC](https://ziggit.dev/t/cross-compile-for-macos-fails-with-undefined-symbol-ppoll-works-with-posix-poll/18230/2 "2026-11-05T18:49:34Z")

</div>

Just to make something clear, which I noticed after my code got merged. I first misunderstood what ppoll did exactly / how it did what it did. (I am not experienced with all this stuff, this was my first real thing coding with these interrupt systems). While `ppoll` does solve that exact problem and with it we don’t miss any `SIGWINCH`. Normally we could still use `poll`, but there a thing which also kinda confused me on the way:  
`std.posix.poll` does this regarding interrupts:

```zig
pub fn poll(fds: []pollfd, timeout: i32) PollError!usize {
    ...
    while (true) {
        const rc = system.poll(fds.ptr, fds_count, timeout);
        switch (errno(rc)) {
            ...
            .INTR => continue,
            ...
        }
    }
    ...

```

Which `std.posix.ppoll` doesn’t:

```zig
pub fn ppoll(fds: []pollfd, timeout: ?*const timespec, mask: ?*const sigset_t) PPollError!usize {
    ...
    const rc = system.ppoll(fds.ptr, fds_count, ts_ptr, mask);
    switch (errno(rc)) {
        ...
        .INTR => return error.SignalInterrupt,
        ...
    }
    ...

```

Else `std.posix.poll` would have just “worked”, but would let a small window open where we can be interrupted, but maybe just don’t notice it.  
So maybe `std.posix.system.poll` would “work” even if it lets a tiny window open. (all of this from my understanding, with not a lot of experience)

Also sorry that I didn’t mention this all earlier.

---

<div class="post-metadata">

**Author:** ![lukeflo](https://ziggit.dev/user_avatar/ziggit.dev/lukeflo/32/7514_2.png) [@lukeflo](https://ziggit.dev/u/lukeflo)\
**Post date:** [November 5, 2026, 7:49pm UTC](https://ziggit.dev/t/cross-compile-for-macos-fails-with-undefined-symbol-ppoll-works-with-posix-poll/18230/3 "2026-11-05T19:49:33Z")

</div>

OK, that’s interesting and definitely worth a look for solving this exact problem in this particular case.

> [@Wunka](#):
>
> Also sorry that I didn’t mention this all earlier.

No need to excuse, I’m also not too familiar with all that stuff 😉

However, to my understanding it doesn’t explain why cross compiling with `poll()` works while it fails with `ppoll()`. A solution for the latter case might also help others who potentially run into the same error.

---

<div class="post-metadata">

**Author:** ![Wunka](https://ziggit.dev/user_avatar/ziggit.dev/wunka/32/7510_2.png) [@Wunka](https://ziggit.dev/u/Wunka)\
**Post date:** [November 5, 2026, 8:02pm UTC](https://ziggit.dev/t/cross-compile-for-macos-fails-with-undefined-symbol-ppoll-works-with-posix-poll/18230/4 "2026-11-05T20:02:07Z")

</div>

I just found this issue: [`ppoll` is not available on macOS but is declared in `std.c` · Issue #18693 · ziglang/zig · GitHub](https://github.com/ziglang/zig/issues/18693)

Seems like ppoll just maybe doesn’t exist on macos ☹

---

<div class="post-metadata">

**Author:** ![lukeflo](https://ziggit.dev/user_avatar/ziggit.dev/lukeflo/32/7514_2.png) [@lukeflo](https://ziggit.dev/u/lukeflo)\
**Post date:** [November 5, 2026, 8:07pm UTC](https://ziggit.dev/t/cross-compile-for-macos-fails-with-undefined-symbol-ppoll-works-with-posix-poll/18230/5 "2026-11-05T20:07:32Z")

</div>

Oh 😮. That’s weird
