Wireshark-dev: Re: [Wireshark-dev] #include <gcrypt.h> in plugin development

From: Ivan Lawrow <ivan.lawrow@xxxxxxxxxx>
Date: Mon, 12 Jul 2010 10:21:05 +0100
 Ivan Lawrow wrote:
I'm developing a plugin that requires use of the encryption library functions in <gcrypt.h> - this file is included in several of the epan dissectors. I can successfully build Wireshark 1.2.8 and 1.3.5 and my plugin without <gcrypt.h> included in the plugin source code. However, when I include <gcrypt.h> in the plugin source code the compiler can't locate it so I guess its a plugin makefile issue.
Has any one encountered this issue before and suggest how to resolve it?

Are you on *NIX or Windows?

On *NIX if your gcrypt.h is not someplace obvious (like /usr/include/) you probably need to add something like:

INCLUDES = -I$(srcdir)/../.. -I$(srcdir)/.. \
        $(LIBGNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS)

to your plugin's Makefile.am . (The above example is from epan/dissectors/Makefile.am .)

I suppose Windows may have something similar.


Compile and link by modifying the plugin's Makefile.nmake file (I'm working on WIN32 - the plugin's Makefile.am file isn't part of the plugin compile process) as follows:

1. Add $(GNUTLS_CFLAGS) to the CFLAGS line, e.g.:

CFLAGS=/WX /DHAVE_CONFIG_H /I../.. /I../wimax $(GLIB_CFLAGS) $(GNUTLS_CFLAGS) \
    /I$(PCAP_DIR)\include -D_U_="" $(LOCAL_CFLAGS)

2. Add $(GNUTLS_LIBS) to the $(PLUGIN_NAME).dll line, e.g.:

$(PLUGIN_NAME).dll $(PLUGIN_NAME).exp $(PLUGIN_NAME).lib : $(OBJECTS) $(LINK_PLUGIN_WITH) $(RESOURCE) link -dll /out:$(PLUGIN_NAME).dll $(LDFLAGS) $(OBJECTS) $(LINK_PLUGIN_WITH) \
    $(GLIB_LIBS) $(GNUTLS_LIBS) $(RESOURCE)

--
Ivan Lawrow - Design Engineer
Dir : +44 (0)114 2814505
_____________________________________________________

Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
Tel : +44 (0)114 2812655
Fax : +44 (0)114 2812951
Web : http://www.jennic.com
Confidential
_____________________________________________________