Ask Your Question
0

I have fatal error LNK1181 when rebuild wireshark on Window

asked 2021-05-07 08:46:45 +0000

huong gravatar image

updated 2021-05-07 09:01:45 +0000

0

I am trying follow this instruction to build Wireshark on window: https://www.wireshark.org/docs/wsdg_h...

The build was successful and I was be able to run Wireshark.exe, so I started to follow this instruction to add the plugins for wireshark: https://blog.fjh1997.top/2019/03/29/s...

But after follow each steps, my plugins does not show the foo.ddl, I thought that I did something wrong for configuration of the plugins, so I decided to delete the build directory and build wireshark again just to make sure.

After doing everything I did the first time I built, it show this error:

 Build FAILED.

   "C:\Development\wsbuild64\Wireshark.sln" (default target) (1) ->
   "C:\Development\wsbuild64\wireshark.vcxproj.metaproj" (default target) (2) ->
   "C:\Development\wsbuild64\wireshark.vcxproj" (default target) (147) ->
   (Link target) ->
     LINK : fatal error LNK1181: cannot open input file 'C:\Development\wsbuild64\ui\qt\qtui.dir\RelWithDebInfo\mocs_compilation_Debug.obj' [C:\Development\wsbuild64\wireshark.vcxproj]

0 Warning(s)
1 Error(s)

I have tried to clean and then recompile again, but it still showing errors. So I decided to delete the directory, try to build it once more time, but unfortunately I still got this error and I do not know why. Can someone help me? I really appreciate, this is my first time working with Wireshark.

Edit: When I open folder C:\Development\wsbuild64\ui\qt\qtui.dir\RelWithDebInfo\ as shown in the error, there is no mocs_compilation_Debug.obj, does this mean that I am missing 1 file? Is there any way I can add it?

edit retag flag offensive close merge delete

Comments

Are you building with sources from git, or from a tarball? What is the git commit or version of the tarball?

grahamb gravatar imagegrahamb ( 2021-05-07 09:30:57 +0000 )edit

Hi, I am building source from git, just like in the instruction from wireshark: git clone https://gitlab.com/wireshark/wireshark.git

huong gravatar imagehuong ( 2021-05-07 09:46:02 +0000 )edit

OK, it works for me and the buildbots, so is likely to be something local in your environment. Just be aware that when living on the bleeding edge of master that there may be occasional unintentional breakages. You can also check the buildbots to see if they can build: https://buildbot.wireshark.org/wiresh...

I'm not sure if you have done this but think you should try the "nuclear" option of deleting the build directory and generating a new build solution, preferably without your additions, and when that's working move on to adding the plugin.

grahamb gravatar imagegrahamb ( 2021-05-07 10:06:28 +0000 )edit

yes thank you for your comment, I deleted the build directory and try once again but it still occurs the same error, maybe there is something in my environment, I will check and see if I installed everything before right. It just really confusing because it worked before.

huong gravatar imagehuong ( 2021-05-07 10:35:01 +0000 )edit

Do you have all the required env vars setup correctly?

grahamb gravatar imagegrahamb ( 2021-05-07 10:52:25 +0000 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2021-05-10 08:43:11 +0000

huong gravatar image

updated 2021-05-12 21:30:45 +0000

cmaynard gravatar image

Hi, I have solved the problem but I do not know why it occurred. The problem was that in wireshark.vcxproj file, it is trying to find the mocs_compilation_Debug.obj file.

But in my case, there is no such file in C:\Development\wsbuild64\ui\qt\qtui.dir\RelWithDebInfo direction, there is only file mocs_compilation_RelWithDebInfo.obj

So I replace the name of mocs_compilation_Debug.obj with mocs_compilation_RelWithDebInfo.obj, then the cmake runs fine, and wireshark application is built. Although I do not understand the real problem behinds it, but I hope this will work well.

edit flag offensive delete link more

Comments

You've fixed the immediate issue, but without finding out how the errant information was inserted (presumably by the CMake generation step) you may run into the problem again.

grahamb gravatar imagegrahamb ( 2021-05-10 09:02:37 +0000 )edit

You may have to include the qt debug info in your qt setup. Has to be explisitly downloaded if I remember correctly.

Anders gravatar imageAnders ( 2021-05-10 09:13:17 +0000 )edit

If the Qt PDBs are missing this usually just causes a link warning. In this case the CMake generated .vcxproj has errant info where the locally compiled object file has a strange name.

grahamb gravatar imagegrahamb ( 2021-05-10 10:05:37 +0000 )edit

I've encountered this exact same problem after upgrading CMake from 3.19.8 to 3.20.2. I was going to downgrade back to 3.19.8, but I don't have time to do that today. @huong, what version of CMake are you running? If it's 3.20.x, you might want to try 3.19.8 to see if that resolves the problem.

NOTE: I do not experience this problem with 3.4.5 sources and CMake 3.20.2, only with master, so I don't think this is a CMake problem, per se.

cmaynard gravatar imagecmaynard ( 2021-05-12 21:29:07 +0000 )edit
Chuckc gravatar imageChuckc ( 2021-05-12 21:50:36 +0000 )edit

I just use the CMake version that is installed with Visual Studio. Currently 3.19.20122902-MSVC_2.

grahamb gravatar imagegrahamb ( 2021-05-13 09:38:36 +0000 )edit

I modified CMakeLists.txt and was able to build Wireshark using CMake 3.20.2.

I changed this:

if(CMAKE_VERSION VERSION_GREATER "3.19.999" AND CMAKE_VERSION VERSION_LESS "3.20.2")

To this:

if(CMAKE_VERSION VERSION_GREATER "3.19.999" AND CMAKE_VERSION VERSION_LESS "3.20.3")

I'm guessing that whatever fix was supposed to have gone into 3.20.2 didn't make it into that release. This solution assumes things will be fixed in 3.20.3, but there's no guarantee of that, so I'm not sure if this is a good long-term solution. Personally, I may just revert to 3.19.8 until this is sorted out.

cmaynard gravatar imagecmaynard ( 2021-05-13 14:26:12 +0000 )edit

@grahamb, I don't think using the version of CMake that comes with Visual Studio necessarily protects us from the problems we've run into with 3.20.x, as Microsoft could start including 3.20.x at any time. That said, it could be an option, but then the Developer Guideshould be updated to list this as an option. Even then, unless this option is listed first, my guess is that most likely developers will download CMake from https://cmake.org/download/, since that's what's indicated in the Developer Guide today - and without any particular guide as to which version should be downloaded, I might add - so in all likelihood that means they'll end up with CMake 3.20.2 (currently).

cmaynard gravatar imagecmaynard ( 2021-05-13 15:02:58 +0000 )edit

@cmaynard
Using the VS version is one thing less to download and maintain. I've held off modifying the WSDG for a while just to see if I did suffer any issues but it's all been plain sailing for at least a year. I would think only Windows, and maybe macOS, users are actually using such a recent version that causes the issues.

grahamb gravatar imagegrahamb ( 2021-05-13 15:10:56 +0000 )edit

chocolatey - cmake is at CMake 3.20.2
Maybe section 2.2.7 and the example in 2.2.1 can be removed.
(Due to impatience - too much caffeine - or not paying attention - too little caffeine, I executed the example lines in 2.2.1 last time I rebuilt my dev VM. cmake 3.18.4 got installed but the MS version is on the path when a "Visual Studio Command Prompt" is used)

Chuckc gravatar imageChuckc ( 2021-05-13 15:44:27 +0000 )edit

@Chuckc
I'm a little surprised, as VS is dynamically added to the path after executing the appropriate .bat file, where as, if installed standalone, CMake should already be on the path.

grahamb gravatar imagegrahamb ( 2021-05-13 16:33:07 +0000 )edit

@grahamb - I would have thought that as well but the choco install does not update the path:

MSI Properties
ADD_CMAKE_TO_PATH

None - Do not add CMake to PATH (default)
System - Add CMake to system PATH for all users
User - Add CMake to PATH for the current user


Would be nice to have the log and path info from the original question poster. :-)

Chuckc gravatar imageChuckc ( 2021-05-13 16:50:06 +0000 )edit

Thank you for all your comment, I were busy doing something else that I set this beside. Today, I will get back to it. I install the CMake just like in the "Developer Guide", using choco install -y cmake.

When things does not work, I have went back to every installed that I made, make sure that I have installed the right version, but there are no information about the right version I should used for the cmake. The version of CMake I used is: cmake version 3.20.2

How can I show you the log and path info?

huong gravatar imagehuong ( 2021-05-14 05:59:49 +0000 )edit

@Chuckc, ahh, last time I used chocolatey to install CMake I think it added shims for all the binaries which are then added to the path via the addition of the chocolatey\bin directory. It seems the package no longer does that, so regardless of what we decide about using the VS CMake binary, the WSDG needs an update.

grahamb gravatar imagegrahamb ( 2021-05-14 09:40:52 +0000 )edit

Sligth change of subject; but on the same vein. Recently python stopped working eventhough it was on the path. Typing python in the cmd shell pointed to a recommendation to install the app. Doing that solved the problem. So seamingly python is now an installable app in windows 10. Material for the user guide too.

Anders gravatar imageAnders ( 2021-05-14 13:13:57 +0000 )edit
0

answered 2021-05-14 01:09:22 +0000

Gerald Combs gravatar image
edit flag offensive delete link more

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: 2021-05-07 08:46:45 +0000

Seen: 386 times

Last updated: May 14 '21