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

How do I compile Wireshark with Lua and libsmi in Redhat?

0

I tried to compile Wireshark 1.6.8 with Lua and libsmi in RHEL with the below commands, but I'm seeing errors:

$ ./configure --prefix="/home/OPENSOURCE/WIRESHARK/1.6.8/Linux/RHEL4_2.6" \
        --with-lua="/home/OPENSOURCE/LUA/5.1/Linux/RHEL4_2.6" \
        --with-libsmi="/home/OPENSOURCE/LIBSMI/0.4.8/Linux/RHEL4_2.6"

$ make –> After running "make" command, it's hung up with below error "/home/OPENSOURCE/LUA/5.1/Linux/RHEL4_2.6/lib/liblua.a: could not read symbols: Bad value"

I also recompiled Lua and tried again, but no luck…same error.

asked 15 Jun ‘12, 08:26

Mevalal's gravatar image

Mevalal
1111
accept rate: 0%

edited 15 Jun ‘12, 13:56

helloworld's gravatar image

helloworld
3.1k42041


2 Answers:

0
  • is there a file called '/home/OPENSOURCE/LUA/5.1/Linux/RHEL4_2.6/lib/liblua.a'?
  • What is its size?
  • what is the output of this command: nm /home/OPENSOURCE/LUA/5.1/Linux/RHEL4_2.6/lib/liblua.a
  • can you please add a few lines of make output before that last error message.

Regards
Kurt

answered 15 Jun '12, 09:18

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

edited 15 Jun '12, 09:32

Hello, Thanks for your help.

Yes it's called '/home/OPENSOURCE/LUA/5.1/Linux/RHEL4_2.6/lib/liblua.a' and size of it is "326764" bytes Also output of

# nm /home/OPENSOURCE/LUA/5.1/Linux/RHEL4_2.6/lib/liblua.a |more lapi.o: 00000000000017a0 t aux_upvalue 00000000000012f0 t f_call 00000000000013b0 t f_Ccall 00000000000000d0 t getcurrenv 0000000000000000 t index2adr 00000000000000f0 T luaA_pushobject 00000000000001f0 T lua_atpanic 0000000000001280 T lua_call

Regadrs Mevalal

(20 Jun '12, 02:42) Mevalal

0

This is probably the issue you're seeing:

libtool: link:  gcc -shared  -fPIC -DPIC  .libs/libwireshark_la-addr_and_mask.o .libs/libwireshark_la-addr_resolv.o 
[...]
-pthread -Wl,-soname -Wl,libwireshark.so.0 -Wl,-version-script -Wl,.libs/libwireshark.ver -o .libs/libwireshark.so.0.0.0
/usr/bin/ld: /home/tony/src/lua-5.1.5/src/build/lib/liblua.a(lapi.o): relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a shared object; recompile with -fPIC
/home/tony/src/lua-5.1.5/src/build/lib/liblua.a: could not read symbols: Bad value
[...]
make: *** [install] Error 2

The error message was actually quite helpful. It was telling you to recompile liblua.a with the -fPIC compiler flag. Try this:

  1. Open ${lua-5.1}/src/Makefile
  2. Edit CFLAGS (it should be on/near line 11) so that it includes -fPIC. (e.g., CFLAGS=-fPIC -O2 -Wall $(MYCFLAGS))
  3. Save the Makefile.
  4. Recompile liblua (and install it).

You now should be able to finish the linker process in the Wireshark build.

It's easier to use the RHEL package manager.

Before I even tried the above, I played around with installing a Wireshark dev environment on CentOS (a derivative of RHEL). It's simple and painless. I didn't need to build liblua from source as it's already available as a package. The same is true for libsmi. The following commands worked from a fresh install of a CentOS VM:

#!/bin/sh
########################################################################
# This script installs the tools necessary for Wireshark development.
# If the tools are already installed, the package manager is smart
# enough to not re-install.
########################################################################

Install build tools (gcc, gdb, flex, etc.)

sudo yum install 'Development Tools'

Required packages (any dependencies get pulled in automatically)

sudo yum install gtk2-devel.x86_64 libpcap-devel.x86_64

Optional packages

sudo yum install lua-devel.x86_64 libsmi-devel.x86_64

Note that the package manager only has Lua 5.1.4 available. If you need any other version (such as 5.1.5), you’ll have to build from source as you were doing earlier.

answered 15 Jun ‘12, 19:26

helloworld's gravatar image

helloworld
3.1k42041
accept rate: 28%

edited 15 Jun ‘12, 20:59

Thanks for your Help I have recompile LUA - with your provided option, LIBSMI and wireshark. Now it’s working fine.

(21 Jun ‘12, 04:17) Mevalal