# Lua-5.4.3 and Suricata undefined reference error

**URL:** <https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906>\
**Category:** Help\
**Tags:** lua\
**Created:** [November 7, 2021, 5:46pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906 "2021-11-07T17:46:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Victor](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@Victor](https://forum.suricata.io/u/Victor)\
**Post date:** [November 7, 2021, 5:46pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/1 "2021-11-07T17:46:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jufajardini](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.suricata.io/jufajardini/32/896_2.png) [@jufajardini](https://forum.suricata.io/u/jufajardini)\
**Post date:** [November 8, 2021, 10:12am UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/2 "2021-11-08T10:12:08Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![Victor](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@Victor](https://forum.suricata.io/u/Victor)\
**Post date:** [November 8, 2021, 1:42pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/3 "2021-11-08T13:42:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jufajardini](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.suricata.io/jufajardini/32/896_2.png) [@jufajardini](https://forum.suricata.io/u/jufajardini)\
**Post date:** [November 8, 2021, 6:46pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/4 "2021-11-08T18:46:15Z")

</div>

Hey again, thanks for the answer.

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

```auto
ldd your/suricata/bin 

```

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

```auto
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)

---

<div class="post-metadata">

**Author:** ![Victor](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@Victor](https://forum.suricata.io/u/Victor)\
**Post date:** [November 9, 2021, 10:38pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/5 "2021-11-09T22:38:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jufajardini](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.suricata.io/jufajardini/32/896_2.png) [@jufajardini](https://forum.suricata.io/u/jufajardini)\
**Post date:** [November 17, 2021, 12:40pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/6 "2021-11-17T12:40:06Z")

</div>

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:

```auto
./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!

---

<div class="post-metadata">

**Author:** ![Victor](https://avatars.discourse-cdn.com/v4/letter/v/3e96dc/32.png) [@Victor](https://forum.suricata.io/u/Victor)\
**Post date:** [November 18, 2021, 5:21pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/7 "2021-11-18T17:21:47Z")

</div>

Hi Ju,

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

Victor

---

<div class="post-metadata">

**Author:** ![ish](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.suricata.io/ish/32/8_2.png) [@ish](https://forum.suricata.io/u/ish)\
**Post date:** [November 18, 2021, 9:42pm UTC](https://forum.suricata.io/t/lua-5-4-3-and-suricata-undefined-reference-error/1906/8 "2021-11-18T21:42:41Z")

</div>

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.
