Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Compilation fails on AIX with 7.55.1 #1828
I did this
I attempted to build curl 7.55.1 on AIX 7.1 using GCC 5.2.0.
I expected the following
I expected it to succeed, as we had previously built 7.51.0 successfully.
7.55.1 (doesn't build, so no curl -V output)
Compilation fails on multi.c. The root of it is that on AIX, when _ALL_SOURCE is set to 1 (as CURL does), sys/poll.h uses #define for event and revent. Because multi.c includes sys/poll.h but multi.h doesn't, we end up with a mismatch between names for the
Previously this appears to have built with curl 7.51.0 because multi.h also included sys/poll.h, so they were equally wrong. Based on https://curl.haxx.se/mail/lib-2013-02/0330.html, this appears to have been an issue off-and-on for years.
My workaround has been to undef _ALL_SOURCE before including select.h in multi.c, and redefine it after. This probably isn't a good general solution.
How about making sure sys/poll.h is included before multi.h is included like this patch? (
diff --git a/lib/curl_setup.h b/lib/curl_setup.h index 36d1e42bc..6ed230ac2 100644 --- a/lib/curl_setup.h +++ b/lib/curl_setup.h @@ -326,10 +326,14 @@ #ifndef STDC_HEADERS /* no standard C headers! */ #include <curl/stdcheaders.h> #endif +#ifdef _AIX +#include <sys/poll.h> +#endif + #ifdef __POCC__ # include <sys/types.h> # include <unistd.h> # define sys_nerr EILSEQ #endif
Exactly how would that mess anything up for anyone?
I would agree that it doesn't really help applications that want to use
A better fix that also works for other applications could be to make sure
diff --git a/include/curl/system.h b/include/curl/system.h index a6640ba52..39dae754c 100644 --- a/include/curl/system.h +++ b/include/curl/system.h @@ -375,10 +375,16 @@ # define CURL_SUFFIX_CURL_OFF_T L # define CURL_SUFFIX_CURL_OFF_TU UL # define CURL_TYPEOF_CURL_SOCKLEN_T int #endif +#ifdef _AIX +/* AIX needs <sys/poll.h> */ +#define CURL_PULL_SYS_POLL_H +#endif + + /* CURL_PULL_WS2TCPIP_H is defined above when inclusion of header file */ /* ws2tcpip.h is required here to properly make type definitions below. */ #ifdef CURL_PULL_WS2TCPIP_H # include <winsock2.h> # include <windows.h> @@ -395,10 +401,16 @@ /* sys/socket.h is required here to properly make type definitions below. */ #ifdef CURL_PULL_SYS_SOCKET_H # include <sys/socket.h> #endif +/* CURL_PULL_SYS_POLL_H is defined above when inclusion of header file */ +/* sys/poll.h is required here to properly make type definitions below. */ +#ifdef CURL_PULL_SYS_POLL_H +# include <sys/poll.h> +#endif + /* Data type definition of curl_socklen_t. */ #ifdef CURL_TYPEOF_CURL_SOCKLEN_T typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t; #endif