Wireshark-dev: Re: [Wireshark-dev] Lua linkage with CMake

From: Tony Trinh <tony19@xxxxxxxxx>
Date: Fri, 24 Aug 2012 18:52:09 -0400
It's possible that ${wireshark-src}/cmake/modules/FindLUA.cmake is not properly detecting Lua 5.2 on your system. Check the path defined by LUA_LIBRARY (and check LUA_INCLUDE_DIR while you're at it), using these commands:

   $ cd ${wireshark-src}
   $ cmake -LA | grep LUA

The output should look something like this:

ENABLE_LUA:BOOL=ON
LUA_INCLUDE_DIR:PATH=/Users/tony/src/lua-5.2.1/src/build/include
LUA_LIBRARIES:STRING=/Users/tony/src/lua-5.2.1/src/build/lib/liblua.a
LUA_LIBRARY:FILEPATH=/Users/tony/src/lua-5.2.1/src/build/lib/liblua.a

You can either fix the detection script, or manually edit your path variables (I use `ccmake`):
  1. Enter the CMake configuration with: $ ccmake .
  2. Press 't' to toggle "Advanced mode" (to show the advanced variables)
  3. Verify (and edit) LUA_INCLUDE_DIR, LUA_LIBRARIES, and LUA_LIBRARY. For the library paths, enter the full path to liblua.a for Lua 5.2.
-Tony


On Fri, Aug 24, 2012 at 6:17 PM, Evan Huus <eapache@xxxxxxxxx> wrote:
Hi all,

I recently attempted to switch from autotools to cmake for building
wireshark, but for some reason cmake won't link liblua properly:

lib/libwireshark.so: undefined reference to `lua_tonumber'
lib/libwireshark.so: undefined reference to `lua_call'
lib/libwireshark.so: undefined reference to `lua_pcall'
lib/libwireshark.so: undefined reference to `luaL_loadfile'
lib/libwireshark.so: undefined reference to `luaL_register'

If I compile with VERBOSE=1, the failing gcc command is:

/usr/bin/gcc   -O2 -g -Wall -W -Wextra -Wendif-labels -Wpointer-arith
-Warray-bounds -Wcast-align -Wformat-security -fexcess-precision=fast
-Wdeclaration-after-statement -Wno-pointer-sign -Wold-style-definition
   -Wl,--as-needed CMakeFiles/dftest.dir/dftest.c.o
CMakeFiles/dftest.dir/ui/util.c.o  -o dftest -rdynamic
-L/home/eapache/Desktop/wireshark/ui/gtk
-L/home/eapache/Desktop/wireshark/ui/qt
-L/home/eapache/Desktop/wireshark/codecs
-L/home/eapache/Desktop/wireshark/epan
-L/home/eapache/Desktop/wireshark/wiretap
-L/home/eapache/Desktop/wireshark/wsutil lib/libwireshark.so -lpcap
-lcares -lkrb5 -llua5.2 -lGeoIP -lgcrypt -lgpg-error -lgnutls -lsmi
-lz -lm lib/libwiretap.so -lgmodule-2.0 -lrt -lz lib/libwsutil.so
-lglib-2.0 -Wl,-rpath,/home/eapache/Desktop/wireshark/ui/gtk:/home/eapache/Desktop/wireshark/ui/qt:/home/eapache/Desktop/wireshark/codecs:/home/eapache/Desktop/wireshark/epan:/home/eapache/Desktop/wireshark/wiretap:/home/eapache/Desktop/wireshark/wsutil:/home/eapache/Desktop/wireshark/lib:

The switch "-llua5.2" does exist in the above line, and is the correct
switch, so I guess it's just not late enough in the list of libraries.
Knowing nothing about cmake, I thought I'd ask here - where should I
be looking to figure out what's gone wrong? Autotools builds (and
links with liblua) correctly.

Thanks,
Evan
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe