[ 
https://issues.apache.org/jira/browse/THRIFT-5666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Christopher Friedt updated THRIFT-5666:
---------------------------------------
    Summary: lib: cpp: build fails when   (was: lib: cpp: prefer poll.h over 
sys/poll.h)

> lib: cpp: build fails when 
> ---------------------------
>
>                 Key: THRIFT-5666
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5666
>             Project: Thrift
>          Issue Type: Bug
>          Components: C++ - Library
>            Reporter: Christopher Friedt
>            Assignee: Christopher Friedt
>            Priority: Trivial
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Multiple errors of this form when *HAVE_POLL_H* is defined but 
> *HAVE_SYS_POLL_H* is not defined.
>  
> {code:java}
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:
>  In member function 'virtual 
> std::shared_ptr<apache::thrift::transport::TTransport> 
> apache::thrift::transport::TServerSocket::acceptImpl()':
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:597:24:
>  error: elements of array 
> 'apache::thrift::transport::TServerSocket::acceptImpl()::pollfd fds [2]' have 
> incomplete type
>   597 |   struct THRIFT_POLLFD fds[2];
>       |                        ^~~
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:597:24:
>  error: storage size of 'fds' isn't known
> In file included from 
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:50:
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/PlatformSocket.h:123:26:
>  error: 'POLLIN' was not declared in this scope
>   123 | #  define THRIFT_POLLIN  POLLIN
>       |                          ^~~~~~
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:605:21:
>  note: in expansion of macro 'THRIFT_POLLIN'
>   605 |     fds[0].events = THRIFT_POLLIN;
>       |                     ^~~~~~~~~~~~~
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/PlatformSocket.h:121:23:
>  error: 'poll' was not declared in this scope; did you mean 'k_poll'?
>   121 | #  define THRIFT_POLL poll
>       |                       ^~~~
> /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:614:15:
>  note: in expansion of macro 'THRIFT_POLL'
>   614 |     int ret = THRIFT_POLL(fds, 2, accTimeout_);
>       |               ^~~~~~~~~~~{code}
> Looks as though it affects the following files, and the problem is obvious 
> (they don't include the correct header {*}<poll.h>{*}).
>  * lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
>  * lib/cpp/src/thrift/transport/TSSLSocket.cpp
>  * lib/cpp/src/thrift/transport/TServerSocket.cpp
>  * lib/cpp/src/thrift/transport/TSocket.cpp
> The *sys/poll.h* header is not actually where *poll(2)* must be defined 
> according to [the POSIX 
> spec|[https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/poll.h.html]],
>  but the sources above seem to assume that.
> However, we shouldn't simply erase use of *sys/poll.h* everywhere. There may 
> be the case where some non-POSIX compliant platform uses that instead of 
> {*}<poll.h>{*}.
> PR is here
> [https://github.com/apache/thrift/pull/2723]
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to