• Sponsorship

  • Build NSCP

    This is a quick guide on how to build NSCP (NCSlient++) for your self. It is an embryo at the moment and will hopefully grow more into a real proper guide.

    To begin with there are a few things you will need to build NSCP.

    • boost (only needed for Eventlog, CheckDisk and CheckWMI)
    • openssl (only needed for NRPE module)
      • Perl (open SSL requires this)
    • A C++ compiler (I use Visual Studio 2008 Beta 2)
      • stl (shipps with MSVC nowdays)

    0, Get the source

    Get the source: Th source is avalible via anonymous SVN from here:

    svn co http://svn.nakednuns.org/nscp/trunk
    

    1, Setup environment

    First we setup the environment, this is an "optional" step but I prefer it as it is simpler, all "directories" are configure here instead of all over the place.

    # #####################################################
    #
    # setup environment
    set TARGET_DIR=d:\source\
    set SOURCE_DIR=d:\source\libs-c\
    set TOOLS_DIR=d:\source\tools\
    
    set TARGET_LIB_DIR=%TARGET_DIR%\lib
    set TARGET_LIB_x86_DIR=%TARGET_LIB_DIR%\x86
    set TARGET_LIB_x64_DIR=%TARGET_LIB_DIR%\x64
    set TARGET_LIB_ia64_DIR=%TARGET_LIB_DIR%\ia64
    
    set TARGET_INC_DIR=%TARGET_DIR%\include
    set PATH=%PATH%;%TOOLS_DIR%
    

    2, boost

    Boost (http://www.boost.org) is required if you want to use CheckEventLog, CheckDisk and/or CheckWMI. The dependency can be disable via a compiler (NO_BOOST_DEP) flag and all you loose is the regular expression support. Below are commands for building for all platforms if you dont want that just use the segment you need.

    # #####################################################
    #Get Boost
    #Get bjam and make sure it is in your path (tools dir)
    
    # Build boost:
    cd %SOURCE_DIR%
    cd boost_1_34_1
    #
    # w32
    #
    bjam --toolset=msvc --prefix=%TARGET_DIR% --includedir=%TARGET_INC_DIR% --libdir=%TARGET_LIB_x86_DIR% clean
    bjam --toolset=msvc --prefix=%TARGET_DIR% --includedir=%TARGET_INC_DIR% --libdir=%TARGET_LIB_x86_DIR% install
    #
    # all (for some reason boost places things "wrong" so we have to copy it right)
    #
    xcopy /s %TARGET_INC_DIR%\boost-1_34_1\*.* %TARGET_INC_DIR%
    #
    # x64 (amd64/EMT)
    #
    bjam --toolset=msvc --prefix=%TARGET_DIR% --includedir=%TARGET_INC_DIR% --libdir=%TARGET_LIB_x64_DIR% address-model=64 clean
    bjam --toolset=msvc --prefix=%TARGET_DIR% --includedir=%TARGET_INC_DIR% --libdir=%TARGET_LIB_x64_DIR% address-model=64 install
    #
    # ia64 (Itanium)
    #
    bjam --toolset=msvc --prefix=%TARGET_DIR% --includedir=%TARGET_INC_DIR% --libdir=%TARGET_LIB_ia64_DIR% address-model=64 architecture=ia64 clean
    bjam --toolset=msvc --prefix=%TARGET_DIR% --includedir=%TARGET_INC_DIR% --libdir=%TARGET_LIB_ia64_DIR% address-model=64 architecture=ia64 install
    

    3, OPENSSL

    Then we have openssl (required for encryption) and the only module that uses this is NRPEClient. Get openssl from openssl (http://www.openssl.org) and again this is for all plattforms so just use the one(s) you need. There is a slight manual option here as iI dont know how to generate makefiles for /mt so for now you have to manually edit the makefile changing /MD to /MT)

    # #####################################################
    # get openssl:
    # get perl:
    cd %SOURCE_DIR%
    cd openssl-0.9.8g
    #
    # w32
    #
    perl Configure VC-WIN32
    ms\do_masm
    ## <<edit ms\nt.mak and change the compiler option from MD to MT>>
    nmake -f ms\nt.mak clean
    nmake -f ms\nt.mak
    nmake -f ms\nt.mak install
    xcopy /Y out32\*.lib %TARGET_LIB_x86_DIR%
    xcopy /s inc32\*.* %TARGET_INC_DIR%
    #
    # w64 (AMD64/EMT)
    #
    perl Configure VC-WIN64A
    ms\do_win64a
    ## <<edit ms\nt.mak and change the compiler option from MD to MT>>
    nmake -f ms\nt.mak clean
    nmake -f ms\nt.mak
    nmake -f ms\nt.mak install
    copy out32\*.lib %TARGET_LIB_x64_DIR%
    #
    # ia64 (Itanium)
    #
    perl Configure VC-WIN64I
    ms\do_win64i
    ## <<edit ms\nt.mak and change the compiler option from MD to MT>>
    nmake -f ms\nt.mak clean
    nmake -f ms\nt.mak
    nmake -f ms\nt.mak install
    copy out32\*.lib %TARGET_LIB_ia64_DIR%
    

    4, NSCP

    HA! thought it would be soo easy right? :) Actually all you need to do now is grab the source from the SVN and build from within vstudio but I shall get back on how to build from CLI in a while.