]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/blame - WIN32-BUILD-TIPS.txt
Merge branch 'master' into 2021-07-13_Add_escapeJSON_to_legend_entries
[thirdparty/rrdtool-1.x.git] / WIN32-BUILD-TIPS.txt
CommitLineData
c92ad0e4 1Compiling RRDtool on Win32 with Microsoft Visual C++:
2---------------------------------------------------------------
b1bcbca8 32017-10-02 Wolfgang Stöggl c72578@yahoo.de
c92ad0e4 42010-06-04 Chris Larsen clarsen@euphoriaaudio.com
52008-03-12 Stefan Ludewig stefan.ludewig@exitgames.com
6
2a597646 7Here are step by step instructions for building librrd-8.dll and rrdtool.exe
b1bcbca8 8version 1.4.5 and newer with Microsoft Visual Studio 2013 (12.0.x) and newer.
7c863e9d
WS
9I you would like to build RRDtool using MinGW-w64, please have a look at
10win32/README-MinGW-w64
11
12# Installation of up-to-date, required third party headers and libraries
13
14An efficient way, to obtain headers and libraries required by RRDtool is using vcpkg from:
15https://github.com/microsoft/vcpkg
16
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.
19 cd vcpkg
20
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
24
25Information, how to compile using nmake, can be found here: win32/README
26
27# Legacy instructions
28
29Libraries mentioned in the section below are outdated and not updated any more.
30However, the described procedure still works.
c92ad0e4 31
32(1) Create a folder named "contrib" in the directory where this text file is located.
33
b1bcbca8 34(2) Download the following libraries that rrdtool depends on:
c92ad0e4 35
b1bcbca8
WS
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
c92ad0e4 38
b1bcbca8
WS
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
c92ad0e4 41
b1bcbca8
WS
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
c92ad0e4 44
b1bcbca8
WS
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
c92ad0e4 47
b1bcbca8
WS
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
c92ad0e4 50
b1bcbca8
WS
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
c92ad0e4 53
54 - fontconfig: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/fontconfig_2.8.0-2_win32.zip
55
b1bcbca8 56 - freetype: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/freetype_2.4.10-1_win32.zip
c92ad0e4 57
b1bcbca8
WS
58 - expat: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/expat_2.1.0-1_win32.zip
59
aa27823b
WS
60 - gettext: http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime_0.18.1.1-2_win32.zip
61
c92ad0e4 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..."
64 etc folders.
65
66(4) Open the Visual Studio 2013 Solution "rrd.sln" in the win32 folder of
2a597646 67 your rrdtool-folder and build either the project librrd-8 (for the
c92ad0e4 68 rrdtool-library), rrdtool (for the rrdtool-executable depending on the
b1bcbca8 69 library) or the complete solution. A post-build event automatically copies
c92ad0e4 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
72 run.
73
7424/7/14 Peter
75Update VS2008 project from branch 1.4 to VS2013 for the actual master.
76Change sources for C++ / Windows compatibility.
77
786/10/10 Chris
79Updated project to include latest files and libraries.
80Builds static or dynamic rrdlib
81
825/1/05 Tobi
83to help windows deal with the reentrant versions of many unix
84calls link with win32comp.c
85
864/10/05 Tobi
87The windows implementation of strftime does not seem to support
c8386f39 88the ISO 8601 week number (%V) I have therefore included the file
c92ad0e4 89strftime.[ch] which provides strftime_ ... if you compile rrdtool
90with -Dstrftime=_strftime and link strftime.o then you will
c8386f39 91get proper support for %V.
c92ad0e4 92
937/29/04 Jake Brutlag
94
95As of Jan 2004, code for libraries utilized by rrdtool
96(png, libart, freetype, and zlib) is no longer distributed with
97rrdtool. This requires some changes to the compile process on
98Win32. The solution described here is to compile rrdtool to
99link against these libraries dynamically. There is an advantage
100to this approach: namely the rrdtool distribution doesn't have to
101worry about how to compile these libraries on Win32. In theory,
102since others already provide and maintain Win32 binaries for these
103libraries the users don't have to worry about how to compile them
104either. The disadvantage of this approach is that the DLLs for
105these libraries must be available on the hosts where rrdtool will run.
106
107Here are step by step instructions for compiling rrdtool.exe and
108the perl shared library (RRDS.dll) with Microsoft Visual C++ 6.0.
109(1) Download libraries rrdtool depends on from GnuWin32:
110http://gnuwin32.sourceforge.net/
111For freetype, libpng, and zlib download the "Complete Package"; each of
112these will be a self-extracting self-installing executable.
113For libart, download both the "Binaries" and "Developer Files" packages.
114Unfortunately at this time GnuWin32 doesn't provide the "Complete Package"
115installer for libart. Perhaps by the time you are following these
116instructions GnuWin32 will have a "Complete Package" for libart.
117(2) Install the GnuWin32 libraries by running the executables for freetype,
118libpng, and zlib. These instructions and the Visual C++ project files
119distributed with rrdtool assume that you will use the default install
120location: C:\Program Files\GnuWin32. Extract the two zip files for libart,
121libart-2.3.3-bin.zip and libart-2.3.3-1-lib.zip into the GnuWin32 directory;
122the appropriate libart files will be added to the include, lib, and bin
123subdirectories.
124(3) Add C:\Program Files\GnuWin32\bin to the PATH (Control Panel ->
125System -> Advanced -> Environment Variables).
126(4) Start Microsoft Visual C++ 6.0. Load the workspace file, rrdtool.dsw,
127from the src subdirectory of your rrdtool code directory.
128(5) Compile the Release build of the rrdtool project (since rrdtool depends
129on the rrd project, the rrd library will also be compiled). At this
130time, the compile will fail in zconf.h, a zlib header file. The problem
131is 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
133code block:
134
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 */
138# ifdef VMS
139# include <unixio.h> /* for off_t */
140# endif
141# define z_off_t off_t
142#endif
143
144Change it to reads as follows (this is code from zlib-1.1.4):
145
146#if HAVE_UNISTD_H
147# include <sys/types.h> /* for off_t */
148# include <unistd.h> /* for SEEK_* and off_t */
149# ifdef VMS
150# include <unixio.h> /* for off_t */
151# endif
152# define z_off_t off_t
153#endif
154
155Note that it is actually just a one line change. Save the file and
156recompile rrdtool. By the time you are following these instructions
157this issue with zconf.h may be resolved.
158(6) At this point, you can run the executable rrdtool.exe in the
159src\toolrelease subdirectory. Note that if you wish to run rrdtool
160on other machines, you will need the following DLLs installed (on the
161path) on those machines:
162zlib1.dll
163libpng12.dll
164libart_lgpl.dll
165freetype6.dll
166msvcrt.dll
167The names of the first four DLLs might vary from what is listed here
168depending on the versions of the packages you downloaded from GnuWin32.
169The fifth DLL, msvcrt.dll, is a system DLL for most versions of Windows.
170If you are running on old version of Windows, you can install/upgrade to
171IE4.0 to get this DLL.
172(7) To compile the perl-shared library, open a Command Prompt (DOS box)
173and cd to the bindings\perl-shared subdirectory.
174(8) Run vcvars32.bat; this batch file, in your vc98\bin directory will
175set necessary environment options for command line compiling.
176(9) In bindings\perl-shared, run
177perl ntmake-build
178nmake
179nmake test
180If nmake test succeeds, you are good to go. RRDs.dll is in
181blib\arch\auto\RRDs. If you plan to install via the Active State ppm
182tool, tar and gzip the blib directory. You can use the RRDs.ppd file
183in bindings\perl-shared directory. Remember that as in the case of
184rrdtool.exe you will need the DLLs listed in (6) on the machine where
185you are going to use RRDs.dll.
186
187Microsoft Visual C++ 7.1 (.NET 2003):
188
189Unfortunately, this is more difficult than with VC++ 6.0. The problem
190is that by default the C runtime dll for VC++ 7.1 is msvcr71.dll rather
191than msvcrt.dll. The GnuWin32 library binaries are all compiled
192to use msvcrt.dll and you can't mix msvcr71.dll and msvcrt.dll in the
193same process. One option is to download the source code for the libraries
194(available from http://gnuwin32.sourceforge.net) recompile them with
195VC++ 7.l. Then all the components will use msvcr71.dll. Once you are
196going to go this route, you can also use static multi-threaded libraries
197and use static linking between rrdtool (or RRDs.dll) and its dependencies.
198
199To use the GnuWin32 library binaries, you need to trick VC++ 7.1 into
200compiling rrdtool to use the older msvcrt.dll. Follow steps (1) - (3)
201as above, then:
202(4) Obtain a different version of the msvcrt.lib import library that
203is compatible with vc7 and points to msvcrt.dll:
204msvcrtlib_for_vc7.zip from http://xchat.org/win32/testing
205Backup msvcrt.lib in your vc7\lib directory
206(\Program Files\Microsoft Visual Studio .NET 2003\vc7\lib)
207Then extract the msvcrt.lib from the zip file into the vc7\lib directory.
208WARNING: Use this msvcrt.lib at your own risk! This is not a Microsoft
209supplied file nor a file supported by anyone associated with rrdtool.
210(5) Start Microsoft Visual C++ 7.1. Load the solution file, rrdtool.sln,
211from the src subdirectory of your rrdtool code directory. Edit zconf.h,
212as needed, as described under (5) above. Compile the release build of
213the rrdtool project.
214Proceed with steps (6) - (9) as above, if you are using/picking up
215the wrong msvcrt.lib import library then nmake test for perl-shared
216will fail.
217
218Note: it is possible in the future that GnuWin32 will provide Win32
219binaries that utilize msvcr71.dll rather than msvcrt.dll.
220
2215/14/02 Jake Brutlag
222
223These notes share some insight I gained compiling 1.1.x with
224MS Visual C++ 6.0 (using project files). This information may or
225may not be accurate at the time you are reading this.
226
227(1) freetype and rrdtool cannot use precompiled headers (which are
228enabled by default for MSVC++ projects). MSVC++ 6.0 does not
229support precompiled headers if #include directives contain MACROS.
230(2) Compile Release build with Default optimization, not the
231Maximize Speed optimization. I encountered some strange errors
83530d3e
JMV
232(related to argument processing for complex commands like graph) with
233Maximize Speed.
c92ad0e4 234(3) libart relies upon config.h (ostensibly generated by the
235configure script-- but of course not on Win32 platforms). ..\..\confignt
236(which contains a static Win32 version of config.h) should be on
237the include path.
238(4) Fonts are located in the %windir%\fonts, so the default font
239is c:\winnt\fonts\cour.ttf. (6/19/02) At Kerry Calvert's suggestion
240this setting was moved to confignt\config.h.
241(5) libart requires a custom build step to generate art_config.h; this
242is done manually via the commands:
243cl -I..\..\confignt gen_art_config.c
244gen_art_config.exe > art_config.h
245
246Currently, to compile rrd.lib and rrdtool.exe using
247the MSVC++ project files, first start MSVC++ 6.0. Open the rrdtool
248workspace (rrdtool.dsw in the src directory). The active project/
249configuration should be rrdtool-Win32 Release. Select Rebuild All
250from the Build menu. The static link library (rrd.lib) will
251be generated in src\release directory and executable will be generated
252in the src\toolrelease directory.
253
254Compiling RRDtool on NT ... work in progress
255---------------------------------------------------------------
256 by Tamas Kovacshazy (khazy@mit.bme.hu)
257
258Persisting Problems with the current NT port:
259
260Unfortunately, the RRD perl modules does not work with Perl
261(ActivePerl) using the current distribution.
262
263The RRD shared perl module can be compiled after some
264modification...
265
266Follow these steps:
267
2680. Install perl if you do not have it!
269 Visit http://www.ActiveState.com/pw32/ for a complete distribution.
270
2711. Copy ..\gd1.2\release\gd.lib to ..\gd1.2\
2722. Copy ..\src\release\rrd.lib to ..\src
2733. perl Makefile.pl
274
275In this step the system complains about something I do not
276understand. The error message is the following:
277
278Note (probably harmless): No library found for '-lm'
279
280Is a library missing? But it does not stop with an error...
281
2824. nmake test (You must have Visual C++ on the machine!)
283
284After these steps it generates the test files (svgs and rrds),
285and they seem to be good.
286
c8386f39 287The real problem in the shared perl module is the following:
c92ad0e4 288
289I do not know how this installation stuff works. The problem is
290that the installation stuff looks for the gd.lib and the
291rrd.lib in the ..\gd1.2 and ..\src directory. The UNIX compile
292puts the files into these directories, but the NT compile does
293not.
294
295It is all for today,
296
297khazy
298
299Tamas Kovacshazy E-mail: khazy@mit.bme.hu
300WWW: http://www.mit.bme.hu/~khazy
301Technical University of Budapest
302Department of Measurement and Information Systems
303
304
305Compiling RRDtool 1.2.x on Win32 with MingW32 gcc:
306---------------------------------------------------------------
307
3081. Obtain and install the current version of the MingW package.
309
310 http://www.mingw.org/download.shtml
311
312 In the MinGW set you will need the gcc and binutils as a minimum.
313
3142. Obtain either of the following awk versions and install in a directory
315 on your System Path:
316
317 - awk.exe
318
319 http://cm.bell-labs.com/cm/cs/awkbook/index.html
320
321 Note: This version has no dependencies to other libs.
322
323 - gawk.exe (GnuWin32 version)
324
325 http://gnuwin32.sourceforge.net/packages/gawk.htm
326
c8386f39 327 Note: Also fetch the dependent libraries for it from the same page.
c92ad0e4 328
3293. 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:
332
333 http://www.info-zip.org/
334
335 Install in a directory on your System Path.
336
3374. Obtain the following libraries, ideally install them all under a common
338 directory:
339
340 = zlib
341
267369f9 342 https://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
c92ad0e4 343 http://www.zlib.net/
344
345 = libpng
346
267369f9 347 https://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.12.tar.gz
c92ad0e4 348 http://libpng.sourceforge.net/
349
350 = freetype
351
267369f9 352 https://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.2.1.tar.gz
c92ad0e4 353 http://freetype.sourceforge.net/index2.html
354
355 = libart_lgpl
356
267369f9 357 https://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz
c92ad0e4 358 http://www.levien.com/libart/
359
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.
364
3655. Set up for DOS environment.
366
367 Add MingW\bin and MSYS\bin directories to your System path.
368
369 If the libraries share a common directory set the following environment var:
370
371 set LIBBASE=<shared director>
372 e.g set LIBBASE=C:\Libraries
373
374 If the libraries are scattered, set the following environment vers:
375
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>
381
382 If using the Gnu Awk (gawk.exe), edit the Makefile.Win32 and change the line:
383
384 AWK = awk
385
386 to
387
388 AWK = gawk
389
3906. Compile the project.
391
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.
fe1fd85f 397 All other libs are build from the sources with the RRDtool Makefile.Win32.
c92ad0e4 398
399 Switch to the RRDTOOL .\src directory. Then:
400
401 make -f Makefile.Win32 help
402
403 to see the build options, or
404
405 make -f Makefile.Win32 all
406
407 should build the entire package.
408
4096. Happy Graphing!
410
411
412written by normw & gk.
413
414