On Jun 5, 2024, at 11:07 AM, Anders Broman <a.broman58@xxxxxxxxx> wrote:
> Th MR https://gitlab.com/wireshark/wireshark/-/merge_requests/15869
> is failing to build. I'm guessing the FindZLIBNG.cmake is not finding the library(?)
Nope:
-- Checking for one of the modules 'zlib'
-- Found ZLIB: /Applications/Xcode-14.3.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/lib/libz.tbd
-- Looking for inflate
-- Looking for inflate - found
-- Looking for inflatePrime
-- Looking for inflatePrime - found
-- Checking for one of the modules 'zlib-ng'
-- Found ZLIBNG: /opt/homebrew/Cellar/zlib-ng/2.1.6/lib/libz-ng.dylib
-- Looking for zng_gzopen
-- Looking for zng_gzopen - found
It's finding both zlib (as shipped with the system) *and* zlib-ng (as installed by Homebrew).
What appears to be happening is that it's including both the zlib and zlib-ng headers, and getting a collision because they're defining the same typedef and redefining the same structure:
In file included from /Users/gitlab/builds/wireshark/wireshark/wsutil/version_info.c:36:
/opt/homebrew/include/zlib-ng.h:1079:20: error: typedef redefinition with different types ('uint32_t (*)(void *, const uint8_t **)' (aka 'unsigned int (*)(void *, const unsigned char **)') vs 'unsigned int (*)(void *, unsigned char **)')
typedef uint32_t (*in_func) (void *, const uint8_t * *);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/zlib.h:1102:20: note: previous definition is here
typedef unsigned (*in_func) OF((void FAR *,
^
In file included from /Users/gitlab/builds/wireshark/wireshark/wsutil/version_info.c:36:
/opt/homebrew/include/zlib-ng.h:1792:8: error: redefinition of 'gzFile_s'
struct gzFile_s {
^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk/usr/include/zlib.h:1839:8: note: previous definition is here
struct gzFile_s {
^
2 errors generated.
Is there some particular reason why we search for zlib *and* zlib-ng, rather than, for example, searching for zlib-ng and, if we don't find it, searching for zlib, with some -D option to tell it not to look for zlib-ng?