wahern / cqueues

Continuation Queues: Embeddable asynchronous networking, threading, and notification framework for Lua on Unix.
http://25thandclement.com/~william/projects/cqueues.html
MIT License
244 stars 37 forks source link

Cannot compile: "lvalue required as unary ‘&’ operand" #221

Closed bortzmeyer closed 5 years ago

bortzmeyer commented 5 years ago

I'm trying to install cqueues (I need it for lua-http):

% sudo luarocks install cqueues
Installing https://luarocks.org/cqueues-20171014.53-0.src.rock

enabling Lua 5.1
enabling Lua 5.3
cp /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/config.h.guess /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/config.h
cp /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/config.h /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/config.h
mkdir -p /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/5.3
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra  -Wno-missing-field-initializers  -Wno-override-init -Wno-unused -O2 -fPIC -DLUA_COMPAT_APIINTCASTS -I/usr/include -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/usr/include" -I"/usr/include" -DCOMPAT53_PREFIX=cqueues -DCQUEUES_VENDOR='"quae@daurnimator.com"' -DCQUEUES_VERSION=20171014L  -c -o /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/5.3/cqueues.o /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/cqueues.c
[Lots of warnings deleted]
In file included from /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/dns.c:43:
/tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/dns.c: In function ‘res_new’:
/tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/lib/dns.h:1059:24: error: lvalue required as unary ‘&’ operand
 1059 | #define dns_opts(...) (&dns_quietinit((struct dns_options)DNS_OPTS_INIT(__VA_ARGS__)))
      |                        ^
/tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/dns.c:2133:59: note: in expansion of macro ‘dns_opts’
 2133 |  if (!(R->res = dns_res_open(resconf, hosts, hints, NULL, dns_opts(.closefd = { R, &res_closefd }), &error)))
      |                                                           ^~~~~~~~
make: *** [/tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/GNUmakefile:86: /tmp/luarocks_cqueues-20171014.53-0-SAtOXt/cqueues-rel-20171014/src/5.3/dns.o] Error 1

Error: Build error: Failed building.

Arch Linux x86_64 with gcc:

% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/9.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto
Thread model: posix
gcc version 9.1.0 (GCC) 
vcunat commented 5 years ago

Clearly a duplicate of https://github.com/wahern/cqueues/issues/212

GildedHonour commented 5 years ago

what's the solution?

vcunat commented 5 years ago

@GildedHonour: please do not split the discussion among multiple threads. It's #212. That work-around patch was tested on Fedora, but I believe it will work fine anywhere if using gcc9 (it will have problems with clang probably, but there you can still do without any patch AFAIK).

GildedHonour commented 5 years ago

@vcunat I will split the discussion among multiple threads. With pleasure.