Closed azilber closed 8 years ago
Also fails with luarocks:
# luarocks install cqueues
Installing https://luarocks.org/cqueues-20160316.53-0.src.rock...
Using https://luarocks.org/cqueues-20160316.53-0.src.rock... switching to 'build' mode
mkdir -p /tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/5.3
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -O2 -fPIC -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -DLUA_COMPAT_APIINTCASTS -DCQUEUES_VENDOR='"william@25thandClement.com"' -DCQUEUES_VERSION=20160316L -c -o /tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/5.3/cqueues.o /tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.c
In file included from /tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.c:49:
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.h: In function ‘cqs_setfd’:
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.h:381: error: ‘O_CLOEXEC’ undeclared (first use in this function)
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.h:381: error: (Each undeclared identifier is reported only once
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.h:381: error: for each function it appears in.)
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.h: In function ‘cqs_pipe’:
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.h:392: warning: implicit declaration of function ‘pipe2’
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.c: In function ‘alert_init’:
/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/cqueues.c:467: error: ‘O_CLOEXEC’ undeclared (first use in this function)
make: *** [/tmp/luarocks_cqueues-20160316.53-0-9791/cqueues-rel-20160316/src/5.3/cqueues.o] Error 1
Error: Build error: Failed building.
What's your kernel version? The simplest solution is for cqueues to define O_CLOEXEC when missing on Linux, which AFAICT is 02000000 for all architectures. It does the same for NetBSD, which added the definition a few releases after supporting it in the kernel. It's difficult to justify spending time refactoring code to handle the absence of O_CLOEXEC entirely when it's been supported by the Linux kernel for almost 10 years.
I'm glad you found this first. I'd have found it, possibly at a less opportune time, when porting cqueues to an old environment at work that has to build with an ancient glibc. I just tried and I get the same error. But the actual runtime is much newer so defining O_CLOEXEC would work for my scenario.
I'm not saying I won't do it ;) I'm just hoping there's an easier out.
I'm always hesitant to add such a define if it's missing from the libc. I'd prefer to just say a libc that old is not supported.
as a workaround, I might suggest you manually specify -DO_CLOEXEC=02000000
in CFLAGS.
Unfortunately, that define (via luarocks) did not work:
# luarocks install cqueues
Warning: falling back to curl - install luasec to get native HTTPS support
Installing https://luarocks.org/cqueues-20160316.53-0.src.rock...
Using https://luarocks.org/cqueues-20160316.53-0.src.rock... switching to 'build' mode
mkdir -p /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -O2 -fPIC -DLUA_C89_NUMBERS -DO_CLOEXEC=02000000 -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -DLUA_COMPAT_APIINTCASTS -DCQUEUES_VENDOR='"william@25thandClement.com"' -DCQUEUES_VERSION=20160316L -c -o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3/cqueues.o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.c
In file included from /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.c:49:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h: In function ‘cqs_pipe’:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h:392: warning: implicit declaration of function ‘pipe2’
mkdir -p /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -O2 -fPIC -DLUA_C89_NUMBERS -DO_CLOEXEC=02000000 -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -DLUA_COMPAT_APIINTCASTS -DCQUEUES_VENDOR='"william@25thandClement.com"' -DCQUEUES_VERSION=20160316L -c -o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3/socket.o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/socket.c
In file included from /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/socket.c:49:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h: In function ‘cqs_pipe’:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h:392: warning: implicit declaration of function ‘pipe2’
cd /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src && m4 /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/errno.c.m4 >| /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/errno.c.tmp
mv /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/errno.c.tmp /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/errno.c
mkdir -p /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -O2 -fPIC -DLUA_C89_NUMBERS -DO_CLOEXEC=02000000 -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -DLUA_COMPAT_APIINTCASTS -DCQUEUES_VENDOR='"william@25thandClement.com"' -DCQUEUES_VERSION=20160316L -c -o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3/errno.o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/errno.c
In file included from /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/errno.c:35:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h: In function ‘cqs_pipe’:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h:392: warning: implicit declaration of function ‘pipe2’
mkdir -p /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3
gcc -O2 -std=gnu99 -fPIC -g -Wall -Wextra -Wno-missing-field-initializers -Wno-unused -O2 -fPIC -DLUA_C89_NUMBERS -DO_CLOEXEC=02000000 -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -DLUA_COMPAT_APIINTCASTS -DCQUEUES_VENDOR='"william@25thandClement.com"' -DCQUEUES_VERSION=20160316L -c -o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3/signal.o /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c
In file included from /tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:36:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h: In function ‘cqs_pipe’:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/cqueues.h:392: warning: implicit declaration of function ‘pipe2’
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:45:26: error: sys/signalfd.h: No such file or directory
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c: In function ‘sfd_init’:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:83: warning: implicit declaration of function ‘signalfd’
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:83: error: ‘SFD_NONBLOCK’ undeclared (first use in this function)
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:83: error: (Each undeclared identifier is reported only once
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:83: error: for each function it appears in.)
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:83: error: ‘SFD_CLOEXEC’ undeclared (first use in this function)
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c: In function ‘sfd_query’:
/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/signal.c:159: error: storage size of ‘info’ isn’t known
make: *** [/tmp/luarocks_cqueues-20160316.53-0-6350/cqueues-rel-20160316/src/5.3/signal.o] Error 1
Error: Build error: Failed building.
Fyi, this is my /etc/luarocks/config-5.3.lua
rocks_trees = {
{ name = [[user]], root = home..[[/.luarocks]] },
{ name = [[system]], root = [[/usr]] }
}
variables = {
CC = "gcc",
CFLAGS = "-O2 -fPIC -DLUA_C89_NUMBERS -DO_CLOEXEC=02000000"
}
My kernel: 2.6.18-406.el5 #1 SMP Tue Jun 2 17:25:57 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux
with: glibc-2.5-123.el5_11.3
It looks like my glibc-devel doesn't include signalfd.h :(
I realize the system is hella old, but there's no avoiding that. I'm perfectly happy in trying out any hacks to get it to compile. :)
The pipe2 problem should be solved in master and the most recent release. There's proper feature detection for pipe2, and even if the detection was wrong you can override it with -DHAVE_PIPE2=0
.
The signalfd.h issue will require a little effort. For now you could try excluding it altogether with this patch:
diff --git a/src/signal.c b/src/signal.c
index 30c3aca..92aaf2f 100644
--- a/src/signal.c
+++ b/src/signal.c
@@ -36,7 +36,7 @@
#include <lauxlib.h>
#include "cqueues.h"
-
+#if 0
/*
* S I G N A L L I S T E N E R R O U T I N E S
@@ -339,7 +339,7 @@ static const luaL_Reg lsl_metatable[] = {
{ "__gc", &lsl__gc },
{ NULL, NULL },
}; /* lsl_metatable[] */
-
+#endif
/*
* S I G N A L D I S P O S I T I O N R O U T I N E S
@@ -466,9 +466,9 @@ static int ls_strsignal(lua_State *L) {
static const luaL_Reg ls_globals[] = {
- { "listen", &lsl_listen },
- { "type", &lsl_type },
- { "interpose", &lsl_interpose },
+// { "listen", &lsl_listen },
+// { "type", &lsl_type },
+// { "interpose", &lsl_interpose },
{ "ignore", &ls_ignore },
{ "default", &ls_default },
{ "discard", &ls_discard },
@@ -498,12 +498,14 @@ int luaopen__cqueues_signal(lua_State *L) {
};
unsigned i;
+#if 0
if (luaL_newmetatable(L, LSL_CLASS)) {
luaL_setfuncs(L, lsl_metatable, 0);
luaL_newlib(L, lsl_methods);
lua_setfield(L, -2, "__index");
}
+#endif
luaL_newlib(L, ls_globals);
With that patch against the latest release, I can compile with most of the regression suite passing on ancient firmware, also with glibc 2.5.
The lastest commit, 6ae925d, refactors signal.c to fall back to sigtimedwait when signalfd isn't available. Previously it only did that for Solaris and assumed everything else either had signalfd or EVFILT_SIGNAL. Now the logic is clear and correct.
@azilber working now? I've updated the release on luarocks
Closing. The latest release still works for me on an ancient glibc when specifying "-DO_CLOEXEC=02000000" with CPPFLAGS.
Sorry, I am new to Lua.
I am having a similar issue. luarocks install cqueues
produces the following error:
Installing https://luarocks.org/cqueues-20161215.53-0.src.rock
enabling Lua 5.3
cp /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/config.h.guess /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueu
es-rel-20161215/config.h
cp /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/config.h /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel
-20161215/src/config.h
mkdir -p /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/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/local/include -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/usr/include" -I"/usr/include" -DCQUEUES_VENDOR='"wi
lliam@25thandClement.com"' -DCQUEUES_VERSION=20161215L -c -o /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src/
5.3/cqueues.o /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src/cqueues.c
mkdir -p /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/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/local/include -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -I"/usr/include" -I"/usr/include" -DCQUEUES_VENDOR='"wi
lliam@25thandClement.com"' -DCQUEUES_VERSION=20161215L -c -o /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src/
5.3/socket.o /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src/socket.c
cd /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src && m4 /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-re
l-20161215/src/errno.c.m4 >| /tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src/errno.c.tmp
/bin/sh: 1: m4: not found
/tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src/GNUmakefile:42: recipe for target '/tmp/luarocks_cqueues-20161
215.53-0-iEy21N/cqueues-rel-20161215/src/errno.c' failed
make: *** [/tmp/luarocks_cqueues-20161215.53-0-iEy21N/cqueues-rel-20161215/src/errno.c] Error 127
Error: Build error: Failed building.
Any help would be greatly appreciated.
Never mind. I was missing m4
.
hello Marc Andrews, i have this same problem at the time of installing, please how did you solve it?
@RogerioTostes as @marcandrews said: he was missing m4
.
Thank you, I had not seen it.
gcc version 4.1.2 20080704 (Red Hat 4.1.2-55) OS: Centos 5.11