问题遇到的现象和发生背景
安装libevent-2.1.12-stable,make时报错
In file included from sample/dns-example.c:8:
./include/event2/event-config.h:559:15: error: two or more data types in declaration specifiers
559 | #define pid_t int
| ^~~
./include/event2/event-config.h:568:17: error: two or more data types in declaration specifiers
568 | #define ssize_t int
| ^~~
./include/event2/event-config.h:562:16: error: duplicate ‘unsigned’
562 | #define size_t unsigned int
| ^~~~~~~~
./include/event2/event-config.h:562:25: error: two or more data types in declaration specifiers
562 | #define size_t unsigned int
| ^~~
./include/event2/event-config.h:565:19: error: two or more data types in declaration specifiers
565 | #define socklen_t unsigned int
| ^~~~~~~~
./include/event2/event-config.h:565:28: error: two or more data types in declaration specifiers
565 | #define socklen_t unsigned int
| ^~~
In file included from sample/../ipv6-internal.h:40,
from sample/dns-example.c:11:
./include/event2/util.h:129:2: error: #error "No way to define ev_uint64_t"
129 | #error "No way to define ev_uint64_t"
| ^~~~~
./include/event2/util.h:148:2: error: #error "No way to define ev_uint32_t"
148 | #error "No way to define ev_uint32_t"
| ^~~~~
./include/event2/util.h:167:2: error: #error "No way to define ev_uint16_t"
167 | #error "No way to define ev_uint16_t"
| ^~~~~
./include/event2/util.h:283:2: error: #error "No way to define SIZE_MAX"
283 | #error "No way to define SIZE_MAX"
| ^~~~~
./include/event2/util.h:582:1: error: unknown type name ‘ev_int64_t’; did you mean ‘u_int64_t’?
582 | ev_int64_t evutil_strtoll(const char *s, char **endptr, int base);
| ^~~~~~~~~~
| u_int64_t
In file included from sample/dns-example.c:11:
sample/../ipv6-internal.h:53:8: error: redefinition of ‘struct in6_addr’
53 | struct in6_addr {
| ^~~~~~~~
In file included from /usr/include/netdb.h:27,
from ./include/event2/util.h:61,
from sample/../ipv6-internal.h:40,
from sample/dns-example.c:11:
/usr/include/netinet/in.h:212:8: note: originally defined here
212 | struct in6_addr
| ^~~~~~~~
sample/../ipv6-internal.h:54:13: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘.’ token
54 | ev_uint8_t s6_addr[16];
| ^~~~~~~
In file included from sample/dns-example.c:11:
sample/../ipv6-internal.h:59:13: error: conflicting types for ‘sa_family_t’
59 | typedef int sa_family_t;
| ^~~~~~~~~~~
In file included from /usr/include/bits/socket.h:151,
from /usr/include/sys/socket.h:39,
from sample/../ipv6-internal.h:38,
from sample/dns-example.c:11:
/usr/include/bits/sockaddr.h:28:28: note: previous declaration of ‘sa_family_t’ was here
28 | typedef unsigned short int sa_family_t;
| ^~~~~~~~~~~
In file included from sample/dns-example.c:11:
sample/../ipv6-internal.h:63:8: error: redefinition of ‘struct sockaddr_in6’
63 | struct sockaddr_in6 {
| ^~~~~~~~~~~~
In file included from /usr/include/netdb.h:27,
from ./include/event2/util.h:61,
from sample/../ipv6-internal.h:40,
from sample/dns-example.c:11:
/usr/include/netinet/in.h:255:8: note: originally defined here
255 | struct sockaddr_in6
| ^~~~~~~~~~~~
In file included from sample/dns-example.c:11:
sample/../ipv6-internal.h:67:2: error: unknown type name ‘ev_uint16_t’
67 | ev_uint16_t sin6_port;
| ^~~~~~~~~~~
In file included from sample/dns-example.c:29:
./include/event2/event.h:775:33: error: unknown type name ‘ev_uint32_t’; did you mean ‘ev_uint8_t’?
775 | void event_enable_debug_logging(ev_uint32_t which);
| ^~~~~~~~~~~
| ev_uint8_t
./include/event2/event.h:1431:1: error: unknown type name ‘ev_uint32_t’; did you mean ‘ev_uint8_t’?
1431 | ev_uint32_t event_get_version_number(void);
| ^~~~~~~~~~~
| ev_uint8_t
In file included from sample/dns-example.c:30:
./include/event2/dns.h:588:34: error: unknown type name ‘ev_uint16_t’; did you mean ‘ev_uint8_t’?
588 | void evdns_set_transaction_id_fn(ev_uint16_t (*fn)(void));
| ^~~~~~~~~~~
| ev_uint8_t
sample/dns-example.c:42:13: error: unknown type name ‘ev_uint32_t’; did you mean ‘ev_uint8_t’?
42 | #define u32 ev_uint32_t
| ^~~~~~~~~~~
sample/dns-example.c:46:12: note: in expansion of macro ‘u32’
46 | debug_ntoa(u32 address)
| ^~~
sample/dns-example.c: In function ‘main_callback’:
sample/dns-example.c:65:26: warning: implicit declaration of function ‘debug_ntoa’ [-Wimplicit-function-declaration]
65 | printf("%s: %s\n", n, debug_ntoa(((u32*)addrs)[i]));
| ^~~~~~~~~~
sample/dns-example.c:65:26: warning: nested extern declaration of ‘debug_ntoa’ [-Wnested-externs]
sample/dns-example.c:42:13: error: ‘ev_uint32_t’ undeclared (first use in this function); did you mean ‘ev_uint8_t’?
42 | #define u32 ev_uint32_t
| ^~~~~~~~~~~
sample/dns-example.c:65:39: note: in expansion of macro ‘u32’
65 | printf("%s: %s\n", n, debug_ntoa(((u32*)addrs)[i]));
| ^~~
sample/dns-example.c:42:13: note: each undeclared identifier is reported only once for each function it appears in
42 | #define u32 ev_uint32_t
| ^~~~~~~~~~~
sample/dns-example.c:65:39: note: in expansion of macro ‘u32’
65 | printf("%s: %s\n", n, debug_ntoa(((u32*)addrs)[i]));
| ^~~
sample/dns-example.c:65:43: error: expected expression before ‘)’ token
65 | printf("%s: %s\n", n, debug_ntoa(((u32*)addrs)[i]));
| ^
操作环境、软件版本等信息
centos7,openssl-devel-1.0.2k-26.el7_9.x86_64