Skip to content
barrie0482 edited this page Sep 13, 2010 · 5 revisions

Instructions to build a perl extension for rrdtool v1.3.8 on win32 using Microsoft Visual C++ 2008 Express

Download

Note: The perl module included in the packages below require the RRDtool libraries to be available in the system path

RRDtool-1.3.8-win32-ruby1.8-perl5.10-Setup.exe
RRDtool-1.3.8-win32-ruby1.8-perl5.10-Setup.zip

Note 1. RRDtool needs to be built and installed to to use the RRDs perl module. Build instructions can be found here

Note 2. The perl module included in the packages below require the RRDtool libraries to be available in the system path

Note 3. The perl module has been compiled for Activestate Perl v5.10.0

Pre-requisites

  • Microsoft Visual C++ 2008 Express
  • Activestate Perl v5.10.0

Build Directory Structure

rrdtool_win32_build
- contrib
- cairo
- glib
- libpng
- libxml2
- pango
- zlib
– rrdtool-1.3.8
- bindings
– perl-shared
- doc
- examples
- netware
- po
- win32
- patch

Create ntmake-build


use ExtUtils::MakeMaker;
use Config;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
# Run VCVARS32.BAT before generating makefile/compiling.
WriteMakefile(
    'NAME'	=> 'RRDs',
    'VERSION_FROM' => 'RRDs.pm',
#    'DEFINE'	   => "-DPERLPATCHLEVEL=$Config{PATCHLEVEL}",
# keep compatible w/ ActiveState 5xx builds
    'DEFINE'	   => "-DPERLPATCHLEVEL=5",

   'INC'	=> '-I../../src/ "-I../../../contrib/cairo/include/" "-I../../../contrib/glib/include" "-I../../../contrib/libpng/include" "-I../../../contrib/libxml2/include" "-I../../../contrib/pango/include" "-I../../../contrib/zlib/include"',
# Since we are now using GnuWin32 libraries dynamically (instead of static
# complile with code redistributed with rrdtool), use /MD instead of /MT.
# Yes, this means we need msvcrt.dll but GnuWin32 dlls already require it
# and it is available on most versions of Windows.
   'OPTIMIZE' => '-O2 -MD',
   'LIBS'  => '../../win32/Release/rrdlib.lib "../../../contrib/cairo/lib/" "../../../contrib/glib/lib" "../../../contrib/libpng/lib" "../../../contrib/libxml2/lib" "../../../contrib/pango/lib" "../../../contrib/zlib/lib"', 
    'realclean'    => {FILES => 't/demo?.rrd t/demo?.png' },
    ($] ge '5.005') ? (
        'AUTHOR' => 'Tobias Oetiker ([email protected])',
        'ABSTRACT' => 'Round Robin Database Tool',
    ) : ()
);

Modify RRDs.c

Replace rrd_config.h in line 36 with win32/config.h


#define VERSION_SAVED VERSION
#undef VERSION
//#include "../../rrd_config.h"
#include "../../win32/config.h"

Setup Microsoft Visual Studio 2008 x86 tools environment

  • Run vcvarsall.bat" x86

    "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
    Setting environment for using Microsoft Visual Studio 2008 x86 tools.

Set environment variables

Set Temp to c:\Temp – No spaces in directory or folder names


   set TEMP=c:\Temp

Run the perl ntmake-build.pl file to create the Makefile



D:\projects\rrdtool\rrdtool-1.3.8\bindings\perl-shared>perl ntmake-build.pl
Warning: '../../../contrib/cairo/lib/' changed to '-LD:/projects/rrdtool/rrdtool-1.3.8/bindings/perl-shared/../../../contrib/cairo/lib/'
Warning: '../../../contrib/glib/lib' changed to '-LD:/projects/rrdtool/rrdtool-1.3.8/bindings/perl-shared/../../../contrib/glib/lib'
Warning: '../../../contrib/libpng/lib' changed to '-LD:/projects/rrdtool/rrdtool-1.3.8/bindings/perl-shared/../../../contrib/libpng/lib'
Warning: '../../../contrib/libxml2/lib' changed to '-LD:/projects/rrdtool/rrdtool-1.3.8/bindings/perl-shared/../../../contrib/libxml2/lib'
Warning: '../../../contrib/pango/lib' changed to '-LD:/projects/rrdtool/rrdtool-1.3.8/bindings/perl-shared/../../../contrib/pango/lib'
Warning: '../../../contrib/zlib/lib' changed to '-LD:/projects/rrdtool/rrdtool-1.3.8/bindings/perl-shared/../../../contrib/zlib/lib'
Writing Makefile for RRDs


Run nmake – lots of warnings, not sure if this is good


D:\projects\rrdtool\rrdtool-1.3.8\bindings\perl-shared>nmake

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -c  -I../../src/ "-I../../../contrib/cairo/include/" "-I../../../contrib/glib/include" "-I../../../contrib/libpng/include" "-I../../../contrib/libxml2/include" "-I../../../contrib/pango/include" "-I../../../contrib/zlib/include"
 -nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX -O2 -MD    -DVERSION=\"1.3008\"  -DXS_VERSION=\"1.3008\"  "-IC:\Perl\lib\CORE"  -DPERLPATCHLEVEL=5 RRDs.c
cl : Command line warning D9025 : overriding '/O1' with '/O2'
RRDs.c
RRDs.xs(147) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(147) : warning C4244: '=' : conversion from 'time_t' to 'int', possible loss of data
RRDs.xs(158) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(158) : warning C4244: '=' : conversion from 'time_t' to 'int', possible loss of data
RRDs.xs(170) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(183) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(196) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(220) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.c(306) : warning C4101: 'RETVAL' : unreferenced local variable
RRDs.xs(261) : warning C4018: '<' : signed/unsigned mismatch
RRDs.xs(267) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(271) : warning C4018: '<' : signed/unsigned mismatch
RRDs.xs(286) : warning C4244: '=' : conversion from 'time_t' to 'unsigned long', possible loss of data
RRDs.xs(296) : warning C4244: 'function' : conversion from 'time_t' to 'IV', possible loss of data
RRDs.c(370) : warning C4101: 'RETVAL' : unreferenced local variable
RRDs.xs(323) : warning C4244: 'function' : conversion from 'time_t' to 'UV', possible loss of data
RRDs.xs(324) : warning C4244: 'function' : conversion from 'time_t' to 'UV', possible loss of data
RRDs.c(441) : warning C4101: 'RETVAL' : unreferenced local variable
RRDs.xs(339) : warning C4018: '<' : signed/unsigned mismatch
RRDs.xs(345) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(349) : warning C4018: '<' : signed/unsigned mismatch
RRDs.xs(366) : warning C4244: '=' : conversion from 'time_t' to 'unsigned long', possible loss of data
RRDs.xs(377) : warning C4244: 'function' : conversion from 'time_t' to 'IV', possible loss of data
RRDs.xs(378) : warning C4244: 'function' : conversion from 'time_t' to 'IV', possible loss of data
RRDs.xs(332) : warning C4101: 'row_cnt' : unreferenced local variable
RRDs.c(485) : warning C4101: 'RETVAL' : unreferenced local variable
RRDs.xs(393) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(406) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(419) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(430) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
RRDs.xs(442) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Running Mkbootstrap for RRDs ()
        C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 RRDs.bs
        C:\Perl\bin\perl.exe -MExtUtils::Mksymlists  -e "Mksymlists('NAME'=>\"RRDs\", 'DLBASE' => 'RRDs', 'DL_FUNCS' =>
{  }, 'FUNCLIST' => [], 'IMPORTS' => {  }, 'DL_VARS' => []);"
        link -out:blib\arch\auto\RRDs\RRDs.dll -dll -nologo -nodefaultlib -debug -opt:ref,icf  -libpath:"C:\Perl\lib\CORE"  -machine:x86 RRDs.obj   C:\Perl\lib\CORE\perl58.lib ..\..\win32\Release\rrdlib.lib "C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB\oldnames.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\kernel32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\user32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\gdi32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\winspool.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\comdlg32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\advapi32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\shell32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\ole32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\oleaut32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\netapi32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\uuid.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\ws2_32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\mpr.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\winmm.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\version.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\odbc32.lib" "C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib\odbccp32.lib" "C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB\msvcrt.lib" -def:RRDs.def
rrdlib.lib(rrd_error.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to
the link command line to improve linker performance
   Creating library blib\arch\auto\RRDs\RRDs.lib and object blib\arch\auto\RRDs\RRDs.exp
Generating code
Finished generating code
        C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 755 blib\arch\auto\RRDs\RRDs.dll
        C:\Perl\bin\perl.exe -MExtUtils::Command -e cp RRDs.bs blib\arch\auto\RRDs\RRDs.bs
        C:\Perl\bin\perl.exe -MExtUtils::Command -e chmod 644 blib\arch\auto\RRDs\RRDs.bs

Install the perl module

<pre> D:\projects\rrdtool\rrdtool-1.3.8\bindings\perl-shared>nmake install

Microsoft® Program Maintenance Utility Version 9.00.30729.01
Copyright © Microsoft Corporation. All rights reserved.

Installing C:\Perl\site\lib\auto\RRDs\RRDs.dll
Installing C:\Perl\site\lib\auto\RRDs\RRDs.dll.manifest
Installing C:\Perl\site\lib\auto\RRDs\RRDs.exp
Installing C:\Perl\site\lib\auto\RRDs\RRDs.lib
Installing C:\Perl\site\lib\auto\RRDs\RRDs.pdb
Installing C:\Perl\html\site\lib\RRDs.html
Files found in blib\arch: installing files in blib\lib into architecture dependent library tree
Installing C:\Perl\site\lib\ntmake-build.pl
Installing C:\Perl\site\lib\RRDs.pm
Appending installation info to C:\Perl\lib/perllocal.pod