1 Compiling RRDtool on Win32 with Microsoft Visual C++:
2 ---------------------------------------------------------------
3 2008-03-12 Stefan Ludewig stefan.ludewig@exitgames.com
5 Here are step by step instructions for building rrdlib.lib and rrdtool.exe
6 version 1.3.5 and newer with Microsoft Visual Studio 2008 (9.0.x).
8 (1) Download and extract libraries rrdtool depends on:
10 - cairo: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo_1.8.0-1_win32.zip
11 and http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo-dev_1.8.0-1_win32.zip
13 - glib: http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.18/glib_2.18.3-1_win32.zip
14 and http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.18/glib-dev_2.18.3-1_win32.zip
16 - libpng: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng_1.2.32-1_win32.zip
17 and http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng-dev_1.2.32-1_win32.zip
19 - libxml2: http://downloads.sourceforge.net/gnuwin32/libxml2-2.4.12-bin.zip?modtime=1009062000&big_mirror=1
20 and http://downloads.sourceforge.net/gnuwin32/libxml2-2.4.12-1-lib.zip?modtime=1024783200&big_mirror=1
22 - pango: http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.22/pango_1.22.2-1_win32.zip
23 and http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.22/pango-dev_1.22.2-1_win32.zip
25 - zlib: http://www.zlib.net/zlib123-dll.zip
27 (2) Create a folder named "contrib" next to your rrdtool-folder.
29 (3) Copy the following folders and files from the downloaded archieves into
30 the contrib-folder, you just created:
32 a) The folder "bin" from cairo_1.8.0-1_win32 and the folders "lib" and
33 "include" from cairo-dev_1.8.0-1_win32 into contrib/cairo.
35 b) The folder "bin" from glib_2.18.3-1_win32 and the folders "lib" and
36 "include" from glib-dev_2.18.3-1_win32 into contrib/glib
38 c) The folder "bin" from libpng_1.2.32-1_win32 and the folders "lib" and
39 "include" from libpng-dev_1.2.32-1_win32 into contrib/libpng
41 d) The file "libxml2.dll" from libxml2-2.4.12-bin/bin and the file
42 "libxml2.lib" from libxml2-2.4.12-1-lib\lib into contrib/libxml2/lib and
43 the folder "include" from from libxml2-2.4.12-1-lib into contrib/libxml2
45 e) The folder "bin" from pango_1.22.2-1_win32 and the folders "lib" and
46 "include" from pango-dev_1.22.2-1_win32 into contrib/pango
48 f) The folders "lib" and "include" and the file "zlib1.dll" into
49 contrib/zlib
51 (4) Open the Visual Studio 2008 Solution "rrd.sln" in the win32 folder of
52 your rrdtool-folder and build either the project rrdlib (for the
53 rrdtool-library), rrdtool (for the rrdtool-executable depending on the
54 libraray) or the complete solution. A post-build event automatically copies
55 all the dlls, needed by rrdtool, next to the .exe, when you build the
56 executable. These DLLs must be available on all hosts where rrdtool will
57 run.
59 5/1/05 Tobi
60 to help windows deal with the reentrant versions of many unix
61 calls link with win32comp.c
63 4/10/05 Tobi
64 The windows implementation of strftime does not seem to support
65 the ISO 8601 week number (%V) I have therfore included the file
66 strftime.[ch] which provides strftime_ ... if you compile rrdtool
67 with -Dstrftime=_strftime and link strftime.o then you will
68 get propper support for %V.
70 7/29/04 Jake Brutlag
72 As of Jan 2004, code for libraries utilized by rrdtool
73 (png, libart, freetype, and zlib) is no longer distributed with
74 rrdtool. This requires some changes to the compile process on
75 Win32. The solution described here is to compile rrdtool to
76 link against these libraries dynamically. There is an advantage
77 to this approach: namely the rrdtool distribution doesn't have to
78 worry about how to compile these libraries on Win32. In theory,
79 since others already provide and maintain Win32 binaries for these
80 libraries the users don't have to worry about how to compile them
81 either. The disadvantage of this approach is that the DLLs for
82 these libraries must be available on the hosts where rrdtool will run.
84 Here are step by step instructions for compiling rrdtool.exe and
85 the perl shared library (RRDS.dll) with Microsoft Visual C++ 6.0.
86 (1) Download libraries rrdtool depends on from GnuWin32:
87 http://gnuwin32.sourceforge.net/
88 For freetype, libpng, and zlib download the "Complete Package"; each of
89 these will be a self-extracting self-installing executable.
90 For libart, download both the "Binaries" and "Developer Files" packages.
91 Unfortunately at this time GnuWin32 doesn't provide the "Complete Package"
92 installer for libart. Perhaps by the time you are following these
93 instructions GnuWin32 will have a "Complete Package" for libart.
94 (2) Install the GnuWin32 libraries by running the executables for freetype,
95 libpng, and zlib. These instructions and the Visual C++ project files
96 distributed with rrdtool assume that you will use the default install
97 location: C:\Program Files\GnuWin32. Extract the two zip files for libart,
98 libart-2.3.3-bin.zip and libart-2.3.3-1-lib.zip into the GnuWin32 directory;
99 the appropriate libart files will be added to the include, lib, and bin
100 subdirectories.
101 (3) Add C:\Program Files\GnuWin32\bin to the PATH (Control Panel ->
102 System -> Advanced -> Environment Variables).
103 (4) Start Microsoft Visual C++ 6.0. Load the workspace file, rrdtool.dsw,
104 from the src subdirectory of your rrdtool code directory.
105 (5) Compile the Release build of the rrdtool project (since rrdtool depends
106 on the rrd project, the rrd library will also be compiled). At this
107 time, the compile will fail in zconf.h, a zlib header file. The problem
108 is a preprocessor directive that loads unistd.h. Open zconf.h in VC++
109 (this file is in C:\Program Files\GnuWin32\include) and find the following
110 code block:
112 #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */
113 # include <sys/types.h> /* for off_t */
114 # include <unistd.h> /* for SEEK_* and off_t */
115 # ifdef VMS
116 # include <unixio.h> /* for off_t */
117 # endif
118 # define z_off_t off_t
119 #endif
121 Change it to reads as follows (this is code from zlib-1.1.4):
123 #if HAVE_UNISTD_H
124 # include <sys/types.h> /* for off_t */
125 # include <unistd.h> /* for SEEK_* and off_t */
126 # ifdef VMS
127 # include <unixio.h> /* for off_t */
128 # endif
129 # define z_off_t off_t
130 #endif
132 Note that it is actually just a one line change. Save the file and
133 recompile rrdtool. By the time you are following these instructions
134 this issue with zconf.h may be resolved.
135 (6) At this point, you can run the executable rrdtool.exe in the
136 src\toolrelease subdirectory. Note that if you wish to run rrdtool
137 on other machines, you will need the following DLLs installed (on the
138 path) on those machines:
139 zlib1.dll
140 libpng12.dll
141 libart_lgpl.dll
142 freetype6.dll
143 msvcrt.dll
144 The names of the first four DLLs might vary from what is listed here
145 depending on the versions of the packages you downloaded from GnuWin32.
146 The fifth DLL, msvcrt.dll, is a system DLL for most versions of Windows.
147 If you are running on old version of Windows, you can install/upgrade to
148 IE4.0 to get this DLL.
149 (7) To compile the perl-shared library, open a Command Prompt (DOS box)
150 and cd to the bindings\perl-shared subdirectory.
151 (8) Run vcvars32.bat; this batch file, in your vc98\bin directory will
152 set necessary environment options for command line compiling.
153 (9) In bindings\perl-shared, run
154 perl ntmake.pl
155 nmake
156 nmake test
157 If nmake test succeeds, you are good to go. RRDs.dll is in
158 blib\arch\auto\RRDs. If you plan to install via the Active State ppm
159 tool, tar and gzip the blib directory. You can use the RRDs.ppd file
160 in bindings\perl-shared directory. Remember that as in the case of
161 rrdtool.exe you will need the DLLs listed in (6) on the machine where
162 you are going to use RRDs.dll.
164 Microsoft Visual C++ 7.1 (.NET 2003):
166 Unfortunately, this is more difficult than with VC++ 6.0. The problem
167 is that by default the C runtime dll for VC++ 7.1 is msvcr71.dll rather
168 than msvcrt.dll. The GnuWin32 library binaries are all compiled
169 to use msvcrt.dll and you can't mix msvcr71.dll and msvcrt.dll in the
170 same process. One option is to download the source code for the libraries
171 (available from http://gnuwin32.sourceforge.net) recompile them with
172 VC++ 7.l. Then all the components will use msvcr71.dll. Once you are
173 going to go this route, you can also use static multi-threaded libraries
174 and use static linking between rrdtool (or RRDs.dll) and its dependencies.
176 To use the GnuWin32 library binaries, you need to trick VC++ 7.1 into
177 compiling rrdtool to use the older msvcrt.dll. Follow steps (1) - (3)
178 as above, then:
179 (4) Obtain a different version of the msvcrt.lib import library that
180 is compatible with vc7 and points to msvcrt.dll:
181 msvcrtlib_for_vc7.zip from http://xchat.org/win32/testing
182 Backup msvcrt.lib in your vc7\lib directory
183 (\Program Files\Microsoft Visual Studio .NET 2003\vc7\lib)
184 Then extract the msvcrt.lib from the zip file into the vc7\lib directory.
185 WARNING: Use this msvcrt.lib at your own risk! This is not a Microsoft
186 supplied file nor a file supported by anyone associated with rrdtool.
187 (5) Start Microsoft Visual C++ 7.1. Load the solution file, rrdtool.sln,
188 from the src subdirectory of your rrdtool code directory. Edit zconf.h,
189 as needed, as described under (5) above. Compile the release build of
190 the rrdtool project.
191 Proceed with steps (6) - (9) as above, if you are using/picking up
192 the wrong msvcrt.lib import library then nmake test for perl-shared
193 will fail.
195 Note: it is possible in the future that GnuWin32 will provide Win32
196 binaries that utilize msvcr71.dll rather than msvcrt.dll.
198 5/14/02 Jake Brutlag
200 These notes share some insight I gained compiling 1.1.x with
201 MS Visual C++ 6.0 (using project files). This information may or
202 may not be accurate at the time you are reading this.
204 (1) freetype and rrdtool cannot use precompiled headers (which are
205 enabled by default for MSVC++ projects). MSVC++ 6.0 does not
206 support precompiled headers if #include directives contain MACROS.
207 (2) Compile Release build with Default optimization, not the
208 Maximize Speed optimization. I encountered some strange errors
209 (related to argument processing for complex commands like graph--
210 perhaps the getopt stuff is too blame) with Maximize Speed.
211 (3) libart relies upon config.h (ostensibly generated by the
212 configure script-- but of course not on Win32 platforms). ..\..\confignt
213 (which contains a static Win32 version of config.h) should be on
214 the include path.
215 (4) Fonts are located in the %windir%\fonts, so the default font
216 is c:\winnt\fonts\cour.ttf. (6/19/02) At Kerry Calvert's suggestion
217 this setting was moved to confignt\config.h.
218 (5) libart requires a custom build step to generate art_config.h; this
219 is done manually via the commands:
220 cl -I..\..\confignt gen_art_config.c
221 gen_art_config.exe > art_config.h
223 Currently, to compile rrd.lib and rrdtool.exe using
224 the MSVC++ project files, first start MSVC++ 6.0. Open the rrdtool
225 workspace (rrdtool.dsw in the src directory). The active project/
226 configuration should be rrdtool-Win32 Release. Select Rebuild All
227 from the Build menu. The static link library (rrd.lib) will
228 be generated in src\release directory and executable will be generated
229 in the src\toolrelease directory.
231 Compiling RRDtool on NT ... work in progress
232 ---------------------------------------------------------------
233 by Tamas Kovacshazy (khazy@mit.bme.hu)
235 Persisting Problems with the current NT port:
237 Unfortunately, the RRD perl modules does not work with Perl
238 (ActivePerl) using the current distribution.
240 The RRD shared perl module can be compiled after some
241 modification...
243 Follow these steps:
245 0. Install perl if you do not have it!
246 Visit http://www.ActiveState.com/pw32/ for a complete distribution.
248 1. Copy ..\gd1.2\release\gd.lib to ..\gd1.2\
249 2. Copy ..\src\release\rrd.lib to ..\src
250 3. perl Makefile.pl
252 In this step the system complains about something I do not
253 understand. The error message is the following:
255 Note (probably harmless): No library found for '-lm'
257 Is a library missing? But it does not stop with an error...
259 4. nmake test (You must have Visual C++ on the machine!)
261 After these steps it generates the test files (svgs and rrds),
262 and they seem to be good.
264 The real problem in the shared perl modul is the following:
266 I do not know how this installation stuff works. The problem is
267 that the installation stuff looks for the gd.lib and the
268 rrd.lib in the ..\gd1.2 and ..\src directory. The UNIX compile
269 puts the files into these directories, but the NT compile does
270 not.
272 It is all for today,
274 khazy
276 Tamas Kovacshazy E-mail: khazy@mit.bme.hu
277 WWW: http://www.mit.bme.hu/~khazy
278 Technical University of Budapest
279 Department of Measurement and Information Systems
282 Compiling RRDtool 1.2.x on Win32 with MingW32 gcc:
283 ---------------------------------------------------------------
285 1. Obtain and install the current version of the MingW package.
287 http://www.mingw.org/download.shtml
289 In the MinGW set you will need the gcc and binutils as a minimum.
291 2. Obtain either of the following awk versions and install in a directory
292 on your System Path:
294 - awk.exe
296 http://cm.bell-labs.com/cm/cs/awkbook/index.html
298 Note: This version has no dependencies to other libs.
300 - gawk.exe (GnuWin32 version)
302 http://gnuwin32.sourceforge.net/packages/gawk.htm
304 Note: Also fetch the dependant libraries for it from the same page.
306 3. If you plan to create a 'distribution' release of the RRD Tools, the
307 Makefile.Win32 will copy all the needed files to an output directory and
308 then zip the entire directory. A suitable zip utility can be obtained here:
310 http://www.info-zip.org/
312 Install in a directory on your System Path.
314 4. Obtain the following libraries, ideally install them all under a common
315 directory:
317 = zlib
319 http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
320 http://www.zlib.net/
322 = libpng
324 http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.12.tar.gz
325 http://libpng.sourceforge.net/
327 = freetype
329 http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.2.1.tar.gz
330 http://freetype.sourceforge.net/index2.html
332 = libart_lgpl
334 http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
335 http://www.levien.com/libart/
337 Note: libart_lgpl needs a special tweak because the archive contains
338 only the base directory, but the libart headers are usually included with
339 a directory prefix; therefore create a subfolder 'libart_lgpl' and move
340 all files into this subfolder.
342 5. Set up for DOS environment.
344 Add MingW\bin and MSYS\bin directories to your System path.
346 If the libraries share a common directory set the following environment var:
348 set LIBBASE=<shared director>
349 e.g set LIBBASE=C:\Libraries
351 If the libraries are scattered, set the following environment vers:
353 set ZLIBSDK=<path to zlib>
354 e.g set ZLIBSDK=C:\mytest\zlib-1.2.3
355 set LIBPNG=<path to libpng>
356 set LIBFT2=<path to freetype>
357 set LIBART=<path to libart>
359 If using the Gnu Awk (gawk.exe), edit the Makefile.Win32 and change the line:
361 AWK = awk
363 to
365 AWK = gawk
367 6. Compile the project.
369 All dependent libs are statically linked in. This has the benefit that the
370 binaries do not depend on any other DLLs.
371 In order to build the static freetype lib enter the freetype base directory
372 and type 'make'. If everything is fine a message appears that gcc is detected,
373 and that you should again type 'make'. Follow that in order to build freetype.
374 All other libs are build from the sources with the RRDTool Makefile.Win32.
376 Switch to the RRDTOOL .\src directory. Then:
378 make -f Makefile.Win32 help
380 to see the build options, or
382 make -f Makefile.Win32 all
384 should build the entire package.
386 6. Happy Graphing!
389 written by normw & gk.