Wireshark-dev: Re: [Wireshark-dev] Building wireshark-0.99.6 problems on Linux
From: Fabrizio Bertocci <[email protected]>
Date: Mon, 06 Aug 2007 12:13:34 -0700
I verified that the problem of zlib occur only on:
- Redhat 9
- Redhat Enterprise Linux 3
In both platform the gzwrite is declared as:
    ZEXTERN int ZEXPORT    gzwrite OF((gzFile file, const voidp buf, unsigned len));

It appears that this problem has been fixed in newer version of libz (tested also on CentOS 4 and 5 and it seems ok).
Anyway, the problem with wireshark is that the build process report this warning (treated as error) even if I did not specify in the 'configure' the flag ' --enable-warnings-as-errors'.
If I run 'configure' with '--disable-warnings-as-errors' I don't get that compilation error, so it must be something in the configure script  that doesn't work quite well.

I think the problem is how 'HAVE_WARNINGS_AS_ERRORS' is defined/used. Unfortunately the configure.in doesn't work for autoconf that's installed on my RH9 machine, and I don't have time to test it on other machines.


Guy Harris wrote:
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
    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?
Wireshark-dev mailing list
[email protected]