Lua-5.4.3 and Suricata undefined reference error

Hi,

I tried to build Suricata to link with Lua-5.4.3. However, there are a lot of undefined reference errors returning. For examples:

output-lua.o: In function ‘LuaStatsLogger’:
output-lua.c:385: undefined reference to ‘lua_getglobal’
ouput-lua.c:495: undefined reference to ‘lua_pcallk’

I am wondering does Suricata support Lua-5.4.3?

Vic

Hi Victor,

From what I understand, Suri Makefile is hardcoded to expect Lua-5.1. On Ubuntu (20.04, maybe), locally, I know that @sbhardwaj has made it work, with some changes to said Makefile.

Can you tell us: are you building Suri from master? How did you link it to Lua-5.4.3?

thanks :slight_smile:

Hi Ju,

I built Suricata (version 5.0.7) from the source code, attempting to link to Lua-5.4.3. I firstly run the “configure” as below:

sudo ./configure --libdir=/usr/lib64 --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-nfqueue --enable-lua --enable-geoip --disable-gccmarch-native --enable-profiling

And, then I run:

sudo make install-full

Unfortunately, there are a lot of undefined reference errors returning, such as the following.
output-lua.o: In function LuaStatsLogger': /local_home/suricata-5.0.7/src/output-lua.c:385: undefined reference to lua_getglobal’
/local_home/suricata-5.0.7/src/output-lua.c:419: undefined reference to lua_pcallk' output-lua.o: In function LuaFlowLogger’:
/local_home/suricata-5.0.7/src/output-lua.c:364: undefined reference to lua_getglobal' /local_home/suricata-5.0.7/src/output-lua.c:366: undefined reference to lua_pcallk’
output-lua.o: In function LuaFileLogger': /local_home/suricata-5.0.7/src/output-lua.c:334: undefined reference to lua_getglobal’
/local_home/suricata-5.0.7/src/output-lua.c:336: undefined reference to lua_pcallk' output-lua.o: In function LuaPacketLogger’:
/local_home/suricata-5.0.7/src/output-lua.c:278: undefined reference to lua_getglobal' /local_home/suricata-5.0.7/src/output-lua.c:287: undefined reference to lua_pcallk’
output-lua.o: In function LuaPacketLoggerAlerts': /local_home/suricata-5.0.7/src/output-lua.c:229: undefined reference to lua_pcallk’
/local_home/suricata-5.0.7/src/output-lua.c:214: undefined reference to lua_getglobal' output-lua.o: In function LuaTxLogger’:
/local_home/suricata-5.0.7/src/output-lua.c:114: undefined reference to lua_getglobal' /local_home/suricata-5.0.7/src/output-lua.c:118: undefined reference to lua_pcallk’
output-lua.o: In function LuaStreamingLogger': /local_home/suricata-5.0.7/src/output-lua.c:159: undefined reference to lua_getglobal’
/local_home/suricata-5.0.7/src/output-lua.c:159: undefined reference to lua_getglobal' /local_home/suricata-5.0.7/src/output-lua.c:165: undefined reference to lua_pcallk’
output-lua.o: In function LuaScriptSetup': /local_home/suricata-5.0.7/src/output-lua.c:614: undefined reference to luaL_loadfilex’
/local_home/suricata-5.0.7/src/output-lua.c:624: undefined reference to lua_pcallk' /local_home/suricata-5.0.7/src/output-lua.c:629: undefined reference to lua_getglobal’
/local_home/suricata-5.0.7/src/output-lua.c:642: undefined reference to lua_pcallk' output-lua.o: In function LuaScriptInit’:
/local_home/suricata-5.0.7/src/output-lua.c:468: undefined reference to luaL_loadfilex' /local_home/suricata-5.0.7/src/output-lua.c:478: undefined reference to lua_pcallk’
/local_home/suricata-5.0.7/src/output-lua.c:483: undefined reference to lua_getglobal' /local_home/suricata-5.0.7/src/output-lua.c:499: undefined reference to lua_pcallk’
/local_home/suricata-5.0.7/src/output-lua.c:561: undefined reference to `lua_getgloba

1 Like

Hey again, thanks for the answer.

Just in case, can you please share the result of running

ldd your/suricata/bin 

You can also confirm if the configuration script was able to detect your lua version with

suricata --build-info

I’m asking because I think it is still very possible that the configuration process has sort of ignored your lua lib, if it is not 5.1, I’m afraid.

(Sorry if I’m saying basic things! I’m still learning a lot, myself)

Hi Ju,

I am using a VM running Centos 8. It comes with Lua_5.1.4 as default. I am able to build Suricata linking to this Lua_5.1.4. Please see below.

ldd /usr/bin/suricata | grep lua
liblua-5.1.so => /usr/lib64/liblua-5.1.so (0x00007fb50469e000)

But, when I tried to rebuild the Suricata linking to Lua_5.4.3, there were a lot of undefined reference errors returning as mention before.

I am wondering whether or not Suricata supports this latest Lua version.

thanks

Hi Victor,

sorry for the late answer (went offline for a few days!).

I’ve given this a few tries, before writing this answer.

On my Ubuntu 20.04, with Lua 5.3, I’ve tried to build Suri passing different configure values for Lua as command-line options:

./configure --enable-unittests --enable-lua --with-liblua-includes=/usr/include/lua5.3/ --with-liblua-libraries="/usr/lib/x86_64-linux-gnu/liblua5.3.so"

When I try to link Lua library like that, it doesn’t work for me either, meaning that I also get lots of undefined references when I try to build Suri.

I did manage to make it work, though, by editing configure.ac and replacing all mentions to Lua 5.1 (the default dependency, as per Suri documentation) for Lua 5.3, before running ./configure again. After that, I finally managed to compile Suricata without undefined reference errors.

So, my conclusion is that Suri does support newer versions of Lua (in my case, tested with Ubuntu 20.04 and Lua 5.3), but, as it is hardcoded to expect Lua 5.1, just passing a different version via command-line doesn’t suffice. Unless you manually change the file, it probably won’t work!

Hi Ju,

Thanks for the information. I certainly will it a try too.

Victor

How have you installed Lua 5.4 on CentOS 8?

On a more or less default CentOS install I see Lua 5.1 and 5.3 available, but not 5.4. In general this is what will happen.

  • If you have lua-devel installed Suricata will link against Lua 5.3, even if compat-lua-devel is installed.
  • If you have have compat-lua-devel installed, and lua-devel is not installed, Suricata will link against Lua 5.1.
1 Like