Issue
Here is the issue.. When I run the command make -j $(nproc) TARGET=linux-glibc USE_PCRE=1 USE_PCRE_JIT=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LINUX_TPROXY=1 USE_REGPARM=1 USE_LUA=1 USE_THREAD=1 USE_TFO=1
I get the error below.. I'm trying to build HaProxy 2.5 with Lua 5.4 from source.
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_hook':
/src/haproxy-2.5.5/src/hlua.c:1325: undefined reference to `lua_isyieldable'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_load_state':
/src/haproxy-2.5.5/src/hlua.c:11134: undefined reference to `luaL_loadfilex'
/src/haproxy-2.5.5/src/hlua.c:11142: undefined reference to `lua_pcallk'
src/hlua.o: In function `hlua_prepend_path':
/src/haproxy-2.5.5/src/hlua.c:11236: undefined reference to `lua_getglobal'
src/hlua.o: In function `hlua_filter_parse_fct':
/src/haproxy-2.5.5/src/hlua.c:10875: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_sleep_yield':
/src/haproxy-2.5.5/src/hlua.c:8289: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_applet_tcp_recv_yield':
/src/haproxy-2.5.5/src/hlua.c:4557: undefined reference to `lua_copy'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_txn_reply_add_header':
/src/haproxy-2.5.5/src/hlua.c:8185: undefined reference to `lua_rawlen'
src/hlua.o: In function `hlua_applet_http_addheader':
/src/haproxy-2.5.5/src/hlua.c:5242: undefined reference to `lua_rawlen'
src/hlua.o: In function `hlua_txn_reply_new':
/src/haproxy-2.5.5/src/hlua.c:8067: undefined reference to `lua_rotate'
/src/haproxy-2.5.5/src/hlua.c:8071: undefined reference to `lua_rotate'
/src/haproxy-2.5.5/src/hlua.c:8088: undefined reference to `lua_rawlen'
/src/haproxy-2.5.5/src/hlua.c:8007: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_filter_init_per_thread':
/src/haproxy-2.5.5/src/hlua.c:10299: undefined reference to `lua_rotate'
/src/haproxy-2.5.5/src/hlua.c:10319: undefined reference to `lua_rawlen'
/src/haproxy-2.5.5/src/hlua.c:10322: undefined reference to `lua_pcallk'
src/hlua.o: In function `hlua_lua2arg':
/src/haproxy-2.5.5/src/hlua.c:603: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_lua2smp':
/src/haproxy-2.5.5/src/hlua.c:739: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_txn_forward_reply':
/src/haproxy-2.5.5/src/hlua.c:7757: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o:/src/haproxy-2.5.5/src/hlua.c:1158: more undefined references to `lua_yieldk' follow
src/hlua.o: In function `hlua_http_get_headers':
/src/haproxy-2.5.5/src/hlua.c:5614: undefined reference to `lua_rawlen'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_socket_connect':
/src/haproxy-2.5.5/src/hlua.c:2742: undefined reference to `luaL_prepbuffsize'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_httpclient_get_headers':
/src/haproxy-2.5.5/src/hlua.c:7022: undefined reference to `lua_rawlen'
src/hlua.o: In function `hlua_applet_http_recv_yield':
/src/haproxy-2.5.5/src/hlua.c:5094: undefined reference to `lua_copy'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o:/src/haproxy-2.5.5/src/hlua.c:1158: more undefined references to `lua_yieldk' follow
src/hlua.o: In function `hlua_applet_http_send_response':
/src/haproxy-2.5.5/src/hlua.c:5345: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_socket_receive_yield':
/src/haproxy-2.5.5/src/hlua.c:2069: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_socket_receive':
/src/haproxy-2.5.5/src/hlua.c:2279: undefined reference to `lua_copy'
/src/haproxy-2.5.5/src/hlua.c:2268: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_filter_callback':
/src/haproxy-2.5.5/src/hlua.c:10615: undefined reference to `lua_rotate'
/src/haproxy-2.5.5/src/hlua.c:10658: undefined reference to `lua_rotate'
/src/haproxy-2.5.5/src/hlua.c:10673: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_filter_tcp_payload':
/src/haproxy-2.5.5/src/hlua.c:10812: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_filter_http_payload':
/src/haproxy-2.5.5/src/hlua.c:10776: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_action':
/src/haproxy-2.5.5/src/hlua.c:9076: undefined reference to `lua_tointegerx'
src/hlua.o: In function `hlua_filter_new':
/src/haproxy-2.5.5/src/hlua.c:10487: undefined reference to `lua_rotate'
src/hlua.o: In function `hlua_yieldk':
/src/haproxy-2.5.5/src/hlua.c:1158: undefined reference to `lua_yieldk'
src/hlua.o: In function `hlua_init_state':
/src/haproxy-2.5.5/src/hlua.c:11723: undefined reference to `lua_setglobal'
/src/haproxy-2.5.5/src/hlua.c:11746: undefined reference to `lua_setglobal'
/src/haproxy-2.5.5/src/hlua.c:11768: undefined reference to `lua_setglobal'
/src/haproxy-2.5.5/src/hlua.c:11814: undefined reference to `lua_setglobal'
src/hlua_fcn.o: In function `hlua_stktable_dump':
/src/haproxy-2.5.5/src/hlua_fcn.c:719: undefined reference to `lua_rawlen'
/src/haproxy-2.5.5/src/hlua_fcn.c:744: undefined reference to `lua_tointegerx'
src/hlua_fcn.o: In function `hlua_fcn_post_init':
/src/haproxy-2.5.5/src/hlua_fcn.c:1390: undefined reference to `lua_getglobal'
src/hlua_fcn.o: In function `hlua_fcn_reg_core_fcn':
/src/haproxy-2.5.5/src/hlua_fcn.c:1713: undefined reference to `lua_setglobal'
collect2: error: ld returned 1 exit status
make: *** [haproxy] Error 1
When using the default Lua, which is 5.1.4 for CentOS7 then HAProxy can't find it. HaProxy doesn't work with 5.1.4 Lua. After updating the Lua to 5.3 or above and running the command
make -j $(nproc) TARGET=linux-glibc USE_PCRE=1 USE_PCRE_JIT=1 USE_OPENSSL=1 USE_ZLIB=1 USE_LINUX_TPROXY=1 USE_REGPARM=1 USE_LUA=1 LUA_LIB_NAME=lua5.4 USE_THREAD=1 USE_TFO=1
I still get the error above. Please have in mind that the CentOS7 is a ARM64 infrastructure. I tried to build the HAProxy and Lua on AMD64 and it went through successfully. Is it possible that this is an ARM issue ?
Solution
Okay to fix this issue first install the latest Lua package, then compile the HaProxy by using this command.
make -j $(nproc) USE_NS=1 > USE_TFO=1 > USE_ZLIB=1 > USE_LUA=1 > USE_PCRE=1 > USE_SYSTEMD=1 > USE_LIBCRYPT=1 > USE_THREAD=1 > TARGET=linux-glibc > LUA_INC=/src/lua-5.3.3/include > LUA_LIB=/src/lua-5.3.3/lib
Just outline the path of the Lua library and include directories.
Answered By - kdGeorgiev Answer Checked By - Clifford M. (WPSolving Volunteer)