1 Compiling RRDtool on Win32 with Microsoft Visual C++:
2 ---------------------------------------------------------------
3 2017-10-02 Wolfgang Stöggl c72578@yahoo.de
4 2010-06-04 Chris Larsen clarsen@euphoriaaudio.com
5 2008-03-12 Stefan Ludewig stefan.ludewig@exitgames.com
7 Here are step by step instructions for building librrd-8.dll and rrdtool.exe
8 version 1.4.5 and newer with Microsoft Visual Studio 2013 (12.0.x) and newer.
9 I you would like to build RRDtool using MinGW-w64, please have a look at
10 win32/README-MinGW-w64
12 # Installation of up-to-date, required third party headers and libraries
14 An efficient way, to obtain headers and libraries required by RRDtool is using vcpkg from:
15 https://github.com/microsoft/vcpkg
17 (1) Follow the vcpkg installation instructions found in README.md and clone vcpkg e.g. to a folder named "vcpkg"
18 in the top directory of rrdtool.
21 (2) Install the headers and libraries the following way for 32-bit or 64-bit:
22 .\vcpkg install cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib --triplet x86-windows
23 .\vcpkg install cairo expat fontconfig freetype gettext glib libpng libxml2 pango pcre zlib --triplet x64-windows
25 Information, how to compile using nmake, can be found here: win32/README
29 Libraries mentioned in the section below are outdated and not updated any more.
30 However, the described procedure still works.
32 (1) Create a folder named "contrib" in the directory where this text file is located.
34 (2) Download the following libraries that rrdtool depends on:
36 - cairo: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo_1.10.2-2_win32.zip
37 and http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/cairo-dev_1.10.2-2_win32.zip
39 - glib: http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib_2.28.8-1_win32.zip
40 and http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib-dev_2.28.8-1_win32.zip
42 - libpng: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng_1.4.12-1_win32.zip
43 and http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libpng-dev_1.4.12-1_win32.zip
45 - libxml2: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libxml2_2.9.0-1_win32.zip
46 and http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/libxml2-dev_2.9.0-1_win32.zip
48 - pango: http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.29/pango_1.29.4-1_win32.zip
49 and http://ftp.gnome.org/pub/gnome/binaries/win32/pango/1.29/pango-dev_1.29.4-1_win32.zip
51 - zlib: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib_1.2.5-2_win32.zip
52 and http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib-dev_1.2.5-2_win32.zip
54 - fontconfig: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/fontconfig_2.8.0-2_win32.zip
56 - freetype: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/freetype_2.4.10-1_win32.zip
58 - expat: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/expat_2.1.0-1_win32.zip
60 - gettext: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
62 (3) Extract all of the .zip files into the contrib folder. Do not extract each library into it's own
63 directory. We want all of the files merged into a structure consisting of "bin, include, lib..."
66 (4) Open the Visual Studio 2013 Solution "rrd.sln" in the win32 folder of
67 your rrdtool-folder and build either the project librrd-8 (for the
68 rrdtool-library), rrdtool (for the rrdtool-executable depending on the
69 library) or the complete solution. A post-build event automatically copies
70 all the dlls, needed by rrdtool, next to the .exe, when you build the
71 executable. These DLLs must be available on all hosts where rrdtool will
75 Update VS2008 project from branch 1.4 to VS2013 for the actual master.
76 Change sources for C++ / Windows compatibility.
79 Updated project to include latest files and libraries.
80 Builds static or dynamic rrdlib
83 to help windows deal with the reentrant versions of many unix
84 calls link with win32comp.c
87 The windows implementation of strftime does not seem to support
88 the ISO 8601 week number (%V) I have therefore included the file
89 strftime.[ch] which provides strftime_ ... if you compile rrdtool
90 with -Dstrftime=_strftime and link strftime.o then you will
91 get proper support for %V.
95 As of Jan 2004, code for libraries utilized by rrdtool
96 (png, libart, freetype, and zlib) is no longer distributed with
97 rrdtool. This requires some changes to the compile process on
98 Win32. The solution described here is to compile rrdtool to
99 link against these libraries dynamically. There is an advantage
100 to this approach: namely the rrdtool distribution doesn't have to
101 worry about how to compile these libraries on Win32. In theory,
102 since others already provide and maintain Win32 binaries for these
103 libraries the users don't have to worry about how to compile them
104 either. The disadvantage of this approach is that the DLLs for
105 these libraries must be available on the hosts where rrdtool will run.
107 Here are step by step instructions for compiling rrdtool.exe and
108 the perl shared library (RRDS.dll) with Microsoft Visual C++ 6.0.
109 (1) Download libraries rrdtool depends on from GnuWin32:
110 http://gnuwin32.sourceforge.net/
111 For freetype, libpng, and zlib download the "Complete Package"; each of
112 these will be a self-extracting self-installing executable.
113 For libart, download both the "Binaries" and "Developer Files" packages.
114 Unfortunately at this time GnuWin32 doesn't provide the "Complete Package"
115 installer for libart. Perhaps by the time you are following these
116 instructions GnuWin32 will have a "Complete Package" for libart.
117 (2) Install the GnuWin32 libraries by running the executables for freetype,
118 libpng, and zlib. These instructions and the Visual C++ project files
119 distributed with rrdtool assume that you will use the default install
120 location: C:\Program Files\GnuWin32. Extract the two zip files for libart,
121 libart-2.3.3-bin.zip and libart-2.3.3-1-lib.zip into the GnuWin32 directory;
122 the appropriate libart files will be added to the include, lib, and bin
124 (3) Add C:\Program Files\GnuWin32\bin to the PATH (Control Panel ->
125 System -> Advanced -> Environment Variables).
126 (4) Start Microsoft Visual C++ 6.0. Load the workspace file, rrdtool.dsw,
127 from the src subdirectory of your rrdtool code directory.
128 (5) Compile the Release build of the rrdtool project (since rrdtool depends
129 on the rrd project, the rrd library will also be compiled). At this
130 time, the compile will fail in zconf.h, a zlib header file. The problem
131 is a preprocessor directive that loads unistd.h. Open zconf.h in VC++
132 (this file is in C:\Program Files\GnuWin32\include) and find the following
135 #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */
136 # include <sys/types.h> /* for off_t */
137 # include <unistd.h> /* for SEEK_* and off_t */
139 # include <unixio.h> /* for off_t */
141 # define z_off_t off_t
144 Change it to reads as follows (this is code from zlib-1.1.4):
147 # include <sys/types.h> /* for off_t */
148 # include <unistd.h> /* for SEEK_* and off_t */
150 # include <unixio.h> /* for off_t */
152 # define z_off_t off_t
155 Note that it is actually just a one line change. Save the file and
156 recompile rrdtool. By the time you are following these instructions
157 this issue with zconf.h may be resolved.
158 (6) At this point, you can run the executable rrdtool.exe in the
159 src\toolrelease subdirectory. Note that if you wish to run rrdtool
160 on other machines, you will need the following DLLs installed (on the
161 path) on those machines:
167 The names of the first four DLLs might vary from what is listed here
168 depending on the versions of the packages you downloaded from GnuWin32.
169 The fifth DLL, msvcrt.dll, is a system DLL for most versions of Windows.
170 If you are running on old version of Windows, you can install/upgrade to
171 IE4.0 to get this DLL.
172 (7) To compile the perl-shared library, open a Command Prompt (DOS box)
173 and cd to the bindings\perl-shared subdirectory.
174 (8) Run vcvars32.bat; this batch file, in your vc98\bin directory will
175 set necessary environment options for command line compiling.
176 (9) In bindings\perl-shared, run
180 If nmake test succeeds, you are good to go. RRDs.dll is in
181 blib\arch\auto\RRDs. If you plan to install via the Active State ppm
182 tool, tar and gzip the blib directory. You can use the RRDs.ppd file
183 in bindings\perl-shared directory. Remember that as in the case of
184 rrdtool.exe you will need the DLLs listed in (6) on the machine where
185 you are going to use RRDs.dll.
187 Microsoft Visual C++ 7.1 (.NET 2003):
189 Unfortunately, this is more difficult than with VC++ 6.0. The problem
190 is that by default the C runtime dll for VC++ 7.1 is msvcr71.dll rather
191 than msvcrt.dll. The GnuWin32 library binaries are all compiled
192 to use msvcrt.dll and you can't mix msvcr71.dll and msvcrt.dll in the
193 same process. One option is to download the source code for the libraries
194 (available from http://gnuwin32.sourceforge.net) recompile them with
195 VC++ 7.l. Then all the components will use msvcr71.dll. Once you are
196 going to go this route, you can also use static multi-threaded libraries
197 and use static linking between rrdtool (or RRDs.dll) and its dependencies.
199 To use the GnuWin32 library binaries, you need to trick VC++ 7.1 into
200 compiling rrdtool to use the older msvcrt.dll. Follow steps (1) - (3)
202 (4) Obtain a different version of the msvcrt.lib import library that
203 is compatible with vc7 and points to msvcrt.dll:
204 msvcrtlib_for_vc7.zip from http://xchat.org/win32/testing
205 Backup msvcrt.lib in your vc7\lib directory
206 (\Program Files\Microsoft Visual Studio .NET 2003\vc7\lib)
207 Then extract the msvcrt.lib from the zip file into the vc7\lib directory.
208 WARNING: Use this msvcrt.lib at your own risk! This is not a Microsoft
209 supplied file nor a file supported by anyone associated with rrdtool.
210 (5) Start Microsoft Visual C++ 7.1. Load the solution file, rrdtool.sln,
211 from the src subdirectory of your rrdtool code directory. Edit zconf.h,
212 as needed, as described under (5) above. Compile the release build of
214 Proceed with steps (6) - (9) as above, if you are using/picking up
215 the wrong msvcrt.lib import library then nmake test for perl-shared
218 Note: it is possible in the future that GnuWin32 will provide Win32
219 binaries that utilize msvcr71.dll rather than msvcrt.dll.
223 These notes share some insight I gained compiling 1.1.x with
224 MS Visual C++ 6.0 (using project files). This information may or
225 may not be accurate at the time you are reading this.
227 (1) freetype and rrdtool cannot use precompiled headers (which are
228 enabled by default for MSVC++ projects). MSVC++ 6.0 does not
229 support precompiled headers if #include directives contain MACROS.
230 (2) Compile Release build with Default optimization, not the
231 Maximize Speed optimization. I encountered some strange errors
232 (related to argument processing for complex commands like graph) with
234 (3) libart relies upon config.h (ostensibly generated by the
235 configure script-- but of course not on Win32 platforms). ..\..\confignt
236 (which contains a static Win32 version of config.h) should be on
238 (4) Fonts are located in the %windir%\fonts, so the default font
239 is c:\winnt\fonts\cour.ttf. (6/19/02) At Kerry Calvert's suggestion
240 this setting was moved to confignt\config.h.
241 (5) libart requires a custom build step to generate art_config.h; this
242 is done manually via the commands:
243 cl -I..\..\confignt gen_art_config.c
244 gen_art_config.exe > art_config.h
246 Currently, to compile rrd.lib and rrdtool.exe using
247 the MSVC++ project files, first start MSVC++ 6.0. Open the rrdtool
248 workspace (rrdtool.dsw in the src directory). The active project/
249 configuration should be rrdtool-Win32 Release. Select Rebuild All
250 from the Build menu. The static link library (rrd.lib) will
251 be generated in src\release directory and executable will be generated
252 in the src\toolrelease directory.
254 Compiling RRDtool on NT ... work in progress
255 ---------------------------------------------------------------
256 by Tamas Kovacshazy (khazy@mit.bme.hu)
258 Persisting Problems with the current NT port:
260 Unfortunately, the RRD perl modules does not work with Perl
261 (ActivePerl) using the current distribution.
263 The RRD shared perl module can be compiled after some
268 0. Install perl if you do not have it!
269 Visit http://www.ActiveState.com/pw32/ for a complete distribution.
271 1. Copy ..\gd1.2\release\gd.lib to ..\gd1.2\
272 2. Copy ..\src\release\rrd.lib to ..\src
275 In this step the system complains about something I do not
276 understand. The error message is the following:
278 Note (probably harmless): No library found for '-lm'
280 Is a library missing? But it does not stop with an error...
282 4. nmake test (You must have Visual C++ on the machine!)
284 After these steps it generates the test files (svgs and rrds),
285 and they seem to be good.
287 The real problem in the shared perl module is the following:
289 I do not know how this installation stuff works. The problem is
290 that the installation stuff looks for the gd.lib and the
291 rrd.lib in the ..\gd1.2 and ..\src directory. The UNIX compile
292 puts the files into these directories, but the NT compile does
299 Tamas Kovacshazy E-mail: khazy@mit.bme.hu
300 WWW: http://www.mit.bme.hu/~khazy
301 Technical University of Budapest
302 Department of Measurement and Information Systems
305 Compiling RRDtool 1.2.x on Win32 with MingW32 gcc:
306 ---------------------------------------------------------------
308 1. Obtain and install the current version of the MingW package.
310 http://www.mingw.org/download.shtml
312 In the MinGW set you will need the gcc and binutils as a minimum.
314 2. Obtain either of the following awk versions and install in a directory
319 http://cm.bell-labs.com/cm/cs/awkbook/index.html
321 Note: This version has no dependencies to other libs.
323 - gawk.exe (GnuWin32 version)
325 http://gnuwin32.sourceforge.net/packages/gawk.htm
327 Note: Also fetch the dependent libraries for it from the same page.
329 3. If you plan to create a 'distribution' release of the RRD Tools, the
330 Makefile.Win32 will copy all the needed files to an output directory and
331 then zip the entire directory. A suitable zip utility can be obtained here:
333 http://www.info-zip.org/
335 Install in a directory on your System Path.
337 4. Obtain the following libraries, ideally install them all under a common
342 https://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
347 https://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.12.tar.gz
348 http://libpng.sourceforge.net/
352 https://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.2.1.tar.gz
353 http://freetype.sourceforge.net/index2.html
357 https://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
358 http://www.levien.com/libart/
360 Note: libart_lgpl needs a special tweak because the archive contains
361 only the base directory, but the libart headers are usually included with
362 a directory prefix; therefore create a subfolder 'libart_lgpl' and move
363 all files into this subfolder.
365 5. Set up for DOS environment.
367 Add MingW\bin and MSYS\bin directories to your System path.
369 If the libraries share a common directory set the following environment var:
371 set LIBBASE=<shared director>
372 e.g set LIBBASE=C:\Libraries
374 If the libraries are scattered, set the following environment vers:
376 set ZLIBSDK=<path to zlib>
377 e.g set ZLIBSDK=C:\mytest\zlib-1.2.3
378 set LIBPNG=<path to libpng>
379 set LIBFT2=<path to freetype>
380 set LIBART=<path to libart>
382 If using the Gnu Awk (gawk.exe), edit the Makefile.Win32 and change the line:
390 6. Compile the project.
392 All dependent libs are statically linked in. This has the benefit that the
393 binaries do not depend on any other DLLs.
394 In order to build the static freetype lib enter the freetype base directory
395 and type 'make'. If everything is fine a message appears that gcc is detected,
396 and that you should again type 'make'. Follow that in order to build freetype.
397 All other libs are build from the sources with the RRDtool Makefile.Win32.
399 Switch to the RRDTOOL .\src directory. Then:
401 make -f Makefile.Win32 help
403 to see the build options, or
405 make -f Makefile.Win32 all
407 should build the entire package.
412 written by normw & gk.