commit:     18e535510c92807c48cf04d8a2a0475fa1ed5e36
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  1 16:05:09 2022 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Mon Aug  1 16:05:09 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=18e53551

app-emulation/open-vm-tools: fix build error on musl

Closes: https://bugs.gentoo.org/862795
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 .../files/open-vm-tools-rename-poll.h.patch        | 126 +++++++++++++++++++++
 .../open-vm-tools-12.0.5_p19716617.ebuild          |   1 +
 2 files changed, 127 insertions(+)

diff --git 
a/app-emulation/open-vm-tools/files/open-vm-tools-rename-poll.h.patch 
b/app-emulation/open-vm-tools/files/open-vm-tools-rename-poll.h.patch
new file mode 100644
index 000000000000..c4e4518dbb28
--- /dev/null
+++ b/app-emulation/open-vm-tools/files/open-vm-tools-rename-poll.h.patch
@@ -0,0 +1,126 @@
+https://github.com/vmware/open-vm-tools/pull/383
+
+From 821c7949d79ad8e06b20cb1238316fce56778607 Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabr...@gmail.com>
+Date: Thu, 31 Oct 2019 17:06:10 +0100
+Subject: [PATCH] Rename poll.h into vm_poll.h to fix build failure on musl
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+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
+https://github.com/vmware/open-vm-tools/issues/359#issuecomment-533529956
+
+Fixes:
+ - 
http://autobuild.buildroot.org/results/4f575ef42bbc4387a07e396205052b2da081c64d
+
+Fix #359
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabr...@gmail.com>
+---
+ open-vm-tools/lib/asyncsocket/asyncsocket.c     | 4 ++--
+ open-vm-tools/lib/hgfsServer/hgfsServer.c       | 2 +-
+ open-vm-tools/lib/include/asyncsocket.h         | 2 +-
+ open-vm-tools/lib/include/pollImpl.h            | 2 +-
+ open-vm-tools/lib/include/{poll.h => vm_poll.h} | 0
+ open-vm-tools/lib/rpcIn/rpcin.c                 | 2 +-
+ 6 files changed, 6 insertions(+), 6 deletions(-)
+ rename open-vm-tools/lib/include/{poll.h => vm_poll.h} (100%)
+
+diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c 
b/open-vm-tools/lib/asyncsocket/asyncsocket.c
+index 102638cc9..01181a957 100644
+--- a/open-vm-tools/lib/asyncsocket/asyncsocket.c
++++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c
+@@ -69,8 +69,8 @@
+ #else
+ #include <stddef.h>
+ #include <ctype.h>
++#include <poll.h>
+ #include <sys/types.h>
+-#include <sys/poll.h>
+ #include <sys/socket.h>
+ #include <sys/un.h>
+ #include <netdb.h>
+@@ -86,7 +86,7 @@
+ #include "random.h"
+ #include "asyncsocket.h"
+ #include "asyncSocketBase.h"
+-#include "poll.h"
++#include "vm_poll.h"
+ #include "log.h"
+ #include "err.h"
+ #include "hostinfo.h"
+diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c 
b/open-vm-tools/lib/hgfsServer/hgfsServer.c
+index 462245511..fc6912860 100644
+--- a/open-vm-tools/lib/hgfsServer/hgfsServer.c
++++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c
+@@ -48,7 +48,7 @@
+ #include "hgfsServerOplock.h"
+ #include "hgfsDirNotify.h"
+ #include "userlock.h"
+-#include "poll.h"
++#include "vm_poll.h"
+ #include "mutexRankLib.h"
+ #include "vm_basic_asm.h"
+ #include "unicodeOperations.h"
+diff --git a/open-vm-tools/lib/include/asyncsocket.h 
b/open-vm-tools/lib/include/asyncsocket.h
+index 95a5e4643..a4b4e5aae 100644
+--- a/open-vm-tools/lib/include/asyncsocket.h
++++ b/open-vm-tools/lib/include/asyncsocket.h
+@@ -164,7 +164,7 @@ typedef struct AsyncSocket AsyncSocket;
+  * Or the client can specify its favorite poll class and locking behavior.
+  * Use of IVmdbPoll is only supported for regular sockets and for Attach.
+  */
+-#include "poll.h"
++#include "vm_poll.h"
+ struct IVmdbPoll;
+ typedef struct AsyncSocketPollParams {
+    int flags;               /* Default 0, only POLL_FLAG_NO_BULL is valid */
+diff --git a/open-vm-tools/lib/include/pollImpl.h 
b/open-vm-tools/lib/include/pollImpl.h
+index 46442e556..8bc669970 100644
+--- a/open-vm-tools/lib/include/pollImpl.h
++++ b/open-vm-tools/lib/include/pollImpl.h
+@@ -44,7 +44,7 @@
+ #define INCLUDE_ALLOW_USERLEVEL
+ #include "includeCheck.h"
+ 
+-#include "poll.h"
++#include "vm_poll.h"
+ #include "vm_basic_asm.h"
+ 
+ #if defined(__cplusplus)
+diff --git a/open-vm-tools/lib/include/poll.h 
b/open-vm-tools/lib/include/vm_poll.h
+similarity index 100%
+rename from open-vm-tools/lib/include/poll.h
+rename to open-vm-tools/lib/include/vm_poll.h
+diff --git a/open-vm-tools/lib/rpcIn/rpcin.c b/open-vm-tools/lib/rpcIn/rpcin.c
+index 47a3380e4..660382c62 100644
+--- a/open-vm-tools/lib/rpcIn/rpcin.c
++++ b/open-vm-tools/lib/rpcIn/rpcin.c
+@@ -57,7 +57,7 @@
+ 
+ #if defined(VMTOOLS_USE_VSOCKET)
+ #  include <glib.h>
+-#  include "poll.h"
++#  include "vm_poll.h"
+ #  include "asyncsocket.h"
+ #  include "vmci_defs.h"
+ #include "dataMap.h"

diff --git a/app-emulation/open-vm-tools/open-vm-tools-12.0.5_p19716617.ebuild 
b/app-emulation/open-vm-tools/open-vm-tools-12.0.5_p19716617.ebuild
index 29730afa69b4..9585522ddbde 100644
--- a/app-emulation/open-vm-tools/open-vm-tools-12.0.5_p19716617.ebuild
+++ b/app-emulation/open-vm-tools/open-vm-tools-12.0.5_p19716617.ebuild
@@ -68,6 +68,7 @@ BDEPEND="
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
+       "${FILESDIR}/open-vm-tools-rename-poll.h.patch"
        "${FILESDIR}/10.1.0-Werror.patch"
        "${FILESDIR}/11.3.5-icu.patch"
 )

Reply via email to