Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-20362

src/libs/zbxembed/httprequest.c build failed in CentOS 7

XMLWordPrintable

    • Icon: Patch request Patch request
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • 6.0.0beta1
    • Server (S)
    • None
    • Sprint 83 (Dec 2021)

      Steps to reproduce:

      1. Get zabbix-6.0.0beta1.tar.gz in CentOS 7
      2. ./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-libcurl --with-libxml2
      3. make

      Result:
      **

      Making all in zbxembed
      make[3]: Entering directory `/usr/local/src/zabbix-6.0.0beta1/src/libs/zbxembed'
      depbase=`echo console.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
      cc -DHAVE_CONFIG_H -I. -I../../../include     -g -O2   -MT console.o -MD -MP -MF $depbase.Tpo -c -o console.o console.c &&\
      mv -f $depbase.Tpo $depbase.Po
      depbase=`echo duktape.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
      cc -DHAVE_CONFIG_H -I. -I../../../include     -g -O2   -MT duktape.o -MD -MP -MF $depbase.Tpo -c -o duktape.o duktape.c &&\
      mv -f $depbase.Tpo $depbase.Po
      depbase=`echo embed.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
      cc -DHAVE_CONFIG_H -I. -I../../../include     -g -O2   -MT embed.o -MD -MP -MF $depbase.Tpo -c -o embed.o embed.c &&\
      mv -f $depbase.Tpo $depbase.Po
      depbase=`echo global.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
      cc -DHAVE_CONFIG_H -I. -I../../../include     -g -O2   -MT global.o -MD -MP -MF $depbase.Tpo -c -o global.o global.c &&\
      mv -f $depbase.Tpo $depbase.Po
      depbase=`echo httprequest.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
      cc -DHAVE_CONFIG_H -I. -I../../../include     -g -O2   -MT httprequest.o -MD -MP -MF $depbase.Tpo -c -o httprequest.o httprequest.c &&\
      mv -f $depbase.Tpo $depbase.Po
      httprequest.c: In function ‘get_headers_as_arrays’:
      httprequest.c:653:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
         for (int j = 0; j < headers.values_num; j++)
         ^
      httprequest.c:653:3: note: use option -std=c99 or -std=gnu99 to compile your code
      make[3]: *** [httprequest.o] Error 1
      make[3]: Leaving directory `/usr/local/src/zabbix-6.0.0beta1/src/libs/zbxembed'
      make[2]: *** [all-recursive] Error 1
      make[2]: Leaving directory `/usr/local/src/zabbix-6.0.0beta1/src/libs'
      make[1]: *** [all-recursive] Error 1
      make[1]: Leaving directory `/usr/local/src/zabbix-6.0.0beta1/src'
      make: *** [all-recursive] Error 1

      Expected:
      pass build

      I attach a patch that fix this error. I think, use -std=c99 is one of the solutions but it seems to be different from existing coding format.

            zabbix.dev Zabbix Development Team
            uki Yuuki Enomoto
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: