I'm trying to build a 64bit version of Wireshark, but I cannot complete the compilation because I have some errors, among which the first is
I know that I have probably not set some option for the x64 compiling, but I cannot find where. Here you have the steps I do, following the Wireshark Developers' Guide:
Note: this Copied_script that I put there is the script taken from the guide, that I have modified as follow:
In practice,I’ve just deleted some parts, and corrected the paths.
Furthermore I have this 2 errors:
Cuold someone please help me? asked 01 Aug ‘14, 07:55 francesco_bi… edited 01 Aug ‘14, 08:54 grahamb ♦ |
One Answer:
This looks like an x86 version of QT. I don't know if the QT downloads have a Windows x64 version for VS2010. I can't see one in the list anyway, it seems you need at least VS2012 for an x64 version of QT. You might also want to follow the Developers Guide exactly as written. Any modifications you make are likely to cause you issues. answered 01 Aug '14, 09:00 grahamb ♦ showing 5 of 27 show 22 more comments |
I removed all the references to Qt, in order to build just a GTK version of wireshark. I've done this by commenting out the Qt_base_dir variable in config.nmake, and in the Copied_script. It seems that's enough, because when I run nmake verify_tools, I get the answer "Qt not found". Now I still have a LNK problem:
inffasx64.obj : fatal error LNK 1112: module machine type 'x86' conflicts with target machine type 'x64'.
To help you help me, I found a hint: I modified the Copied_script, and now I use exactly the one given in the step-by-step guide (except that I removed the declaration for Qt variable). I have noticed that it doesn't take the road of x64 compilation! Probably there is still something somewhere set to target x86, but unfortunately I don't know what to modify to make work correctly. Can you suggest what to modify?
It would help if you gave the context for the link problem, but in general wrong machine type errors indicate the object file has been compiled with one architecture and you're trying to link it as another. This can come about if you have previously compiled as x86 and haven't done a "clean" (and then double check with
del /s *.obj
) to remove all old object files.I haven't done any x86 build, my first attempt was a x64 build! What context should I give you to make the problem clearer? I saw that when I call the batch script, which begins with
if "%1" == "" goto x86
if /i %1 == x86 goto x86
if /i %1 == x64 goto x64
goto usage
the program takes the x86 way! Why? I set the environment variable WIRESHARK_TARGET_PLATFORM=win64, and I used the SetEnv.cmd with the /x64 option, in fact, in the top of the command line there's written "Targeting Windows 7 x64 Release". Should I modify/have modified anything else?
I don't even know what do those "%1" or /I mean. Are they variable? Where are they declared? How can I find/change them?
Context as in what were the preceding lines of output before the error occurred.
%1
in a batch file denotes the first parameter passed into the batch file, the/i
option toif
indicates a case insensitive comparison. The batch files assumes that with no parameter an x86 build is desired. To get an x64 build you must pass a parameter of "x64".I'm not particularly happy with that batch file as it does things that are, IMHO, unnecessary such as adding things to the path which are already done by the makefiles.
FWIW my version (for VS2010 x86 is):
REM Environment setup for Wireshark set CYGWIN=nodosfilewarning set WIRESHARK_BASE_DIR=E:\Wireshark set WIRESHARK_TARGET_PLATFORM=win32 set QT5_BASE_DIR=C:\qt\Qt-5.1.1-MSVC2010-win32-ws set VisualStudioVersion=10.0 set WIRESHARK_VERSION_EXTRA=-GMB
Note that I also run my version in a command prompt from the start Menu "[Microsoft ]Visual Studio xxxx" | "Visual Studio Tools" | "Visual Studio .... Command Prompt" which sets the correct Visual Studio command line environment. This saves working out whether to call the SDK SetEnv.Cmd, or the VS vcvars32.bat or the vcvarsall.bat
so I post some of the output I had when trying to compile.
OUTPUT OF: nmake -f Makefile.nmake verify_tools
Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v7.1. Targeting Windows 7 x64 Release
C:\Windows\System32>cd C:\Development\wireshark
C:\Development\wireshark>nmake -f Makefile.nmake verify_tools
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
Can't find Qt. This will become a problem at some point. Checking for required applications: cl: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/cl link: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/link nmake: /cygdrive/c/Program Files (x86)/Microsoft Visual Studio 10.0/VC/Bin/amd64/nmake bash: /usr/bin/bash bison: /usr/bin/bison flex: /usr/bin/flex env: /usr/bin/env grep: /usr/bin/grep /usr/bin/find: /usr/bin/find peflags: /usr/bin/peflags perl: /usr/bin/perl C:\Python27\python.exe: /cygdrive/c/Python27/python.exe sed: /usr/bin/sed unzip: /usr/bin/unzip wget: /usr/bin/wget
C:\Development\wireshark>
OUTPUT OF: nmake -f Makefile.nmake setup Obviously it was much longer, but all the modules had more or less this output
*** WinSparkle-0.3-44-g2c8d9d3-win64ws.zip *** No HTTP proxy specified (http_proxy and HTTP_PROXY are empty). Downloading WinSparkle-0.3-44-g2c8d9d3-win64ws.zip into '/cygdrive/c/Development/wireshark/Wireshark-win64-lib s', installing into . File 'WinSparkle-0.3-44-g2c8d9d3-win64ws.zip' already there; not retrieving.
Extracting '/cygdrive/c/Development/wireshark/Wireshark-win64-libs/WinSparkle-0.3-44-g2c8d9d3-win64ws.zip' int o '/cygdrive/c/Development/wireshark/Wireshark-win64-libs/.' Verifying that the DLLs and EXEs in . are executable.
Wireshark is ready to build.
OUTPUT OF: nmake -f Makefile.nmake distclean This was longer too, but it was all similar to these lines
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
C:\Development\wireshark>
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
Can't find Qt. This will become a problem at some point. Verifying library package files ...
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
Can't find Qt. This will become a problem at some point.
Wireshark is ready to build. sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1/ -e s/@[email protected]/99/ -e s/@VERSION_MICRO @/0/ -e "s/@HA[email protected]/#define HAVE_C_ARES 1/" -e "s/@HA[email protected]//" -e "s/@HA[email protected]//" -e "s/@HAVE_ [email protected]/#define HAVE_LIBZ 1/" -e "s/@HA[email protected]/#define HAVE_LIBPCAP 1/" -e "s/@HA[email protected]/#def ine HAVE_PCAP_FINDALLDEVS 1/" -e "s/@HA[email protected]/#define HAVE_PCAP_DATALINK_NAME_TO_VAL 1 /" -e "s/@HA[email protected]/#define HAVE_PCAP_DATALINK_VAL_TO_NAME 1/" -e "s/@HAVE_PCAP_DATALI [email protected]/#define HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION 1/" -e "s/@HA[email protected]//" -e " s/@HA[email protected]/#define HAVE_REMOTE 1/" -e "s/@HA[email protected]/#define HAVE_PCAP_REMOTE 1/" -e "s/@HAVE_PC [email protected]/#define HAVE_PCAP_OPEN 1/" -e "s/@HA[email protected]/#define HAVE_PCAP_OPEN_DEAD 1/" -e "s/@HAVE_ [email protected]/#define HAVE_PCAP_LIST_DATALINKS 1/" -e "s/@HA[email protected]/#define HAVE_PCAP_ FREE_DATALINKS 1/" -e "s/@HA[email protected]/#define HAVE_PCAP_SET_DATALINK 1/" -e "s/@HAVE_PCAP_SETSAM [email protected]/#define HAVE_PCAP_SETSAMPLING 1/" -e "s/@HA[email protected]/#define HAVE_BPF_IMAGE 1/" -e "s/@HAVE_LIBGN [email protected]/#define HAVE_LIBGNUTLS 1/" -e "s/@HA[email protected]/#define HAVE_LIBGCRYPT 1/" -e "s/@HA[email protected]/#define HAVE_LUA 1/" -e "s/@HA[email protected]/#define HAVE_LUA 1/" -e "s/@HA[email protected]/#define HAVE_AIRPCAP 1/" -e "s/@HAV [email protected]//" -e "s/@HA[email protected]/#define HAVE_LIBPORTAUDIO 1/" -e "s/@[email protected]//" -e "s/@HA [email protected]/#define HAVE_LIBSMI 1/" -e "s/@HA[email protected]/#define HAVE_GEOIP 1/" -e "s/
/@[email protected]/#define HAVE _GEOIP_V6 1/" -e "s/@[email protected]/#define HAVE_SOFTWARE_UPDATE 1/" -e "s/@[email protected]/#define INET6 1/" -e "s/@[email protected]/#define HAVE_NTDDNDIS_H 1/" -e "s/@[email protected]/#define PCAP_NG_DEFAULT 1/" -e "s/@[email protected]/#define WANT_PACKET_EDITOR 1/" < config.h.win32 > config.h cd tools "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe" / -f Ma kefile.nmake
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
ATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /MP lemon.c Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
lemon.c Microsoft (R) Incremental Linker Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
/out:lemon.exe /debug lemon.obj cd .. cd .. cd image "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe" / -f Ma kefile.nmake
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
[email protected]/amd64/ < wireshark.exe.manifest.in > wireshark.exe.manifest sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < wireshark.rc.in > wireshark.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < libwireshark.rc.in > libwireshark.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < tshark.rc.in > tshark.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < tfshark.rc.in > tfshark.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < rawshark.rc.in > rawshark.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < capinfos.rc.in > capinfos.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < captype.rc.in > captype.rc
sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < editcap.rc.in > editcap.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < text2pcap.rc.in > text2pcap.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < mergecap.rc.in > mergecap.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@R[email protected]/1,99,0,0/ < reordercap.rc.in > reordercap.rc sed -e s/@[email protected]/1.99.0/ -e s/@[email protected]/1,99,0/ < filetap.rc.in > filetap.rc sed -e s/@[email protected]/1.99.0/ -e s/@[email protected]/1,99,0/ < wiretap.rc.in > wiretap.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < dumpcap.rc.in > dumpcap.rc sed -e s/@[email protected]/1.99.0-FBG/ -e s/@[email protected]/1,99,0,0/ < libwsutil.rc.in > libwsutil.rc cd .. cd codecs "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe" / -f Ma kefile.nmake
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /MP /w34295 /IC:\Development\wireshark\ Wireshark-win64-libs\gtk2\include\glib-2.0 /IC:\Development\wireshark\Wireshark-win64-libs\gtk2\lib\glib-2.0\ include -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -Fd.\ -c codecs.c /Focodecs.obj Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
codecs.c
cl /I.. -WX /DWINPCAP_VERSION=4_1_3 /Zi /W3 /MD /O2 /DWIN32_LEAN_AND_MEAN /DMSC_VER_REQUIRED=1600 /D_ CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /MP /w34295 /IC:\Development\wireshark\ Wireshark-win64-libs\gtk2\include\glib-2.0 /IC:\Development\wireshark\Wireshark-win64-libs\gtk2\lib\glib-2.0\ include -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -Fd.\ -c G711u\G711udecode.c /FoG711udecode.obj Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
G711udecode.c cl /I.. -WX /DWINPCAP_VERSION=4_1_3 /Zi /W3 /MD /O2 /DWIN32_LEAN_AND_MEAN /DMSC_VER_REQUIRED=1600 /D_ CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /MP /w34295 /IC:\Development\wireshark\ Wireshark-win64-libs\gtk2\include\glib-2.0 /IC:\Development\wireshark\Wireshark-win64-libs\gtk2\lib\glib-2.0\ include -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -Fd.\ -c G711a\G711adecode.c /FoG711adecode.obj Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
G711adecode.c cl /I.. -WX /DWINPCAP_VERSION=4_1_3 /Zi /W3 /MD /O2 /DWIN32_LEAN_AND_MEAN /DMSC_VER_REQUIRED=1600 /D_ CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /MP /w34295 /IC:\Development\wireshark\ Wireshark-win64-libs\gtk2\include\glib-2.0 /IC:\Development\wireshark\Wireshark-win64-libs\gtk2\lib\glib-2.0\ include -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -Fd.\ -c G722\G722decode.c /FoG722decode.obj Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
G722decode.c cl /I.. -WX /DWINPCAP_VERSION=4_1_3 /Zi /W3 /MD /O2 /DWIN32_LEAN_AND_MEAN /DMSC_VER_REQUIRED=1600 /D_ CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /MP /w34295 /IC:\Development\wireshark\ Wireshark-win64-libs\gtk2\include\glib-2.0 /IC:\Development\wireshark\Wireshark-win64-libs\gtk2\lib\glib-2.0\ include -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -Fd.\ -c G726\G726decode.c /FoG726decode.obj Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
G726decode.c cl /I.. -WX /DWINPCAP_VERSION=4_1_3 /Zi /W3 /MD /O2 /DWIN32_LEAN_AND_MEAN /DMSC_VER_REQUIRED=1600 /D_ CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DPSAPI_VERSION=1 /MP /w34295 /IC:\Development\wireshark\ Wireshark-win64-libs\gtk2\include\glib-2.0 /IC:\Development\wireshark\Wireshark-win64-libs\gtk2\lib\glib-2.0\ include -DG_DISABLE_DEPRECATED -DG_DISABLE_SINGLE_INCLUDES -Fd.\ -c sbc\sbc.c /Fosbc.obj Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
sbc.c link /lib /out:codecs.lib codecs.obj G711udecode.obj G711adecode.obj G722decode.obj G726decode.obj sbc.obj Microsoft (R) Library Manager Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
0 File(s) copied cd zlib.tmp "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe" / -f wi n32/Makefile.msc zlib1.dll AS=ml64 LOC="-DASMV -DASMINF" OBJA="inffasx64.obj gvmat64.obj inffas8664.obj"
Microsoft (R) Program Maintenance Utility Version 10.00.40219.01 Copyright (C) Microsoft Corporation. All rights reserved.
-base:0x5A4C0000 adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj gzwrite.obj infback.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj inffasx64.obj gvmat64.obj inffas8664.obj zlib1.res inffasx64.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\link.EXE"' : ret urn code '0x458' Stop. NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\Bin\amd64\nmake.exe"' : re turn code '0x2' Stop.
C:\Development\wireshark>
OK, all that looks OK, did you run
del /s *.obj
at the top of your source tree?And then what happens when you try to build?
IT WORKED!! Thank you so much, I have complete the build! When I open the .exe it shows this message: "The NPF driver isn't running. You may have trouble capturing or listing interfaces." Is it a problem?
The NPF driver message is because you either don't have WinPCap installed on your build machine, or the WinPCap driver isn't running, most likely the former. Try installing WinPCap. This is only an issue if you wish to capture traffic on your build machine, you can still open captures from elsewhere.
You might want to wrap your command output in
tags in future to make it more viewable.
Now you have given the context your build error was with zlib, a third-party library that is built by the nmake build process.
ok, sorry, I didn't know how to put those lines in tags. As for the building, now I start dealing with my real problem: adding my own dissector (as I asked in another question http://ask.wireshark.org/questions/34966/migration-of-a-plugin-dissector-to-64-bit ).
I think I just have to follow the instructions on README.plugin, that is, briefly, adding the folder "MyProtocol" to the Plugins directory in the source tree, isn't it? Nevertheless I have some questions about that. Should I have to
1)Ask a new question?
2)Add them as comments to my other question?
3)Add them as comments to this question?
I think I answered most aspects of your original question, but if there any bits left over then add a comment.
In any case, follow all the instructions in README.plugin, and see what results. If you don't succeed, check for similar issues on this site, and if you can't find an answer post a new question.
I have asked another question for the plugin( http://ask.wireshark.org/questions/35189/problems-in-building-a-custom-dissector ), but I still have a problem with this question. When I try to open Wireshark.exe, now it not even starts, but just prompt me this message
"The program can't start because wiretap-1.99.0.dll is missing from your computer. Try reinstalling the program to fix this problem".
But in the wireshark directory I have a folder wiretap; there is no wiretap-1.99.0.dll file, but I tried to look for it on the internet and I didn't find anything... What can I do?
Are you running the exe in ...\wireshark-gtk2\wireshark.exe as specified in the Developers Guide section 2.2.11.4?
I don't have such folder. My exe is in C:\Development\wireshark\Wireshark.exe I don't even have a folder "wireshark-gtk2". The most similar I have is C:\Development\wireshark\Wireshark-win64-libs\gtk2\ with inside the folders: bin etc include lib share. Do I have to move the Wireshark.exe there? Or it should be in the right folder itself, and so it's a sort of building error?
You have a build error. The result of the build should be a directory wireshark-gtk (and wireshark-qt-release if building the QT version) underneath your top level source directory that contains all the built artefacts ready to run.
Ok, I rebuilt it, and it works now! Thank you!
I had the same problem and grahamb's solution worked to me. By running nmake -f Makefile.nmake distclean and then del /s *.obj that error disappear :)
@glores
Note that in the 2.0 release and later building on Windows now uses CMake, as per the updated Developers Guide. It's likely that nmake will be deprecated, so please switch to CMake as soon as you can.