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

Zabbix agent2 compilation fails on windows

XMLWordPrintable

    • Sprint 63 (Apr 2020)
    • 0.25

      gcc  -O2 -g -DUNICODE -DHAVE_STDINT_H=1 -Ic:\Users\malloc\Documents\zabbix\build\mingw\..\..\build\win32\include -Ic:\Users\malloc\Documents\zabbix\build\mingw\..\..\build\mingw -Ic:\Users\malloc\Documents\zabbix\build\mingw\..\..\include -DHAVE_OPENSSL=1 -DHAVE_OPENSSL_WITH_PSK=1 -Ic:\dev\openssl\include -Ic:\dev\pcre\include -c c:\Users\malloc\Documents\zabbix\build\mingw\..\..\src\libs\zbxcommon\misc.c -o output\misc.o
      c:\Users\malloc\Documents\zabbix\build\mingw\..\..\src\libs\zbxcommon\misc.c: In function 'zbx_get_time':
      c:\Users\malloc\Documents\zabbix\build\mingw\..\..\src\libs\zbxcommon\misc.c:368:48: error: 'struct __timeb64' has no member named 'tv_sec'
         offset = zbx_get_timezone_offset(current_time.tv_sec, tm);
                                                      ^
      c:\Users\malloc\Documents\zabbix\build\mingw\..\..\src\libs\zbxcommon\misc.c: In function 'zbx_get_timezone_offset':
      c:\Users\malloc\Documents\zabbix\build\mingw\..\..\src\libs\zbxcommon\misc.c:404:2: warning: implicit declaration of function 'gmtime_r'; did you mean 'gmtime_s'? [-Wimplicit-function-declaration]
        gmtime_r(&t, &tm_utc);
        ^~~~~~~~
        gmtime_s
      mingw32-make: *** [Makefile:81: output\misc.o] Error 1
      

      fix:

      diff --git a/src/go/internal/agent/scheduler/client.go b/src/go/internal/agent/scheduler/client.go
      index bf49442eec..38727ae639 100644
      --- a/src/go/internal/agent/scheduler/client.go
      +++ b/src/go/internal/agent/scheduler/client.go
      @@ -292,7 +292,7 @@ func (c *client) cleanup(plugins map[string]*pluginAgent, now time.Time) (releas
              }
      
              var expiry time.Time
      -       // Direct requests are handled by special clients with id <= ActiveChecksClientID.
      +       // Direct requests are handled by special clients with id <= MaxBuiltinClientID.
              // Such requests have day+hour (to keep once per day checks without expiring)
              // expiry time before used plugins are released.
              if c.id > agent.MaxBuiltinClientID {
      diff --git a/src/go/plugins/windows/eventlog/eventlog_windows.go b/src/go/plugins/windows/eventlog/eventlog_windows.go
      index 95a6b248b1..ef0ffe9aea 100644
      --- a/src/go/plugins/windows/eventlog/eventlog_windows.go
      +++ b/src/go/plugins/windows/eventlog/eventlog_windows.go
      @@ -64,7 +64,7 @@ func (p *Plugin) Validate(options interface{}) error {
       }
      
       func (p *Plugin) Export(key string, params []string, ctx plugin.ContextProvider) (result interface{}, err error) {
      -       if ctx == nil || ctx.ClientID() <= agent.ActiveChecksClientID {
      +       if ctx == nil || ctx.ClientID() <= agent.MaxBuiltinClientID {
                      return nil, fmt.Errorf(`The "%s" key is not supported in test or single passive check mode`, key)
              }
              meta := ctx.Meta()
      diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c
      index 43e7819bfa..e17da86cb0 100644
      --- a/src/libs/zbxcommon/misc.c
      +++ b/src/libs/zbxcommon/misc.c
      @@ -362,7 +362,7 @@ void        zbx_get_time(struct tm *tm, long *milliseconds, zbx_timezone_t *tz)
              if (NULL != tz)
              {
                      long    offset;
      -#ifdef _WINDOWS
      +#if defined(_WINDOWS) || defined(__MINGW32__)
                      offset = zbx_get_timezone_offset(current_time.time, tm);
       #else
                      offset = zbx_get_timezone_offset(current_time.tv_sec, tm);
      @@ -398,7 +398,7 @@ long        zbx_get_timezone_offset(time_t t, struct tm *tm)
       #ifdef HAVE_TM_TM_GMTOFF
              offset = tm->tm_gmtoff;
       #else
      -#ifdef _WINDOWS
      +#if defined(_WINDOWS) || defined(__MINGW32__)
              tm_utc = *gmtime(&t);
       #else
              gmtime_r(&t, &tm_utc);
      

            vso Vladislavs Sokurenko
            vso Vladislavs Sokurenko
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: