Wireshark-dev: Re: [Wireshark-dev] ZLIB on macOS build discrepancy?

From: Guy Harris <gharris@xxxxxxxxx>
Date: Sun, 20 Dec 2020 11:34:01 -0800
On Dec 20, 2020, at 6:18 AM, Michael Tuexen <tuexen@xxxxxxxxxxxxx> wrote:

>> On 20. Dec 2020, at 12:59, Jaap Keuter <jaap.keuter@xxxxxxxxx> wrote:
>> 
>> tools/macos_setup.sh sports ZLIB_VERSION=1.2.11, while About Wireshark (3.4.2) states “with zlib 1.2.8,”.
> macos_setup.sh installs minizip in version 1.2.11. I double checked that this is also installed on the
> builder: libminizip.dylib So that is working as expected.

It does *not* build or install zlib 1.2.11 itself, however; it only downloads it to get the minizip library.

> I guess the "with zlib 1.2.8" comes from using the default version provided by Mac OS 10.12.

And, thus, by the 10.12 SDK; the "compiled with" value comes from the header file, which is part of the SDK, not part of the OS.

> The About dialog also says "Running on Mac OS X 10.16, build 20C69 (Darwin 20.2.0, ...  with zlib 1.2.11"
> which I guess is the version used and provided by the version of Mac OS, the program is running on.

Yes, *that* comes from a library API call (zlibVersion()), so it may return a value different from "compiled with".

>> Looking at my currently installed 3.4.0, it says "with zlib 1.2.11,” so it seemed to have rolled back somehow?
> No idea.

My recently-updated Mojave virtual machine appears to ship with zlib 1.2.11:

$ ls -l /usr/lib/libz*
lrwxr-xr-x  1 root  wheel      12 Sep 27  2018 /usr/lib/libz.1.1.3.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 Sep 27  2018 /usr/lib/libz.1.2.11.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 Sep 27  2018 /usr/lib/libz.1.2.5.dylib -> libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 Sep 27  2018 /usr/lib/libz.1.2.8.dylib -> libz.1.dylib
-rwxr-xr-x  1 root  wheel  186480 Aug 22  2019 /usr/lib/libz.1.dylib
lrwxr-xr-x  1 root  wheel      12 Sep 27  2018 /usr/lib/libz.dylib -> libz.1.dylib

and the Xcode 11.3.1 installed on it appears to have zlib 1.2.11 headers:

$ xcodebuild -version
Xcode 11.3.1
Build version 11C505
mojave.local$ egrep ZLIB_VERSION `incldir`/zlib.h
  version 1.2.11, January 15th, 2017
#define ZLIB_VERSION "1.2.11"
$ incldir
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include

I also copied over the 10.12 SDK from another VM, in order to try to have the Mojave VM be as much like what I suspect is on the buildbot as possible.  If I look at that SDK's zlib.h, it's for 1.2.8:

$ egrep ZLIB_VERSION /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/zlib.h
#define ZLIB_VERSION "1.2.8"

so I suspect what happened was that 3.4.0 was built with the default SDK, not the 10.12 SDK, but 3.4.2 was built with the 10.12 SDK.