From: Thierry Fournier Date: Sat, 26 Mar 2016 12:19:21 +0000 (+0100) Subject: BUG/MINOR: lua: can't load external libraries X-Git-Tag: v1.7-dev3~89 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=85dc1d3995a20af6b404764584357914a41027fb;p=thirdparty%2Fhaproxy.git BUG/MINOR: lua: can't load external libraries 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 --- diff --git a/Makefile b/Makefile index 9acbf2bcc2..7d39cfd994 100644 --- 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))))