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