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

Rename poll.h into vm_poll.h to fix build failure on musl #383

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ffontaine
Copy link

@ffontaine ffontaine commented 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 #359 (comment)

Fixes:

Fix #359

Signed-off-by: Fabrice Fontaine [email protected]

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 <[email protected]>
@vmwclabot
Copy link
Member

@ffontaine, you must sign our contributor license agreement before your changes are merged. Click here to sign the agreement. If you are a VMware employee, read this for further instruction.

@vmwclabot
Copy link
Member

@ffontaine, VMware has approved your signed contributor license agreement.

@oliverkurth
Copy link
Contributor

Thanks for the patch. I filed an internal bug to discuss this issue. At this point, I am not able to tell if we are going to accept it.

@oliverkurth
Copy link
Contributor

@ffontaine , what is the reason that "sys/poll.h" redirects to "poll.h"? Looks like that is the underlying issue, but there may be a good reason to it.

@ffontaine
Copy link
Author

Yes, indeed, the redirection is the root of the issue but this redirection has been made by design on musl: https://git.musl-libc.org/cgit/musl/commit/include/sys/poll.h?id=54446d730cfb17c5f7bcf57f139458678f5066cc.
The history of that warning/redirection is that at least POSIX.1-2001, POSIX.1-2008 and Single Unix Specification (at http://pubs.opengroup.org/onlinepubs/7908799/xsh/poll.h.html) state that the include directive should be #include <poll.h>.

@ffontaine
Copy link
Author

What is the status of your internal bug? Do you think that this PR could be merged? I have other fixes for musl but I'll send them only if you're interested in allowing open-vm-tools to build on this target.

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 this pull request may close these issues.

Build failure with musl libc
3 participants