Open blu2lz opened 9 years ago
I'm having the same problem 9e6583f fails, while its parent 49fef15 compiles fine. Ubuntu 14.04.3 LTS.
I've only tried the current HEAD of master, but I'm also getting compile errors on CentOS 7 (using the bento/centos-7.1 vagrant box).
[vagrant@localhost wrk2]$ git log | head -n1
commit 6a91d323b36e5a18b076cab746607b48f360d82b
[vagrant@localhost wrk2]$ uname -a
Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[vagrant@localhost wrk2]$ cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
Output of running make
:
src/script.c: In function ‘script_addr_copy’:
src/script.c:300:5: error: dereferencing pointer to incomplete type
*dst = *src;
^
src/script.c:300:12: error: dereferencing pointer to incomplete type
*dst = *src;
^
src/script.c:301:8: error: dereferencing pointer to incomplete type
dst->ai_addr = zmalloc(src->ai_addrlen);
^
src/script.c:301:31: error: dereferencing pointer to incomplete type
dst->ai_addr = zmalloc(src->ai_addrlen);
^
src/script.c:302:15: error: dereferencing pointer to incomplete type
memcpy(dst->ai_addr, src->ai_addr, src->ai_addrlen);
^
src/script.c:302:29: error: dereferencing pointer to incomplete type
memcpy(dst->ai_addr, src->ai_addr, src->ai_addrlen);
^
src/script.c:302:43: error: dereferencing pointer to incomplete type
memcpy(dst->ai_addr, src->ai_addr, src->ai_addrlen);
^
src/script.c: In function ‘script_addr_clone’:
src/script.c:306:56: error: dereferencing pointer to incomplete type
struct addrinfo *udata = lua_newuserdata(L, sizeof(*udata));
^
src/script.c: In function ‘script_addr_tostring’:
src/script.c:315:15: error: ‘NI_MAXHOST’ undeclared (first use in this function)
char host[NI_MAXHOST];
^
src/script.c:315:15: note: each undeclared identifier is reported only once for each function it appears in
src/script.c:316:18: error: ‘NI_MAXSERV’ undeclared (first use in this function)
char service[NI_MAXSERV];
^
src/script.c:318:17: error: ‘NI_NUMERICHOST’ undeclared (first use in this function)
int flags = NI_NUMERICHOST | NI_NUMERICSERV;
^
src/script.c:318:34: error: ‘NI_NUMERICSERV’ undeclared (first use in this function)
int flags = NI_NUMERICHOST | NI_NUMERICSERV;
^
src/script.c:319:5: warning: implicit declaration of function ‘getnameinfo’ [-Wimplicit-function-declaration]
int rc = getnameinfo(addr->ai_addr, addr->ai_addrlen, host, NI_MAXHOST, service, NI_MAXSERV, flags);
^
src/script.c:319:30: error: dereferencing pointer to incomplete type
int rc = getnameinfo(addr->ai_addr, addr->ai_addrlen, host, NI_MAXHOST, service, NI_MAXSERV, flags);
^
src/script.c:319:45: error: dereferencing pointer to incomplete type
int rc = getnameinfo(addr->ai_addr, addr->ai_addrlen, host, NI_MAXHOST, service, NI_MAXSERV, flags);
^
src/script.c:321:9: warning: implicit declaration of function ‘gai_strerror’ [-Wimplicit-function-declaration]
const char *msg = gai_strerror(rc);
^
src/script.c:321:27: warning: initialization makes pointer from integer without a cast [enabled by default]
const char *msg = gai_strerror(rc);
^
src/script.c:316:10: warning: unused variable ‘service’ [-Wunused-variable]
char service[NI_MAXSERV];
^
src/script.c:315:10: warning: unused variable ‘host’ [-Wunused-variable]
char host[NI_MAXHOST];
^
src/script.c: In function ‘script_addr_gc’:
src/script.c:331:15: error: dereferencing pointer to incomplete type
zfree(addr->ai_addr);
^
src/script.c: In function ‘script_thread_newindex’:
src/script.c:426:35: error: dereferencing pointer to incomplete type
if (t->addr) zfree(t->addr->ai_addr);
^
src/script.c:427:44: error: dereferencing pointer to incomplete type
t->addr = zrealloc(t->addr, sizeof(*addr));
^
src/script.c: In function ‘script_wrk_lookup’:
src/script.c:437:12: error: variable ‘hints’ has initializer but incomplete type
struct addrinfo hints = {
^
src/script.c:438:9: error: unknown field ‘ai_family’ specified in initializer
.ai_family = AF_UNSPEC,
^
src/script.c:438:9: warning: excess elements in struct initializer [enabled by default]
src/script.c:438:9: warning: (near initialization for ‘hints’) [enabled by default]
src/script.c:439:9: error: unknown field ‘ai_socktype’ specified in initializer
.ai_socktype = SOCK_STREAM
^
src/script.c:440:5: warning: excess elements in struct initializer [enabled by default]
};
^
src/script.c:440:5: warning: (near initialization for ‘hints’) [enabled by default]
src/script.c:437:21: error: storage size of ‘hints’ isn’t known
struct addrinfo hints = {
^
src/script.c:446:5: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
if ((rc = getaddrinfo(host, service, &hints, &addrs)) != 0) {
^
src/script.c:447:27: warning: initialization makes pointer from integer without a cast [enabled by default]
const char *msg = gai_strerror(rc);
^
src/script.c:453:66: error: dereferencing pointer to incomplete type
for (struct addrinfo *addr = addrs; addr != NULL; addr = addr->ai_next) {
^
src/script.c:458:5: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
freeaddrinfo(addrs);
^
src/script.c:437:21: warning: unused variable ‘hints’ [-Wunused-variable]
struct addrinfo hints = {
^
src/script.c: In function ‘script_wrk_connect’:
src/script.c:465:26: error: dereferencing pointer to incomplete type
if ((fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol)) != -1) {
^
src/script.c:465:43: error: dereferencing pointer to incomplete type
if ((fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol)) != -1) {
^
src/script.c:465:62: error: dereferencing pointer to incomplete type
if ((fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol)) != -1) {
^
src/script.c:466:37: error: dereferencing pointer to incomplete type
connected = connect(fd, addr->ai_addr, addr->ai_addrlen) == 0;
^
src/script.c:466:52: error: dereferencing pointer to incomplete type
connected = connect(fd, addr->ai_addr, addr->ai_addrlen) == 0;
^
make: *** [obj/script.o] Error 1
I am able to compile and run wrk 4.0.1 successfully.
I'm experiencing this issue as well. gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
I believe you can fix this by adding some CFLAGs to the Makefile entry for linux. After line 11:
else ifeq ($(TARGET), linux)
Add the following:
CFLAGS += -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE
(As this is a Makefile, ensure that the line begins with a tab and not spaces).
That fixed the problem for me on CentOS 6.7. (Copied from upstream's Makefile).
I'm on Debian Squeeze
Linux 2.6.32-5-amd64 #1 SMP Wed Feb 18 13:14:10 UTC 2015 x86_64 GNU/Linux
@joyofhex your suggestion worked for me! thx
Just merged @markuskobler PR (https://github.com/giltene/wrk2/issues/13), which hopefully fixes this for the various platforms. Builds for me. Please pull, check, and report back so I can close this issue.
@giltene It's compiling for me now - thanks!
However, running make
is kind of chatty. I'm not sure if that means setting another compiler flag could help. Here's what I'm seeing now:
[vagrant@localhost wrk2]$ make clean
rm -f wrk obj/*
make[1]: Entering directory `/home/vagrant/wrk2/deps/luajit'
make -C src clean
make[2]: Entering directory `/home/vagrant/wrk2/deps/luajit/src'
rm -f luajit libluajit.a libluajit.so host/minilua host/buildvm lj_vm.s lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h host/buildvm_arch.h jit/vmdef.lua *.o host/*.o *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk
make[2]: Leaving directory `/home/vagrant/wrk2/deps/luajit/src'
make[1]: Leaving directory `/home/vagrant/wrk2/deps/luajit'
[vagrant@localhost wrk2]$ make [150/10652]
Building LuaJIT...
make[1]: Entering directory `/home/vagrant/wrk2/deps/luajit/src'
HOSTCC host/minilua.o
HOSTLINK host/minilua
DYNASM host/buildvm_arch.h
HOSTCC host/buildvm.o
HOSTCC host/buildvm_asm.o
HOSTCC host/buildvm_peobj.o
HOSTCC host/buildvm_lib.o
HOSTCC host/buildvm_fold.o
HOSTLINK host/buildvm
BUILDVM lj_vm.s
ASM lj_vm.o
CC lj_gc.o
BUILDVM lj_ffdef.h
CC lj_err.o
CC lj_char.o
BUILDVM lj_bcdef.h
CC lj_bc.o
CC lj_obj.o
CC lj_str.o
CC lj_tab.o
CC lj_func.o
CC lj_udata.o
CC lj_meta.o
CC lj_debug.o
CC lj_state.o
CC lj_dispatch.o
CC lj_vmevent.o
CC lj_vmmath.o
CC lj_strscan.o
CC lj_api.o
CC lj_lex.o
CC lj_parse.o
CC lj_bcread.o
CC lj_bcwrite.o
CC lj_load.o
CC lj_ir.o
CC lj_opt_mem.o
BUILDVM lj_folddef.h
CC lj_opt_fold.o
CC lj_opt_narrow.o
CC lj_opt_dce.o
CC lj_opt_loop.o
CC lj_opt_split.o
CC lj_opt_sink.o
CC lj_mcode.o
CC lj_snap.o
CC lj_record.o [101/10652]
CC lj_crecord.o
BUILDVM lj_recdef.h
CC lj_ffrecord.o
CC lj_asm.o
CC lj_trace.o
CC lj_gdbjit.o
CC lj_ctype.o
CC lj_cdata.o
CC lj_cconv.o
CC lj_ccall.o
CC lj_ccallback.o
CC lj_carith.o
CC lj_clib.o
CC lj_cparse.o
CC lj_lib.o
CC lj_alloc.o
CC lib_aux.o
BUILDVM lj_libdef.h
CC lib_base.o
CC lib_math.o
CC lib_bit.o
CC lib_string.o
CC lib_table.o
CC lib_io.o
CC lib_os.o
CC lib_package.o
CC lib_debug.o
CC lib_jit.o
CC lib_ffi.o
CC lib_init.o
AR libluajit.a
CC luajit.o
BUILDVM jit/vmdef.lua
LINK luajit
OK Successfully built LuaJIT
make[1]: Leaving directory `/home/vagrant/wrk2/deps/luajit/src'
CC src/wrk.c
In file included from src/wrk.h:4:0,
from src/wrk.c:3:
src/config.h:8:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200809L
^
<command-line>:0:0: note: this is the location of the previous definition
src/wrk.c: In function ‘response_complete’:
src/wrk.c:526:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t’ [-Wformat=]
printf(" expected_latency_timing = %lld\n", expected_latency_timing);
^
src/wrk.c:527:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" now = %lld\n", now);
^
src/wrk.c:528:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" expected_latency_start = %lld\n", expected_latency_start);
^
src/wrk.c:529:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" c->thread_start = %lld\n", c->thread_start);
^
src/wrk.c:530:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" c->complete = %lld\n", c->complete);
^
src/wrk.c:532:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" latest_should_send_time = %lld\n", c->latest_should_send_time);
^
src/wrk.c:533:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" latest_expected_start = %lld\n", c->latest_expected_start);
^ [36/10652]
src/wrk.c:534:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" latest_connect = %lld\n", c->latest_connect);
^
src/wrk.c:535:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" latest_write = %lld\n", c->latest_write);
^
src/wrk.c:539:9: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘uint64_t’ [-Wformat=]
printf(" next expected_latency_start = %lld\n", expected_latency_start);
^
src/wrk.c: At top level:
src/wrk.c:831:13: warning: ‘print_stats_latency’ defined but not used [-Wunused-function]
static void print_stats_latency(stats *stats) {
^
CC src/net.c
In file included from src/net.h:4:0,
from src/net.c:7:
src/config.h:8:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200809L
^
<command-line>:0:0: note: this is the location of the previous definition
CC src/ssl.c
In file included from src/net.h:4:0,
from src/ssl.h:4,
from src/ssl.c:9:
src/config.h:8:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200809L
^
<command-line>:0:0: note: this is the location of the previous definition
CC src/aprintf.c
CC src/stats.c
CC src/script.c
In file included from src/wrk.h:4:0,
from src/script.h:10,
from src/script.c:5:
src/config.h:8:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200809L
^
<command-line>:0:0: note: this is the location of the previous definition
CC src/units.c
CC src/ae.c
In file included from src/ae.c:45:0:
src/config.h:8:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200809L
^
<command-line>:0:0: note: this is the location of the previous definition
CC src/zmalloc.c
In file included from src/zmalloc.c:35:0:
src/config.h:8:0: warning: "_POSIX_C_SOURCE" redefined [enabled by default]
#define _POSIX_C_SOURCE 200809L
^
<command-line>:0:0: note: this is the location of the previous definition
CC src/http_parser.c
CC src/tinymt64.c
CC src/hdr_histogram.c
LUAJIT src/wrk.lua
LINK wrk
Thanks!
@giltene Thanks for the merge, it compiles now. Regarding the chatty make it's because @markuskobler used the flag 200112L while the posix c source is redefined in config.h to 200809L. Changing the Makefile to use 200809L instead of 200112L fixes this. I opened a PR (#14), you can merge it.
@giltene I've confirmed that it now compiles on Ubuntu 14.04.3 LTS. Thanks!
Hey, I switched to the fork because I needed the -R option. Since commit 9e6583f0f643ce99a053df906caca37d101bc5ec (Backport of wrk 4 changes) it won't compile. Error is "error: dereferencing pointer to incomplete type" for everything that's related to the struct addrinfo. It seems it's provided directly by lua. I tried to hunt it down but my time is limited at the moment. Now I work with the comment before the backport and it works just fine. Thanks!