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

I'm converting a plugin from an older style nmake version to the newer way of doing Make files. The plugin builds fine on 1.10.7 using the old style system. I have tried following the example at README.plugins with no success. But the new style outputs the below error.

The Makefile.nmake is exactly the same as the gryphon one. My Makefile.common is below Is there some other file that I should be editing to get this to work correctly? What else should I be looking at to troubleshoot this?


PLUGIN_NAME = Fet

DISSECTOR_SRC = \ packet-fet.c

DISSECTOR_INCLUDES = \ omFileReader.h \ fet-helper.h \ fet-tap-stats_tree.h \ typeidHash.h \ fetGenOutput.h

DISSECTOR_SUPPORT_SRC = \ typeidHash.c \ fet-helper.c \ omFileReader.c \ fet-tap-stats_tree.c \ tpdGenOutput.c


Making plugin.c (using python)

No files found

NMAKE : fatal error U1077: 'C:\Python27\python.exe' : return code '0x1'

Stop.

NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10. \VC\BIN\nmake.exe"' : return code '0x2'

Stop.

asked 06 May '14, 16:13

tlann's gravatar image

tlann
76121419
accept rate: 100%

edited 14 May '14, 10:27


The issue comes from not using NONGENERATED_REGISTER_C_FILES in the Makefile.common This tells the python scanner to look in this file for the proto_register function.

permanent link

answered 14 May '14, 10:47

tlann's gravatar image

tlann
76121419
accept rate: 100%

1

Could you explain more how modifying your Makefile.common fixed the problem? I suspect many people who try to update their custom dissectors from an older version will run into this problem.

(13 Aug '14, 09:49) multipleinte...

In the Makefile.common There is a variable for source files called NONGENERATED_C_FILES. The files listed aren't actual dissectors themselves but they are supporting source files listed in here. In this list of files, there should be the MACRO/Variable Expansion thingy called $(NONGENERATED_REGISTER_C_FILES) listed with the source files.
This is three months ago so my memory is a little dim on this but I've looked at the Make files to help figure this out. I believe looking at other plugin files helped me to troubleshoot this. The mate plugin looks like a decent example of this.
So why doesn't anyone vote up answers and questions that are helpful? Shouldn't the correct behavior be promoted?

(13 Aug '14, 10:03) tlann

When updating a plugin dissector to a newer1 version of wireshark, you need to update all of the essential build files for your plugin to use the new style. There are additional changes to the API that will need adjustment in your code, but by making the below changes, you should be able to begin to build your dissectors and work through the changes.

CMakeLists.txt before

set_target_properties(foo PROPERTIES SOVERSION ${CPACK_PACKAGE_VERSION})
set_target_properties(foo PROPERTIES LINK_FLAGS ${WS_LINK_FLAGS})
CMakeLists.txt after
set_target_properties(foo PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(foo PROPERTIES FOLDER "Plugins")

Makefile.am before

INCLUDES = -I$(top_srcdir) -I(includedir)
# ...
foo_la_SOURCES = \
   plugin.c \
   moduleinfo.h \
   $(DISSECTOR_SRC) \
   $(DISSECTOR_SUPPORT_SRC) \
   $(DISSECTOR_INCLUDES)
# ...
plugin.c: $(DISSECTOR_SRC) $(top_srcdir)/tools/make-dissector-reg \
    $(top_srcdir)/tools/make-dissector-reg.py
   @if test -n "$(PYTHON)"; then \
     echo Making plugin.c with python ; \
     $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
         plugin $(DISSECTOR_SRC) ; \
   else \
      echo Making plugin.c with shell script ; \
      $(top_srcdir)/tools/make-dissector-reg $(srcdir) \
          $(plugin_src) plugin $(DISSECTOR_SRC) ; \
   fi
# ...
checkapi:
   $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput $(DISSECTOR_SRC) $(DISSECTOR_INCLUDES)
Makefile.am after
include $(top_srcdir/Makefile.am.inc
AM_CPPFLAGS = -I$(top_srcdir)
# ...
foo_la_SOURCES = \
   plugin.c \
   moduleinfo.h \
   $(SRC_FILES) \
   $(HEADER_FILES)
# ...
plugin.c: $(REGISTER_SRC_FILES) Makefile.common $(top_srcdir)/tools/make-dissector-reg \
    $(top_srcdir)/tools/make-dissector-reg.py
    @if test -n "$(PYTHON)"; then \
        echo Making plugin.c with python ; \
        $(PYTHON) $(top_srcdir)/tools/make-dissector-reg.py $(srcdir) \
            plugin $(REGISTER_SRC_FILES) ; \
    else \
        echo Making plugin.c with shell script ; \
        $(top_srcdir)/tools/make-dissector-reg $(srcdir) \
            $(plugin_src) plugin $(REGISTER_SRC_FILES) ; \
    fi
# ...
checkapi:
   $(PERL) $(top_srcdir)/tools/checkAPIs.pl -g abort -g termoutput -build \
   -sourcedir=$(srcdir) \
   $(CLEAN_SRC_FILES) $(CLEAN_HEADER_FILES)

Makefile.nmake before

CFLAGS=/D_NEED_VAR_IMPORT_ $(CFLAGS)

DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)

DISSECTOR_SUPPORT_OBJECTS = $(DISSECTOR_SUPPORT_SRC:.c=.obj)

OBJECTS = $(DISSECTOR_OBJECTS) $(DISSECTOR_SUPPORT_OBJECTS) plugin.obj # ... !IFDEF PYTHON plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg.py @echo Making plugin.c (using python) @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(DISSECTOR_SRC) !ELSE plugin.c: $(DISSECTOR_SRC) moduleinfo.h ../../tools/make-dissector-reg @echo Making plugin.c (using sh) @$(SH) ../../tools/make-dissector-reg . plugin $(DISSECTOR_SRC) !ENDIF

Makefile.nmake after
CFLAGS=$(CFLAGS)

OBJECTS = $(C_FILES:.c=.obj) $(CPP_FILES:.cpp=.obj) plugin.obj # ... !IFDEF PYTHON plugin.c: $(REGISTER_SRC_FILES) moduleinfo.h ../../tools/make-dissector-reg.py @echo Making plugin.c (using python) @$(PYTHON) "../../tools/make-dissector-reg.py" . plugin $(REGISTER_SRC_FILES) !ELSE plugin.c: $(REGISTER_SRC_FILES) moduleinfo.h ../../tools/make-dissector-reg @echo Making plugin.c (using sh) @$(SH) ../../tools/make-dissector-reg . plugin $(REGISTER_SRC_FILES) !ENDIF

Makefile.common before

PLUGIN_NAME = foo

# the dissector sources (without any helpers) DISSECTOR_SRC = \ packet-foo.c

# corresponding headers DISSECTOR_INCLUDES = \ packet-foo.h

# Dissector helpers. They're included in the source files in this # directory, but they're not dissectors themselves, i.e. they're not # used to generate "plugin.c". DISSECTOR_SUPPORT_SRC = \</code>

Makefile.common after

PLUGIN_NAME = foo

# the dissector sources (without any helpers) NONGENERATED_REGISTER_C_FILES = \ packet-foo.c

NONGENERATED_C_FILES = \ $(NONGENERATED_REGISTER_C_FILES)

# corresponding headers CLEAN_HEADER_FILES = \ packet-foo.h

HEADER_FILES = \ $(CLEAN_HEADER_FILES)

include ../Makefile.common.inc

1: I don't know at what point the change actually happened. In my case, I was updating from 1.8 to 1.99.

permanent link

answered 13 Aug '14, 12:36

multipleinterfaces's gravatar image

multipleinte...
1.3k152340
accept rate: 12%

edited 28 Aug '14, 13:52

This is good information. I think it should go in the wiki.

(13 Aug '14, 13:12) tlann
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×254
×13

question asked: 06 May '14, 16:13

question was seen: 2,650 times

last updated: 28 Aug '14, 13:52

p​o​w​e​r​e​d by O​S​Q​A