musl libc redirects include of sys/poll.h to poll.h. But since poll.h is also a local header file, the musl libc header is never included. This leads to the following build failure:
In file included from asyncsocket.c:73:0:
.../host/i586-buildroot-linux-musl/sysroot/usr/include/sys/poll.h:1:2: warning: #warning redirecting incorrect #include <sys/poll.h> to <poll.h> [-Wcpp]
#warning redirecting incorrect #include <sys/poll.h> to <poll.h>
asyncsocket.c: In function ‘AsyncTCPSocketPollWork’:
asyncsocket.c:2537:13: error: invalid use of undefined type ‘struct pollfd’
pfd[i].fd = asock[i]->fd;
^
asyncsocket.c:2537:13: error: dereferencing pointer to incomplete type ‘struct pollfd’
asyncsocket.c:2538:13: error: invalid use of undefined type ‘struct pollfd’
pfd[i].events = read ? POLLIN : POLLOUT;
^
asyncsocket.c:2538:33: error: ‘POLLIN’ undeclared (first use in this function); did you mean ‘POLL_IN’?
pfd[i].events = read ? POLLIN : POLLOUT;
^~~~~~
I noticed that Android had a similar issue witch is fixed in local poll.h with the following code:
#ifdef __ANDROID__
/*
* <poll.h> of android should be included, but its name is same
* with this file. So its content is put here to avoid conflict.
*/
#include <asm/poll.h>
#define HZ 100
typedef unsigned int nfds_t;
int poll(struct pollfd *, nfds_t, long);
#endif
This fix doesn't work for musl because the is intentionally no macro that identifies musl libc.
The only reasonable way to fix the issue for both platforms is to rename the local poll.h. But this is a big change I guess.
musl libc redirects include of
sys/poll.h
topoll.h
. But sincepoll.h
is also a local header file, the musl libc header is never included. This leads to the following build failure:I noticed that Android had a similar issue witch is fixed in local
poll.h
with the following code:This fix doesn't work for musl because the is intentionally no macro that identifies musl libc.
The only reasonable way to fix the issue for both platforms is to rename the local
poll.h
. But this is a big change I guess.