Ask Your Question
0

Getting error MSB4018 when trying to build wireshark sources

asked 2017-11-14 11:44:02 +0000

Bella gravatar image

updated 2017-11-14 13:38:30 +0000

grahamb gravatar image

Hi, I followed Quick setup guide found here: https://www.wireshark.org/docs/wsdghtmlchunked/ChSetupWin32.html and installed and configured everything as described. But when I tried to compile the latest wireshark sources I received many errors like that:

"C:\wiresharkDev\wsbuild32\Wireshark.sln" (default target) (1) ->
  "C:\wiresharkDev\wsbuild32\ui\ui.vcxproj.metaproj" (default target) (57) ->
    "C:\wiresharkDev\wsbuild32\ui\ui.vcxproj" (default target) (93) ->
     C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB4018: The "CustomBuild" task failed unexpectedly.\r [C:\wiresharkDev\wsbuild32\ui\ui.vcxproj]

Could anybody help me to solve it? Many thanks, Bella

edit retag flag offensive close merge delete

Comments

Please show the full output of the CMake generation step, redirect to a file as shown below, copy the file to a public file sharing site, e.g. Google Drive, DropBox etc. and then post a link to the file in a comment.

CMake "Your arguments" 2>&1 > cmake.txt
grahamb gravatar imagegrahamb ( 2017-11-14 13:40:53 +0000 )edit

Thank you for helping me with this issue! According to your request I used this command

cmake -DENABLE_CHM_GUIDES=on -G "Visual Studio 14" ..\wireshark 2>&1 > cmake.txt.

cmake.txt could be found here: link text

Bella gravatar imageBella ( 2017-11-14 13:53:44 +0000 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2017-11-14 14:54:00 +0000

grahamb gravatar image

From your CMake output:

-- The following OPTIONAL packages have not been found:

* CAP
* Gettext
* M
* Qt5Core
* Qt5LinguistTools
* Qt5Multimedia
* Qt5PrintSupport
* Qt5Svg
* Qt5Widgets
* Qt5WinExtras
* SETCAP
* PkgConfig
* LYNX

The others are expected and OK on Windows, but the Qt ones are not. Your build environment for Qt is not setup correctly as per the Developers Guide Sect 2.2.3, either you haven't installed Qt or you haven't set the QT5_BASE_DIR environment variable.

edit flag offensive delete link more

Comments

I use the following settings:

set CYGWIN=nodosfilewarning   
set WIRESHARK_BASE_DIR=C:\wiresharkDev   
set WIRESHARK_TARGET_PLATFORM=win32   
set QT5_BASE_DIR=C:\Qt\Qt5.9.2\vcredist\vcredist_msvc2015_x86.exe   
set WIRESHARK_VERSION_EXTRA=-bella

What's wrong here?

Bella gravatar imageBella ( 2017-11-14 16:37:21 +0000 )edit

You have the wrong path set in QT5_BASE_DIR. It should be C:\Qt\Qt5.9.2\msvc2015.

grahamb gravatar imagegrahamb ( 2017-11-14 16:56:47 +0000 )edit

But there is no msvc2015 directory under C:\Qt\Qt5.9.2 What does it mean?

Bella gravatar imageBella ( 2017-11-14 17:02:45 +0000 )edit

Somewhere under C:\Qt you should be able to find windeployqt.exe, that's usually in a "bin" directory. You need to set QT5_BASE_DIR to the directory above the "bin" directory.

For example I have (using Qt 5.9.1):

C:\Qt
  \5.9.1
    \msvc_2015    <--- set QT5_BASE_DIR to here.
      \bin
        \windeployqt.exe
grahamb gravatar imagegrahamb ( 2017-11-14 17:08:47 +0000 )edit

Thanks a lot for your great help! I understood the issue finally – it was related to wrong QT installation. When installing you need to select QT 5.9.2 -> msvc 2015 32 bit ( it was not selected by default). That’s why I didn’t have a folder containing windeployqt.exe. Now QT5_BAS_DIR set to C:\Qt\Qt5.9.2\5.9.2\msvc2015 - you can find cmake.txt file here

But when I compile I end up with the same errors that I started from:

"C:\wiresharkDev\wsbuild32\Wireshark.sln" (default target) (1) ->
       "C:\wiresharkDev\wsbuild32\codecs\wscodecs.vcxproj.metaproj" (default target) (75) ->
       "C:\wiresharkDev\wsbuild32\codecs\wscodecs.vcxproj" (default target) (110) ->
         C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB4018: The "CustomBuild" task failed unexpectedly.\r [C:\wiresharkDev\wsbuild32\codecs\wscodecs.vcxproj]
       C:\Program Files (x86 ...
(more)
Bella gravatar imageBella ( 2017-11-14 21:30:39 +0000 )edit

Did you scratch your build dir and re ran cmake?

Anders gravatar imageAnders ( 2017-11-14 21:54:54 +0000 )edit

Well, I erased both wsbuild32 and wireshark-win32-libs directories and re-created wsbuild32.

After that I run cmake -DENABLE_CHM_GUIDES=on -G "Visual Studio 14 2015" ..\wireshark 2>&1 > cmake.txt and cmake.txt could be found here

Then I run msbuild /m /p:Configuration=RelWithDebInfo Wireshark.sln /t:Clean and after that msbuild /fl /flp:verbosity=diagnostic /m /p:Configuration=RelWithDebInfo Wireshark.sln msbuild.log is located here

Any idea?

Bella gravatar imageBella ( 2017-11-15 07:47:44 +0000 )edit

Your CMake output looks OK.

The format of build output you are using is far too verbose, in addition it helps to turn off parallel builds (drop the /m) when debugging build output.

Please use msbuild /p:Configuration=RelWithDebInfo 2>&1 > build.txt to produce a build output file.

grahamb gravatar imagegrahamb ( 2017-11-15 10:41:49 +0000 )edit

You can find build.txt file here: link text

Bella gravatar imageBella ( 2017-11-15 11:52:29 +0000 )edit

Your build output looks OK, you should have a Wireshark.exe to test in C:\wiresharkDev\wsbuild32\run\RelWithDebInfo.

grahamb gravatar imagegrahamb ( 2017-11-15 12:02:02 +0000 )edit

Interesting that I didn't do anything but dropped /m from the build command. And yes, now I have Wireshark.exe that tries to start and fails a second later.

I checked the stack,(not sure that it's ok) and it looks as follows:

software_update_init() line 109
WiresharkApplication::allSystemGo() line 1122
main line 845

and it looks like the problem is in these lines (in softwareupdateinit function):

if (strcmp(language, "system") != 0) {
        win_sparkle_set_lang(language);
}
Bella gravatar imageBella ( 2017-11-15 12:12:57 +0000 )edit

Yep, that was a null pointer dereference that was fixed in change 24414. Update your sources to get the fix.

grahamb gravatar imagegrahamb ( 2017-11-15 12:22:56 +0000 )edit

Thank you! Will try now But can you explain why the build is OK now after I dropped /m? What does his parameter do?

Bella gravatar imageBella ( 2017-11-15 12:27:08 +0000 )edit

The /m allows multiple projects to be built in parallel across all the cores in your build machine. I use it all the time on my 4 core build VM's, as do the Wireshark build slaves (not sure how many cores they have) without issue. I remove it when debugging build output so that projects are then built in order and it's easier to read.

If the original answer has solved your problem (which was an incorrect Qt install) please accept it by clicking the "checkmark" icon.

grahamb gravatar imagegrahamb ( 2017-11-15 12:31:30 +0000 )edit

The original answer did help me to find QT installation issue, but there are still weird issues related to original question - error MSB4018. I still cannot figure out what cause it why it disappeared after I dropped /m. And now - I rebuilt it with the NULL pointer fix and despite of the fact that I run it without /m the build failed with the same errors - new build.txt attached link text

Bella gravatar imageBella ( 2017-11-15 12:41:27 +0000 )edit

Arguably this is a different question even if the symptoms are similar so should get a new one.

Anyway, the errors in your latest build relate to an inability to open zlib1.dll and what seems to be parallel build conflicts when building the docs. I'm uncertain why you get these, do you have wireshark open when building, or maybe it's caused by AV locking the files?

I also don't know why your subsequent build is attempting to rebuild the docs, it should be incremental, i.e. only what's changed. Are you doing a /t:clean between each build or adding /t:rebuild, if so neither should be required?

grahamb gravatar imagegrahamb ( 2017-11-15 13:53:24 +0000 )edit

Well, after several iterations I can definitely tell that my original issue (error MSB4018 The "CustomBuild" task failed unexpectedly) is related to presence of /m flag.

If I run clean command without /m
msbuild /p:Configuration=RelWithDebInfo Wireshark.sln /t:Clean
and after that build command without /m as well:
msbuild /p:Configuration=RelWithDebInfo Wireshark.sln
everything works well. It makes me crazy, but at least the work-around found.

Anyway, thanks a lot for your great help!

Bella gravatar imageBella ( 2017-11-15 13:59:36 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-11-14 11:44:02 +0000

Seen: 713 times

Last updated: Nov 14 '17