Ad Widget

Collapse

How to compile the windows agent?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Takanori Suzuki
    Junior Member
    • Jun 2008
    • 11

    #16
    Hi.
    This is how to build windows agent 1.6x more in detail.
    There might be some different word in visual studio UI because I'm using japanease version and translated it.

    ###############################################
    1.) Install Visual C++ 2008 Express Edition

    2.) Install Microsoft Platform SDK to use winsock2.h
    If OS is 32bit, use PSDK-x86.exe


    3.) After install, edit Binary path, Include path and Library path.
    From top window, "tool - option - project - VC++ directory"
    - add following path to "Binary path"
    C:\Program Files\Microsoft Platform SDK\Bin
    C:\Program Files\Microsoft Platform SDK\Bin\winnt
    - add following path to "Include path"
    C:\Program Files\Microsoft Platform SDK\Include
    C:\Program Files\Microsoft Platform SDK\Include\mfc
    - add following path to "Library path"
    C:\Program Files\Microsoft Platform SDK\Lib

    4.) Replace "include/config.h" with "build/win32/include/config.h"

    5.) Delete 76 line in comment src/libs/zbxsys/threads.c (because there is some illegal char)

    6.) Open "build/win32/project/ZABBIX.sln" from Visual Studio 2008.

    7.) Add "advapi32.lib" to "linker - input - dependent file" in each project's property

    8.) Select "Release" and "Win32", and build it. Maybe first build will fail at zabbix_get project, but build it again, it will be ok.


    *) If you want build in "debug" mode, you have to change "HAVE_LDAP" to "HAVE_WINLDAP_H" in "C/C++ - preprocesser" in each project's property.

    ###############################################

    Comment

    • dedds
      Junior Member
      • Mar 2010
      • 3

      #17
      Compiling (linked) window$ agent error

      adding resource. type:MESSAGETABLE, name:1, language:0x0409, flags:0x1030, size:36
      logfiles.obj : error LNK2019: ссылка на неразрешенный внешний символ _zbx_read в функции _process_logrt
      file.obj : error LNK2001: неразрешенный внешний символ "_zbx_read"
      net.obj : error LNK2019: ссылка на неразрешенный внешний символ _GetIfEntry@4 в функции _get_if_stats
      net.obj : error LNK2019: ссылка на неразрешенный внешний символ _GetIfTable@12 в функции _get_if_stats
      net.obj : error LNK2019: ссылка на неразрешенный внешний символ _GetIpAddrTable@12 в функции _get_if_stats
      net.obj : error LNK2019: ссылка на неразрешенный внешний символ _GetTcpTable@12 в функции _NET_TCP_LISTEN
      ../../../bin/win32/zabbix_agentd.exe : fatal error LNK1120: 5 неразрешенных внешних элементов

      Comment

      • Takanori Suzuki
        Junior Member
        • Jun 2008
        • 11

        #18
        Hi, dedds.

        Which version you want to build?
        The solution file seems to be not maintained after 1.8 in ZABBIX SIA.
        They seems to be not using solution file but make file to build windows binary.
        If you have after 1.8, you have to add Existing Item "src\libs\zbxcommon\file.c" to "zabbix agentd" project in solution file.

        How to add existing item: http://msdn.microsoft.com/en-us/libr...92(VS.80).aspx

        If you have 1.8 and 1.8.1, you also have to get "eventlog.c" and "eventlog.h" from subverion "svn://svn.zabbix.com/branches/1.8/".
        See https://support.zabbix.com/browse/ZBX-1929

        Comment

        • Takanori Suzuki
          Junior Member
          • Jun 2008
          • 11

          #19
          The above post was not sufficient explanation.
          I just tried to build 1.8.1 aganin.
          Please see following.

          (1) Copy config.h from "build\win32\include\config.h" to "include\config.h"
          (2) Copy eventlog.c and eventlog.h from subversion 1.8 branch or my attached files.
          (3) Open "build\win32\project\zabbix.sln"
          (4) Change setting to "Release" "Win32"
          (5) Add "src\libs\zbxcommon\file.c" as existing item to "zabbix_agentd" project.
          see How to add existing item: http://msdn.microsoft.com/en-us/libr...92(VS.80).aspx
          (6) Add "IPHLPAPI.lib" to linker input of "zabbix_agentd" project.
          see "To add .lib files as linker input in the development environment" section: http://msdn.microsoft.com/en-us/libr...22(VS.80).aspx
          (7) Add "UNICODE" and "_UNICODE" to Preprocessor Definitions of "zabbix_agentd", "zabbix_get" and "zabbix_sender" project.
          see "To set this compiler option in the Visual Studio development environment" section: http://msdn.microsoft.com/en-us/libr...c8(VS.80).aspx
          (8) Build solution "3 times". Then all project succeeded in building.

          Or, you can use my attached files to build 1.8.1.
          (1) Copy config.h from "build\win32\include\config.h" to "include\config.h"
          (2) Copy eventlog.c and eventlog.h from subversion 1.8 branch or my attached files.
          (3) Replace project files "zabbix_agentd.vcproj", "zabbix_get.vcproj" and "zabbix_sender.vcproj" by my attached files.
          (4) Open "build\win32\project\zabbix.sln"
          (5) Change setting to "Release" "Win32"
          (6) Build solution "3 times". Then all project succeeded in building.
          Attached Files

          Comment

          • dedds
            Junior Member
            • Mar 2010
            • 3

            #20
            Thanks big. Replacement of files has helped with the project, all was compiled excellently.

            Comment

            • Takanori Suzuki
              Junior Member
              • Jun 2008
              • 11

              #21
              In addition to this topic, ZABBIX SIA seems to maintain makefile instead of Visual Studio "*.sln" files.
              Please see follwing.

              - How to build windows binary by using makefiles.

              (1) Open Visual Studio command prompt.
              (2) Change directory to "build\win32\project"
              (3) Execute nmake with makefile.
              For example.
              [zabbix_agentd.exe]
              nmake Makefile_agent
              [zabbix_get.exe]
              nmake Makefile_get
              [zabbix_sender.exe]
              nmake Makefile_sender

              Makefiles are maintained by ZABBIX SIA.
              So, I think this is the easiest way to build windows binary.

              In some case, only for debug, I uses Visual Studio "*.sln" file to build.

              Comment

              • monolithic
                Junior Member
                • May 2009
                • 21

                #22
                Hey Takanori,

                Do you have any documentation on how to compile the 2.0.x agents? Is it pretty much the same that has been documented here, or is there newer steps to doing this?

                Comment

                • zalex_ua
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Oct 2009
                  • 1286

                  #23
                  Discussed in https://support.zabbix.com/browse/ZBX-8054

                  Comment

                  Working...