Wireshark-dev: Re: [Wireshark-dev] capinfos library issue when run from build dir (Unix)
From: Jeff Morriss <[email protected]>
Date: Thu, 17 Jan 2008 14:46:39 -0500

Jeff Morriss wrote:

Stephen Fisher wrote:
Is it just my machine, or are others getting library not loaded errors
when running capinfos on Unix from the build directory -without- having
Wireshark installed at all?  I just noticed it is displaying messages
like this for each of the plugins before displaying the help message:

[email protected]:/usr/local/src/wireshark>./capinfos capinfos: Couldn't load module /usr/local/src/wireshark/plugins/agentx/.libs/agentx.so: dlopen(/usr/local/src/wireshark/plugins/agentx/.libs/agentx.so, 10): Library not loaded: /usr/local/lib/libwireshark.0.dylib Referenced from: /usr/local/src/wireshark/plugins/agentx/.libs/agentx.so
  Reason: image not found

These messages do not appear when Wireshark is installed.  This is
happening only with capinfos and with all 5 of my build environments
(0.99.6 from tarball, a clean SVN, SVN w/ GTK1.2, SVN w/ GTK+OSX, and
SVN that I develop new code on).  Yes, 5 build environments take up a
lot of space :)
I just happened to be installing a new system today (and building 
Wireshark to see how fast it'll build ;-)) and I did not see this problem:
chopin [~/Projects/wireshark/source/]> ./capinfos Capinfos 0.99.8
Prints information about capture files.
See http://www.wireshark.org for more information.
[...]
chopin [~/Projects/wireshark/source/]> rpm -qa|grep wireshark
chopin [~/Projects/wireshark/source/]>
Then again, maybe not...  I happened to run it today on a Solaris system 
(with Wireshark installed) and noticed:
pontiac [~/wireshark/source_SunOS/]> ./capinfos
capinfos: Couldn't load module /u/morriss/wireshark/source_SunOS/plugins/irda/.libs/irda.so: ld.so.1: capinfos: fatal: relocation error: file /usr/local/lib/libwireshark.so.0: symbol getservbyport: referenced symbol not found
capinfos: Couldn't load module /u/morriss/wireshark/source_SunOS/plugins/enttec/.libs/enttec.so: ld.so.1: capinfos: fatal: relocation error: file /usr/local/lib/libwireshark.so.0: symbol getservbyport: referenced symbol not found
editcap also generated the same complaint.

One problem is that libwireshark uses getservbyport() (which is in libsocket on Solaris) but it does not link against libsocket. I fixed that in rev 24121.
...

After a while, I finally figured out why capinfos and editcap are even loading the plugins in the first place: there is now the concept of a wiretap plugin. Problem was that capinfos and editcap were not linked against libwireshark. I just fixed that in rev 24123.
Hopefully that's all the issues there.  (Well, I really wanted to create 
a "libwireshark_libs" variable in "Makefile.am" that listed all the 
things a program that links against libwireshark has to link against but 
it didn't seem to work...)