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

Hello,

I need to add a new plugin dissector to Wireshark and create a version for windows an linux. Is the source code the same for Windows and Linux ? Can I develop and compil under Windows, then cross compil for linux (or i need to install source code, tools on linux OS, then compil) ?

Edd

asked 13 Nov '13, 06:48

Edd's gravatar image

Edd
11112
accept rate: 0%

edited 13 Nov '13, 07:11

grahamb's gravatar image

grahamb ♦
19.8k330206


Can I develop and compil under Windows, then cross compil for linux (or i need to install source code, tools on linux OS, then compil) ?

I suggest to build it on Linux for Linux, at least if you want to avoid trouble ;-)

Reasons:

You can (somehow) build Wireshark on Windows with the Cygwin gcc toolchain, although even that is kind of a pain in the ... (see link above)

Now, if you really succeed to use the Cygwin gcc toolchain to build Wireshark on Windows (and I'm pretty sure the current release will not build without larger problems), then you may be able to also cross compile a binary for Linux. However that will cause even more trouble, as there is no (ready to use) support for cross compiling on Windows, even if you use Cygwin.

If you use the Microsoft compiler toolchain, there is no support at all for cross compiling a Linux binary, as you can imagine.

So, to sum it up: You might be able to cross compile a Linux binary on Windows, by using the Cygwin gcc toolchain, but that will be much more trouble than installing a Linux distribution in a virtual machine and compile the Linux version there. It's pretty easy on Ubuntu and other Distributions and there are a lot of documents that describe how to do it.

My estimation:

  • Install Linux in a VM and build the Linux Wireshark binary there: 1-2 hours (total)
  • Try to cross-compile a Linux Binary on Windows: 1-2 weeks, if it works at all

Regards
Kurt

permanent link

answered 14 Nov '13, 05:42

Kurt%20Knochner's gravatar image

Kurt Knochner ♦
24.8k1039237
accept rate: 15%

edited 14 Nov '13, 05:50

In general, the source code is generally the same, however differences with platform headers etc. are covered by conditional #if def blocks. Certain other areas (generally GUI stuff and not often found in dissectors) has different code for the various platforms.

I don't know of anyone cross compiling on Windows and targeting Linux, you can certainly develop on Windows, then copy the source over to a Linux environment and build there.

permanent link

answered 13 Nov '13, 06:54

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

Hi Edd,

I had the same problem and did not found a tool that create a linux version from windows. However you can copy the source of your plugin and build there like grahamb said.

For me the most important thing is to have the same version of Wireshark in both OSs

permanent link

answered 14 Nov '13, 02:47

Afrim's gravatar image

Afrim
160101116
accept rate: 22%

Ok, fine I understand.

Thank you

(14 Nov '13, 05:18) Edd
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
×173
×154

question asked: 13 Nov '13, 06:48

question was seen: 3,388 times

last updated: 14 Nov '13, 05:50

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