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

error building plugin

0

Hi,

I am trying to build a custom dissector as a plugin starting from an existing dissector code, in this case the iec104 dissector (iec104.c). I downloaded the source files for Wireshark and was able to compile the code. As a first test, I just used the existing dissector code of the iec104 protocol without modifications and tried to compile it as a plugin. I followed all the steps as described in this tutorial: http://www.sewio.net/open-sniffer/develop/how-to-compile-your-wireshark-dissector/

Still, I am getting the following errors when compiling the plugin:

ERROR: Cannot determine the location of the VS Common Tools folder.

Microsoft (R) Program Maintenance Utility Version 12.00.21005.1 Copyright (C) Microsoft Corporation. All rights reserved.

    cl  /DWINPCAP_VERSION=4_1_3 /Zi /W3 /MD /O2 /DWIN32_LEAN_AND_MEAN /DMSC_VER_REQUIRED=1800  /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /D_ALLOW_KEYWORD_MACROS /DBUILD_WINDOWS /D_BIND_TO_CURRENT_CRT_VERSION=1 /MP /GS /w34295  /I../.. /Ih:\Documents\DevelopmentWireshark\Wireshark-win32-libs-1.12\gtk2\include\glib-2.0  /Ih:\Documents\DevelopmentWireshark\Wireshark-win32-libs-1.12\gtk2\lib\glib-2.0\include  -DG_DISABLE_DEPRECATED  -DG_DISABLE_SINGLE_INCLUDES  /Ih:\Documents\DevelopmentWireshark\Wireshark-win32-libs-1.12\Wdpack\include -Fd.\ -c packet-iec104.c

Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86 Copyright (C) Microsoft Corporation. All rights reserved.

packet-iec104.c

packet-iec104.c(1810) : error C2099: initializer is not a constant

packet-iec104.c(1810) : warning C4047: 'initializing' : 'const void *' differs in levels of indirection from 'int'

packet-iec104.c(1810) : warning C4047: 'initializing' : 'guint32' differs in levels of indirection from 'char [17]'

packet-iec104.c(1810) : warning C4047: 'initializing' : 'const char *' differs in levels of indirection from 'int'

packet-iec104.c(1810) : warning C4047: 'initializing' : 'int' differs in levels of indirection from 'void *'

packet-iec104.c(1810) : warning C4047: 'initializing' : 'guint32' differs in levels of indirection from 'char [8]'

packet-iec104.c(1810) : warning C4047: 'initializing' : 'guint32' differs in levels of indirection from 'char [7]'

NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 12.0\VC\BI N\cl.EXE"' : return code '0x2'

Stop.

Does anyone know what I’m doing wrong? As i said before, I didn’t even modify the dissector code yet.

Many thanks!

asked 04 Nov ‘15, 14:05

kenny's gravatar image

kenny
6112
accept rate: 0%

edited 04 Nov ‘15, 14:25

grahamb's gravatar image

grahamb ♦
19.8k330206

Presumably your packet-iec104.c is not compatible with your Wireshark version due to some API changes, but without seeing the file content we can only guess.

(05 Nov ‘15, 08:48) Pascal Quantin
1

The question states that they compiled the source code of the dissector successfully in it’s normal place and then moved it to a plug-in.

If changes have been made to packet-iec104.c, then we would need to see them to help further.

(05 Nov ‘15, 08:55) grahamb ♦

I try to do exactly the same thing with another dissector (convert it to plugin and then do my private modifications). I get the same errors.

The initializer that is not a constant is this one : static hf_register_info hf[] = {…

I my case, I couldn’t use tfs_true_false, I had to re-define it manually.

(25 Feb ‘16, 02:24) atsju2

That tutorial is now very dated and it commits a cardinal sin (IMHO) of adding Cygwin to the path.

The issue with tfs_true_false is possibly incorrect export/import of definitions across DLL boundaries of libwireshark and the plugin. Unfortunately I don’t know the solution to that.

(25 Feb ‘16, 05:07) grahamb ♦