LUA 5.3 doesn't compile with haproxy 1.6.7


#1

Hi All,

I’m on CentOs 5.11 x86_64. I’m able to compile haproxy 1.6.7 (Without LUA). I’m able to compile Lua 5.3 (and install both). But when attempting to compile haproxy 1.6.7 w/ Lua, I get the following compile error:

make USE_PCRE=1 USE_OPENSSL=1 USE_LUA=1 USE_ZLIB=1 DEBUG="" ARCH=x86_64 TARGET=linux26 ADDLIB=-lz SPEC_CFLAGS="-Wdeclaration-after-statement" LUA_LIB_NAME=lua CC=gcc44
gcc44 -Iinclude -Iebtree -Wall -m64 -march=x86-64 -O2 -g -Wdeclaration-after-statement       -DTPROXY -DCONFIG_HAP_CRYPT -DUSE_ZLIB  -DENABLE_POLL -DENABLE_EPOLL -DNETFILTER -DUSE_GETSOCKNAME -DUSE_OPENSSL  -DUSE_SYSCALL_FUTEX -DUSE_LUA  -DUSE_PCRE -I/usr/include  -DCONFIG_HAPROXY_VERSION=\"1.6.7\" -DCONFIG_HAPROXY_DATE=\"2016/07/13\" -c -o src/uri_auth.o src/uri_auth.c
In file included from /usr/include/lua.h:16,
                 from include/types/hlua.h:6,
                 from include/types/stream.h:36,
                 from include/proto/log.h:33,
                 from src/uri_auth.c:20:
/usr/include/luaconf.h:572:2: error: #error "Compiler does not support 'long long'. Use option '-DLUA_32BITS'   or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)"
In file included from include/types/hlua.h:6,
                 from include/types/stream.h:36,
                 from include/proto/log.h:33,
                 from src/uri_auth.c:20:
/usr/include/lua.h:93: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lua_Integer’
/usr/include/lua.h:96: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘lua_Unsigned’
/usr/include/lua.h:182: error: ‘lua_Integer’ declared as function returning a function
/usr/include/lua.h:226: error: expected declaration specifiers or ‘...’ before ‘lua_Integer’
/usr/include/lua.h:244: error: expected declaration specifiers or ‘...’ before ‘lua_Integer’
/usr/include/lua.h:246: error: expected declaration specifiers or ‘...’ before ‘lua_Integer’
/usr/include/lua.h:261: error: expected declaration specifiers or ‘...’ before ‘lua_Integer’
/usr/include/lua.h:263: error: expected declaration specifiers or ‘...’ before ‘lua_Integer’
In file included from include/types/hlua.h:7,
                 from include/types/stream.h:36,
                 from include/proto/log.h:33,
                 from src/uri_auth.c:20:
/usr/include/lauxlib.h:46: error: ‘lua_Integer’ declared as function returning a function
/usr/include/lauxlib.h:48: error: expected declaration specifiers or ‘...’ before ‘lua_Integer’
/usr/include/lauxlib.h:48: error: ‘lua_Integer’ declared as function returning a function
/usr/include/lauxlib.h:86: error: ‘lua_Integer’ declared as function returning a function
make: *** [src/uri_auth.o] Error 1

Any ideas what this could be? Googling wasn’t helpful for this case. Just FYI, I’m just testing with gcc44 above, the same exact issue happens with gcc (4.1).

If I do add -DLUA_32BITS it does compile. But for some reason ld tries to link in 32bit shared libs.

/usr/bin/ld: skipping incompatible /usr/lib/libcrypt.so when searching for -lcrypt
/usr/bin/ld: skipping incompatible /usr/lib/libcrypt.a when searching for -lcrypt
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz

Additionally, I really need 64bit numbers, not 32…

-Alex


#2

Replying to myself for future reference. These compile options worked for me:
USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LUA=1 LUA_LIB_NAME=lua LDFLAGS=-ldl LUA_LIB=/usr/lib64/ LUA_INC=/usr/include/ ARCH=%{_target_cpu} TARGET=linux26 ADDLIB=-lz S
PEC_CFLAGS="-Wdeclaration-after-statement" DEFINE="-DLUA_C89_NUMBERS"

Specifically: -DLUA_C89_NUMBERS