Wireshark-dev: [Wireshark-dev] Bug #5292: MacOSX and linking

From: "Babikyan, Armen - 0663 - MITLL" <armenb@xxxxxxxxxx>
Date: Tue, 12 Oct 2010 15:09:35 -0400
  Hi,

I think I jumped the gun and filed bug report #5292 without completely 
understanding what's going on.  I have some questions:

On MacOSX, it seems that the libraries that are included with the 
Wireshark.dmg installer from wireshark.org are not properly linked.  
When running otool -L on them (e.g. libwireshark.dylib), the library 
thinks it's "id" (the second line in the output) is 
/usr/local/lib/libwireshark.dylib rather than 
/Applications/Wireshark.app/Contents/Resources/lib/libwireshark.dylib.  
If libwireshark.dylib is not being dlopen()'ed, how is 
Contents/MacOS/Wireshark being able to load libwireshark.dylib without 
encountering an error?  Is there an implicit environment variable being 
set somewhere?  I am relatively new at developing for MacOSX.

You may be question the reason for why I am interested in this.  I 
developed a GPLv2 tool for Linux that allows Wireshark's packet 
dissection engine to be used in high-level interpreted programming 
languages (Python and Matlab in particular) to extract vectors of packet 
information for subsequent post-processing and analysis.  I have ported 
the tool to MacOSX, but since I link with libwireshark, libwiretap, 
libwsutil directly, I'd rather link with existing copies of the library 
on my installation target rather than distribute Wireshark libraries 
with my tool.  With respect to the above problem, I was unable to load 
Wireshark.app's libraries unless I ran "install_name_tool -id" and 
"install_name_tool -change" on each library that comes with Wireshark.app.

Any insight is greatly appreciated.  Thanks!

Armen

-- 
Armen Babikyan
MIT Lincoln Laboratory
armenb@xxxxxxxxxx . 781-981-1796