Skip to content
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

Build failure with musl libc #359

Open
baruchsiach opened this issue Aug 23, 2019 · 1 comment · May be fixed by #383
Open

Build failure with musl libc #359

baruchsiach opened this issue Aug 23, 2019 · 1 comment · May be fixed by #383

Comments

@baruchsiach
Copy link

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.

@srowe
Copy link

srowe commented Sep 20, 2019

The change isn't too large, I've been using the attached.
001_rename_poll_h.patch.txt

ffontaine added a commit to ffontaine/open-vm-tools that referenced this issue Oct 31, 2019
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;

So rename poll.h into vm_poll.h as suggested by srowe in
vmware#359 (comment)

Fixes:
 - http://autobuild.buildroot.org/results/4f575ef42bbc4387a07e396205052b2da081c64d

Fix vmware#359

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants