This is a static archive of our old Q&A Site. Please post any new questions and answers at ask.wireshark.org.

Running Wireshark with lua-devel 5.3

1

I've been trying to port my dissector to Linux and ran into an issue. The problem is that the only version of lua-devel I can install is 3.0 and higher, which does not compile with Wireshark. It always breaks on the same file, lua_bitop.

I've been trying to install an older version of lua-devel, version 5.2.2. I can't uninstall lua 5.3 because other packages are dependant on it, and I can't install lua 5.2.2 because rpm wants me to have the newest version.

Is there a way I can install both versions? Or is there a better workaround to get lua 5.3 compiling?

asked 16 Jul '15, 12:44

broccollirob's gravatar image

broccollirob
754411
accept rate: 0%


One Answer:

2

Wireshark can't be compiled with Lua 5.3. Even if the Lua Bitop library was modified to be able to compile/work with Lua 5.3, and whatever else in Wireshark that breaks with Lua 5.3 was fixed, we wouldn't be able to guarantee Lua scripts written by others would work in a Lua 5.3 engine; nor that scripts written on a Lua 5.3-based Wireshark would work in other people's Wireshark programs running Lua 5.2. (the Wireshark binaries shipped for MS-Windows and Mac-OSX are built with Lua 5.2)

If you don't care about compatibility with others, then you could comment out the loading/compiling of the Bitop library (lua_bitop.c). To do that, grep for "lua_bitop" and remove the matching lines from the epan/wslua/Makefile.am or epan/wslua/CMakeLists.txt, depending on whether you use autotools or cmake; and from epan/wslua/make-reg.pl remove the line matching "lua_bitop" as well as the line with "luaopen_bit" in it (and the lua_pop line after it).

If you do care about compatibility, then you could download the source code for Lua 5.2 into some directory and build it, then point Wireshark to look in that directory; if you're building with autotools, then during the configure stage you can set the path with the configure option '--with-lua=/path/to/lua".

Or if you don't care about the Lua stuff at all, you can build wireshark without it.

BTW, what exact operating system are your running, for which there is no RPM of an older Lua version available?

Edit: I should mention there's bug 10881 for this issue as well.

answered 16 Jul '15, 13:49

Hadriel's gravatar image

Hadriel
2.7k2939
accept rate: 18%

edited 16 Jul '15, 13:52

The OS is a Fedora VM that I just created. There is an older RPM, the issue is that it won't let me install it because 5.3 is newer and already installed. And I can't uninstall 5.3 because there are dependencies on it.

Anyways, the only dissectors I've added are in C/C++, so I'll be able to disable Lua without losing any functionality, correct?

(17 Jul '15, 05:06) broccollirob
1

Correct, you don't need Lua compiled in if you don't plan to write or use a Lua plugin. (and no Lua plugins come bundled with Wireshark)

It's unfortunate about the RPMs - they shouldn't have treated Lua 5.3 as just a newer revision/replacement for Lua 5.2. It's much more like Python 2.x vs. Python 3; or GTK-2 vs. GTK-3. The RPMs should support installing both at the same time, under different names/directories. The Lua development team has always treated both the major and minor number to be the language version, with no API/ABI compatibility. There's a third number really that represents the revision (i.e., it's really currently Lua 5.3.1, and Lua 5.2.4, and Lua 5.1.5).

(17 Jul '15, 05:19) Hadriel

OK, so I followed your instructions and removed the lines referencing lua_bitop.c, but Wireshark is still having errors building the lua stuff. Heres the error, do you have any idea about what's happening now?

checking whether to use liblua for the Lua scripting plugin... yes

checking Lua version... Lua 5.2

checking lua.h usability... yes

checking lua.h presence... yes

checking for lua.h... yes

checking lualib.h usability... yes

checking lualib.h presence... yes

checking for lualib.h... yes

checking lauxlib.h usability... yes

checking lauxlib.h presence... yes

checking for lauxlib.h... yes

checking for luaL_openlibs in -llua... no

checking for luaL_openlibs in -llua5.2... no

configure: error: Linking with liblua failed.

error: Bad exit status from /var/tmp/rpm-tmp.e6jbgN (%prep)

RPM build errors:

Bad exit status from /var/tmp/rpm-tmp.e6jbgN (%prep)

Makefile:4500: recipe for target 'rpm-package' failed

make: *** [rpm-package] Error 1

(17 Jul '15, 08:57) broccollirob
1

Yeah, I guess I'm not too surprised other stuff would break. The API changed with Lua 5.3.

But I thought you were just going to compile without Lua, no? To do that, if you're using autotools to compile then in your configure step do "./configure --without-lua" (at least I think that's the right option switch). If you're using cmake then it's "cmake -DENABLE_LUA=OFF ../<Name_of_WS_source_dir>".

(17 Jul '15, 09:11) Hadriel

I now realize this comment was confusing because I was trying to do both at once, in seperate install directories to see which would work.

But anyways --without-lua was exactly what I need, thank you

(17 Jul '15, 09:23) broccollirob

OK one last time, when I try to make rpm-package it is still trying to use lua:

checking zlib.h usability... yes

checking zlib.h presence... yes

checking for zlib.h... yes

checking for inflatePrime... yes

checking for inflatePrime missing when linking with X11... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for LUA... no

checking for the location of lua.h... /usr/include

checking the Lua version... 5.3 - disabling Lua support

configure: error: Lua support was requested, but is not available

error: Bad exit status from /var/tmp/rpm-tmp.fqKwaA (%prep)

RPM build errors: Bad exit status from /var/tmp/rpm-tmp.fqKwaA (%prep) Makefile:4274: recipe for target 'rpm-package' failed

(17 Jul '15, 09:50) broccollirob
1

I don't know anything about building Wireshark to an RPM package - maybe it has "issues". (you are actually trying to build it into an RPM package, as opposed to just compiling it for your own system use, right?)

You could also try "./configure --with-lua=no" which should behave the same as "./configure --without-lua", but maybe it doesn't. But building it to be an RPM might have problems with ignoring Lua, for all I know. You might want to submit a bug on bugs.wireshark.org.

(17 Jul '15, 10:21) Hadriel

Yeah I need an rpm so I can distribute it. --with-lua=no does the same thing as --without-lua, I think I'm going to have to make a new vm and avoid lua 5.3 like the plague

Thanks for you help though

(17 Jul '15, 10:45) broccollirob

IIRC the RPM build process isn't going to follow what ./configure options you gave--it's going to follow the ./configure options in packaging/rpm/SPECS/wireshark.spec{,.in} . So you need to edit that file (to add "--without-lua") and then do "make rpm-package".

(17 Jul '15, 15:51) JeffMorriss ♦
showing 5 of 9 show 4 more comments