ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] RPM and inter-plugin dependencies

From: Evan Huus <eapache@xxxxxxxxx>
Date: Fri, 30 Nov 2012 13:36:41 -0500

On Fri, Nov 30, 2012 at 1:19 PM, Austin Albright <chuckbubba777@xxxxxxxxxxx> wrote:
-- Alex --
It has only one library dependency, that isn't a fundamental part of Wireshark... sort of... which is the wimax plugin library (wimax.so)

When I run ldd on the customPlugin.so on my development system and then on the version installed via RPM on the production system the results are identical.

This is odd - if wimax.so is listed in the output of ldd then the linker should pull in the wimax plugin when yours is loaded, and should be able to resolve the symbol. If you list the symbols exported in wimax.so is get_tlv_value_offset among them?
 
-- Japp --
It is a detailed error message that tells the exact function it can't seem to find.  Which is what leads me to think it can't see\access the wimax.so plugin library.  The error message is:

Couldn't load module /usr/lib/wireshark/plugins/1.6.9pre1_42613/customPlugin.so: /usr/lib/wireshark/plugins/1.6.9pre1_42613/customPlugin.so: undefined symbol: get_tlv_value_offset

Where get_tlv_value_offset only exist in the wimax plugin (wimax_tlv.c\h).

For some reason, when I began creating this plugin I thought 1.6.8/9 was the last release of the 1.6 trunk.  I never even thought to check for updates until I checked the mailing li st to see if my message went through and there was announcement about the latest release/updates to the 1.6 trunk.

-- New thought\question --
Should I add something akin to a target_link_libraries in the CMakeList.txt pointing to the wimax plugin's library?  But then I wonder how it ever compiled if it need that to be specified in the CMakeList file?

Since wimax.so is already listed by ldd it sounds like you're already linking against the wimax plugin...

Plugins are built as shared libraries (.so files) such that external symbols are not resolved at link time. You could call a non-existent function my_imaginary_function() and it will still compile as long as you've declared a prototype for it, even if there is no definition of it anywhere.
 
The problem seems related to the RPM compilation\build process.  But since everything is re-built to create the RPM and I receive no warnings about an undefined function during the RPM's compilation stage...

It's possible that the RPM build is stricter about stripping symbols than the default in-tree build. Perhaps you need to add get_tlv_value_offset to a list of exported symbols somewhere? (not too familiar with RPM, sorry)
 
Thank you Alex and Japp for your suggestions.
Austin


From: jaap.keuter@xxxxxxxxx
Date: Fri, 30 Nov 2012 21:44:53 +0400
To: wireshark-dev@xxxxxxxxxxxxx
Subject: Re: [Wireshark-dev] RPM and inter-plugin dependencies


Hi Austin, 

Forget about the #include. That 's for the compiler to know which file to include in the compilation. This has nothing to do with the object code you're distributing. 

You state that there's a detailed error message, but you never quote it. What does it tell you?

trunk-1.6 SVN head now is version 1.6.12 now (rolled over to 1.6.13 already)

Thanks,
Jaap

Send from my iPhone

On 30 nov. 2012, at 18:43, Austin Albright <chuckbubba777@xxxxxxxxxxx> wrote:


Wireshark Gurus,

First things, first...
My development system is RHEL v5.6 and as it doesn't support a "new" enough version of GTK, my work uses the v1.6.9 SVN head.

That said, I have created my own plugin, it builds and works great on the system I've developed it on.  However, when I build the RPM, and install the RPM on another machine (identical to my development system minus all the source code) I always get a "couldn't load module" error.  The error message is quite detail and so I know it is because my plugin is using some common functions from the wimax plugin (i.e. wimax_tlv.c).

I include the wimax_tlv.h in my source as follows:
#include <plugins/wimax/wimax_tlv.h>

While grasping at straws I even tried:
#include "plugins/wimax/wimax_tlv.h"

Neither #include format made a difference.  My build of Wireshark worked regardless on my development system and gave the same exact "couldn't load module" error on the production system.

I don't get any warnings or complaints about the "#include <plugins/wimax/wimax_tlv.h>" on my development system when compiling or building the RPM, but it sure seems to have a problem with it on the production system.

One other notable thing is that on my development system when I start Wireshark and look at the plugins listing (Help->About->Plugins) my plugin is listed, but on the production system where Wireshark was installed using my RPM, it is not listed in the plugins listing.  I followed the directions for creating and including a plugin in README.plugin, but obviously I've missed something.  Also, my plugin library does get placed in /usr/lib/wireshark/plugin/<version>/ on the production system when I install my RPM.

I really don't want to have a redundant copy of the code in my custom plugin's directory so that I won't have to worry about merging corrections\updates.  I even grep'ed my entire Wireshark directory on my development system looking for another dissector or plugin that included a header from another plugin\dissector and found one (gtk/voip_calls.c) which contains a #include of a header from a dissector (gtk/voip_calls.c:60:#include <plugins/unistim/packet-unistim.h>).  So it seems like what I'm doing should work, but clearly I'm in over my head.  Any suggestions would be much appreciated.

Thanks,
Austin
___________________________________________________________________________
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
            m ailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe

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

___________________________________________________________________________
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