Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] win64 CMake bug - (CYGWIN_INSTALL_PATH redefinition)

From: "Gilbert, Ike" <Ike.Gilbert@xxxxxxxxxx>
Date: Thu, 27 Jul 2017 19:01:42 +0000
I’ve found a bug in the CMake (build file generation) process on Win64 targets, which causes the redefinition of the CYGWIN_INSTALL_PATH variable partway through the build file generation. This bug originally manifested when CMake was unable to locate the SH_EXECUTABLE file in the C:\Cygwin64 directory.

“The bash executable (SH_EXECUTABLE-NOTFOUND) isn’t from Cygwin. Check your path”
“wireshark could not find SH (missing: SH EXECUTABLE)"

The root cause is that CMake's stock FindPerl.cmake file is called containing the following directive:

include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)

This points to the stock copy of FindCygwin.cmake instead of the modified version (wireshark\cmake\modules\FindCygwin.cmake) included in the wireshark source that adds the C:\Cygwin64 and WIRESHARK_CYGWIN_INSTALL_PATH search paths. Thus when the FindPerl module is executed it redefines the existing CYGWIN_INSTALL_PATH with an invalid search location, unless Cygwin has been installed at C:\Cygwin. Neither C:\Cygwin64 or WIRESHARK_CYGWIN_INSTALL_PATH will be checked. (These changes were added in commit 25ec91a on 2015-11-13, and affects 2.0.0 and later versions )

The easiest fix is to simply add the stock copy the FindPerl.cmake file to the wireshark\cmake\modules\ directory, which forces the correct version of the FindCygwin.cmake to be used.

I’ve created a bug in the Wireshark bug tracker and am sending this e-mail to the wireshark-dev e-mail list since it has greater prominence in google search results and may be useful to anybody attempting to build Wireshark 2.0.0+ in a Windows 64 bit environment.