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

Wireshark-dev: Re: [Wireshark-dev] Building wireshark-0.99.6 problems on Linux

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Sat, 04 Aug 2007 13:59:38 -0700
Fabrizio Bertocci wrote:

[1] When building a rpm package, the rpm build fails because of a warning that is treated as error (when it should not be!). The problem is reported in: wiretap/file_access.c (line 993) (the warning is about passing a 'const' pointer to gzwrite that is declared to take a non-const pointer). As workaround, simply change the RPM SPEC file under packaging/rpm/SPEC/wireshark.spec.in (or, if you have already run the configure, change the packaging/rpm/SPEC/wireshark.spec) to have --disable-warnings-as-errors in the CFLAGS. The correct fix would be to understand why the rpm build uses the -Werror flag even if not requested...

The *correct* fix would be to fix libz so that it declares gzwrite() to take a const pointer as its second argument (unless it really *does* modify the buffer handed to it, in which case the correct fix would probably be to figure out how not to make it do so).

At least on my machine, running Mac OS X 10.4.10, it *is* declared that way:

ZEXTERN int ZEXPORT    gzread  OF((gzFile file, voidp buf, unsigned len));
/*
     Reads the given number of uncompressed bytes from the compressed file.
   If the input file was not in gzip format, gzread copies the given number
   of bytes into the buffer.
     gzread returns the number of uncompressed bytes actually read (0 for
   end of file, -1 for error). */

ZEXTERN int ZEXPORT    gzwrite OF((gzFile file,
                                   voidpc buf, unsigned len));
/*
Writes the given number of uncompressed bytes into the compressed file.
   gzwrite returns the number of uncompressed bytes actually written
   (0 in case of error).
*/

Note the "voidpc" for gzwrite and the "voidp" for gzread.

On what release of what distribution are you building the RPM?