Source code compilation for Wireshark plug-in development in Windows

Source: Internet
Author: User
Tags posix

If you want to build a Wireshark protocol parsing plug-in, you can solve the problem of custom protocol parsing in your work.

Okay, let's talk about it. Start working.

 

First, check the information on the Internet. To develop a plug-in Environment in Windows, you need:

1. The C/C ++ compiling environment in Windows is required. Well, I have installed vs2008. You can use it.

2. Install cygwin.

Download it at http://www.cygwin.cn. The download is only a setup.exe.

Interface after running

Download without installing, which is selected first, is downloaded to the local device for future use. When downloading ^_^, I chose all the components and there will be 1.25 GB after the download... Next night (=. = !)

The second time you run setup.exe, select install from local directory. During installation, do not select all.

Some components are required for Wireshark installation, but are not installed by default. Change the installation options.

3. Python needs to be installed. cygwin also comes with it, but Wireshark also said, not recommend.

I installed Python 3.1 first. during compilation, I always indicated that I could not find it. Finally, I installed Python 2.6.

Makefile. nmake is written in the root directory of Wireshark source code. We still need to follow the matching version.

After the environment is ready, modify the parameters in the makefile. nmake file. Make sure to back up the parameters before modification ~

Specific process can refer to: http://blog.csdn.net/hcj2002/archive/2008/04/06/2255637.aspx

 

My environment:

Cygwin installation path: D:/cygwin version: cygwin1.7.1

Wireshark source code: D:/wireshark-1.3.2

Vs2008 installation path: D:/program files/Microsoft Visual Studio 9.0

Python2.6 installation path: D:/python26

 

Wirshark encountered the following problems during compilation.

Problem 1: The win-setup.sh cannot be found.

D:/wireshark-1.3.2> nmake-F makefile. nmake verify_tools

Microsoft (r) program maintenance utility 9.00.21022.08
Copyright (c) Microsoft Corporation. All rights reserved.

Cygwin warning:
MS-DOS style path detected: Tools/win32-setup.sh
Preferred POSIX equivalent is: Tools/win32-setup.sh
Cygwin environment variable option "nodosfilewarning" turns off this warning.
Consult the User's Guide for more details about POSIX paths:
Http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Tools/win32-setup.sh: line 12: Exec: Tools/win-setup.sh: not found
Tools/win32-setup.sh: line 12: Exec: Tools/win-setup.sh: not found
Nmake: Fatal error u1077: "D:/cygwin/bin/bash. EXE": return code "0x7f"
Stop.

D:/wireshark-1.3.2>

 

This problem has been around for a long time. Later I found the wireshark bug =. =!

Wireshark bug database-bug 4359 https://bugs.wireshark.org/bugzilla/show_bug.cgi? Id = 4359

This version 1.3.x uses cygwin 1.5.x to 1.7.x to handle the issue of MS-dos paths.

The solution is as follows:

Changing the win_setup = line in the main makefile. nmake file to use a POSIX
Style forward slash path delimiter instead of using a Win32 style backslash
Delimiter resolves the nmake problem:

E.g.

>-Win_setup = tools/$ (wireshark_target_platform)-setup. Sh
> + Win_setup = tools/$ (wireshark_target_platform)-setup. Sh
However, win_setup = is not found in the makefile. nmake file.

I directly modified win_setup = 'echo $0 | sed-E S/Win32/win/'in the source code tools/win32-setup.sh file into win_setup = tools/win-setup.sh

Question 2: several files in/Microsoft. vc90.crt/*. * cannot be found.

After compiling the file, the following error occurs: xcopy C:/program files/Microsoft Visual Studio 9.0/VC/redist/$ (vcredist_dll)/Microsoft. vc90.crt/*. * failed. The file cannot be found.

My vs2008 is installed on the d disk.

Search for makefile. nmake and find this line.

Msvcr_dll =$ (program_files)/Microsoft Visual Studio 9.0/VC/redist/$ (vcredist_dll)/Microsoft. vc90.crt /*.*

The definition of program_files in makefile. nmake is program_files = $ (ProgramFiles)

Execute set pro in the CMD command line and find the result as follows:

D:/wireshark-1.3.2> set pro
Processor_architecture = x86
Processor_identifier = x86 family 6 model 23 stepping 10, genuineintel
Processor_level = 6
Processor_revision = 170a
Programdata = C:/programdata
ProgramFiles = C:/Program Files
Prompt = $ p $ G

D:/wireshark-1.3.2>

Er ~ This must be an error...

No matter.

Msvcr_dll =$ (program_files)/Microsoft Visual Studio 9.0/VC/redist/$ (vcredist_dll)/Microsoft. vc90.crt /*.*

Change

Msvcr_dll = D:/program files/Microsoft Visual Studio 9.0/VC/redist/$ (vcredist_dll)/Microsoft. vc90.crt /*.*

 

Run nmake-F makefile. nmake verify_tools.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.