]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: lua: can't load external libraries
authorThierry Fournier <tfournier@arpalert.org>
Sat, 26 Mar 2016 12:19:21 +0000 (13:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Mar 2016 13:20:19 +0000 (15:20 +0200)
Libraries requires the export of embedded Lua symbols. If a library
is loaded by HAProxy or by an Lua program, an error like the following
error raises:

   [ALERT] 085/135722 (7224) : parsing [test.cfg:8] : lua runtime error: error loading module 'test' from file './test.so':
        ./test.so: undefined symbol: lua_createtable

This patch modify the Makefile, and allow exports of the Lua symbols.

This patch must be backported in version 1.6

Makefile

index 9acbf2bcc217c1cd26a77c82816dfef3f18729af..7d39cfd994d39d26e7d306ac11ca00d8a5d1663e 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -597,7 +597,7 @@ check_lua_lib = $(shell echo "int main(){}" | $(CC) -o /dev/null -x c - $(2) -l$
 
 BUILD_OPTIONS   += $(call ignore_implicit,USE_LUA)
 OPTIONS_CFLAGS  += -DUSE_LUA $(if $(LUA_INC),-I$(LUA_INC))
-LUA_LD_FLAGS := $(if $(LUA_LIB),-L$(LUA_LIB))
+LUA_LD_FLAGS := -Wl,--export-dynamic $(if $(LUA_LIB),-L$(LUA_LIB))
 ifeq ($(LUA_LIB_NAME),)
 # Try to automatically detect the Lua library
 LUA_LIB_NAME := $(firstword $(foreach lib,lua5.3 lua53 lua,$(call check_lua_lib,$(lib),$(LUA_LD_FLAGS))))