Skip to content

Build Error while enable output compress  #293

@flat2010

Description

@flat2010

Files involved

joy-master/joy_config.h
joy-master/src/p2f.c

Platform

Ubuntu 14.04 4.4.0-148

Problem

Step1: modify joy_config.h as follows:

/* Compression is enabled */
#define COMPRESSED_OUTPUT 1
#undef  FORCED_COMPRESSED_OUTPUT_OFF

Step2: modify p2f.c as follows:

// decomment line 1831
zflush(ctx->output);

Step3: then make

$make

Error occurs:

../src/p2f.c: In function 'flow_record_list_print_json':
../src/include/output.h:115:35: error: too few arguments to function 'gzflush'
     #define zflush(FILEp)        (gzflush(FILEp))
                                   ^~~~~~~
../src/p2f.c:1831:5: note: in expansion of macro 'zflush'
     zflush(ctx->output);
     ^~~~~~
In file included from ../src/include/output.h:103,
                 from ../src/include/hdr_dsc.h:47,
                 from ../src/include/p2f.h:59,
                 from ../src/include/pkt_proc.h:47,
                 from ../src/p2f.c:58:
/usr/local/include/zlib.h:1531:21: note: declared here
 ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));

This will happen when zflush called if gzip enabled.

Reason

According to Linux specification, gzflush needs 2 parameters which the last should be either:

  • Z_SYNC_FLUSH
  • Z_FULL_FLUSH
  • Z_FINISH

But there's only 1 parameter in definition of zflush:

#ifdef USE_BZIP2
    ···
    #define zflush(FILEp)        (BZ2_bzflush(FILEp))
    ···
#else
    ···
   // gzflush needs 2  parameters
    #define zflush(FILEp)        (gzflush(FILEp))
    ···

Fix

  1. Modify definition of gzflush, pass a right macro value as the 2nd parameter;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions