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

Fail to build Wireshark using cmake/msbuild

0

Hi!

I've seen similar issues but don't want to hijack those threads, as they did not solve my problem...

I have just started trying to build Wireshark using cmake/msbuild but I fail (64 bit Windows 7, MSVC2015). I try making my build directory with the following command:

cmake -D ENABLE_CHM_GUIDES=on -G "Visual Studio 14 2015 Win64" ..\trunk

However, when I try to build it (msbuild /m /p:Configuration=RelWithDebInfo Wireshark.sln) I end up with release note and user guide issues, although I have Cygwin Text/asciidoc and Text/docbook-xml45 installed.

I then made my build directory without the guides (cmake -D ENABLE_CHM_GUIDES=off -D ENABLE_HTML_GUIDES=off -D ENABLE_PDF_GUIDES=off -G "Visual Studio 14 2015 Win64" ..\trunk) but still end up with release notes failing.

I then tried to build only that one, as per suggestion ion another thread:

msbuild /p:Configuration=RelWithDebInfo .\docbook\release_notes_html.vcxproj /fl /flp:logfile=fail2build.20160502.log;verbosity=diagnostic

Checking the log file, I get the following errors:

Generating release-notes.html (TaskId:35)
/cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 2: $'\r': command not found (TaskId:35)
/cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 25: $'\r': command not found (TaskId:35)
/cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 30: $'\r': command not found (TaskId:35)
/cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 54: syntax error: unexpected end of file (TaskId:35)
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(171,5): error MSB6006: "cmd.exe" exited with code 2.     [C:\username\Wireshark\eWireshark\Build\docbook\release_notes_html.vcxproj]
Done executing task "CustomBuild" -- FAILED. (TaskId:35)*

Does anyone have an idea of why this is failing? Seems there is some input to the runa2x.sh missing; could I be missing some environment variable!?

Thanks in advance, /Johan

asked 02 May '16, 00:35

w8lle's gravatar image

w8lle
11113
accept rate: 0%

edited 02 May '16, 01:16

grahamb's gravatar image

grahamb ♦
19.8k330206


One Answer:

1

You're attempting to build with VS2015 which is not yet officially supported, VS2013 is still the "official" compiler for Windows builds.

Having said that, the issue you have doesn't seem to be related to VS2015, but rather that the Cygwin bash shell is having difficulties executing the runa2x.sh script, in particular the line endings in the script.

How did you get your sources, from a git clone or from a zip\tarball? Can you check the line-endings of tools\runa2x.sh? My copy, in my git repo, has Unix line endings.

answered 02 May '16, 01:22

grahamb's gravatar image

grahamb ♦
19.8k330206
accept rate: 22%

Hi and thanks for the prompt reply!

I get my source code using TortoiseSVN. I've seen in another thread that using GIT could solve the issue, so maybe that's the way to go!?

My script looks like it has Unix line endings; moving it over to a Linux machine and printing it with cat -v did not show any "^M" characters, at least.

(02 May '16, 01:31) w8lle
1

I'm mildly surprised that the SVN repo still works, so you're now doing 2 things differently from the Developers Guide instructions, 3 strikes and you're out.

What happens if you execute the command (path\to\cygwin\bin\bash.exe path/to/runa2x.sh ...) from the release_notes_html.vcxproj directly? Note you'll have to cd to the sources docbook directory first, and might need to add the Cygwin bin directory to your path.

(02 May '16, 01:51) grahamb ♦

Well, obviously it doesn't work... -As I previously said, maybe I should try to get TurtoiseGIT working...

I went in to the "....\Build\docbook" directory and executed: "C:\cygwin64\bin\base32.exe" "C:\user\Wireshark\eWireshark\trunk\tools\runa2x.sh"

It doesn't report errors; gives me some encoded(?) string...

(02 May '16, 02:56) w8lle

Hmm. Still not following instructions :-)

cd to the source docbook directory not the build one, and execute the full command as found in the project file. There's not much point showing you what I have as a command as we have different paths to Cygwin and the sources and build directories.

(02 May '16, 05:04) grahamb ♦

I downloaded Wireshark using GIT and I don't have this issue any longer. I'll keep looking in to this though, as it is annoying that I don't understand...

Thanks for your help!

Anyway, just as an FYI...

Sorry about the confusion! -I'm more used to using Wireshark than actually building it...

I get the same error:

C:\username\Wireshark\eWireshark\trunk\docbook> C:\cygwin64\bin\bash.exe /cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh --format=xhtml --destination-dir=/cygdrive/c/username/Wireshark/eWireshark/Build/docbook --asciidoc-opts= --fop --stylesheet=ws.css release-notes.asciidoc /cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 2: $'\r': command not found /cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 25: $'\r': command not found /cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 30: $'\r': command not found /cygdrive/c/username/Wireshark/eWireshark/trunk/tools/runa2x.sh: line 54: syntax error: unexpected end of file

(02 May '16, 07:56) w8lle

It was the EOL style that was the issue, as you already suspected! -Changing it to Unix style solved the issue!

(02 May '16, 08:56) w8lle

If an answer has solved your issue, please accept the answer for the benefit of other users by clicking the checkmark icon next to the answer. Please read the FAQ for more information.

(02 May '16, 09:37) Jaap ♦

Shell scripts in Git checkouts should have UNIX-style line endings on all platforms because we have *.sh eol=lf in .gitattributes. Tarballs are created from a Git checkout on Linux, so they should have UNIX-style line endings as well.

I'm not sure how you'd translate Git's eol=lf attribute to an svn:eol-style property.

(02 May '16, 13:35) Gerald Combs ♦♦
showing 5 of 8 show 3 more comments