prepare for the release of rrdtool-1.3rc5
[rrdtool.git] / doc / rrdbuild.pod
1 =head1 NAME
2
3 rrdbuild - Instructions for building RRDtool
4
5 =head1 OVERVIEW
6
7 If you downloaded the source of rrdtool you have to compile it. This
8 document will give some information on how this is done.
9
10 RRDtool relies on services of thrid part libraries. Some of these libraries
11 may already be installed on your system. You have to compile copies of the other
12 ones before you can build RRDtool.
13
14 This document will tell you about all the necessary steps to get going.
15
16 These instructions assume you are using a B<bash> shell. If you use csh/tcsh,
17 then you can either type F<bash> to switch to bash for the compilation or if
18 you know what you are doing just replace the export bits with
19 setenv.
20
21 We further assume that your copies of B<tar> and B<make> are actually B<GNU
22 tar> and B<GNU make> respectively. It could be that they are installed as
23 B<gtar> and B<gmake> on your system.
24
25 =head1 OPTIMISTIC BUILD
26
27 Before you start to build RRDtool, you have to decide two things:
28
29 =over
30
31 =item 1.
32
33 In which directory you want to build the software.
34
35 =item 2.
36
37 Where you want to install the software.
38
39 =back
40
41 Once you have decided. Save the two locations into environment variables.
42
43  BUILD_DIR=/tmp/rrdbuild
44  INSTALL_DIR=/usr/local/rrdtool-1.3rc5
45
46
47 If your F</tmp> is mounted with the option noexec (RHEL seems todo that) you have to choose
48 a different directory!
49
50 Now make sure the BUILD_DIR exists and go there:
51
52  mkdir -p $BUILD_DIR
53  cd $BUILD_DIR
54
55 Lets first assume you already have all the necessary libraries
56 pre-installed. 
57
58  wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3rc5.tar.gz
59  gunzip -c rrdtool-1.3rc5.tar.gz | tar xf -
60  cd rrdtool-1.3rc5
61  ./configure --prefix=$INSTALL_DIR && make && make install
62
63 Ok, this was very optimistic. This try will probably have ended with
64 B<configure> complaining about several missing libraries.
65
66 =head1 INSTALLING DEPENDENCIES
67
68 If your OS lets you install additional packages from a software repository,
69 you may get away with installing the missing packages. When the packages are
70 installed, run configure again and try to compile again. Below you find some
71 hints on getting your OS ready for the rrdtool compilation. Additions to
72 this list are welcome.
73
74 =head2 OpenSolaris 2008.05
75
76 Just add a compiler and the gnome development package:
77
78  pkg install sunstudioexpress
79  pkg install SUNWgnome-common-devel
80
81 There is a a problem with F<cairo.pc> on opensolaris. It suggests that
82 xrender is required for compilation with cairo. This is not true and also
83 bad since opensolaris does not include an F<xrender.pc> file. Use perl to
84 fix this:
85
86  perl -i~ -p -e 's/(Requires.*?)\s*xrender.*/$1/' /usr/lib/pkgconfig/cairo.pc 
87
88 =head2 Debian / Ubuntu
89
90 Use apt-get to make sure you have all that is required. A number
91 of packages will get added through dependencies.
92
93  apt-get install libpango1.0-dev libxml2-dev
94
95 =head1 BUILDING DEPENDENCIES
96
97 But again this may have been too optimistic still, and you actually have to
98 compile your own copies of some of the required libraries. Things like
99 libpng and zlib are pretty standard so you will probably have them on your
100 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
101 possible that they are pretty old and thus don't live up to the
102 expectations, so you may want to compile their latest versions.
103
104 =head3 Build Tipps for AIX
105
106 If you are woking with AIX, you may find the the B<--disable-shared> option
107 will cause things to break for you. In that case you may have to install the
108 shared libraries into the rrdtool PREFIX and work with B<--disable-static>
109 instead.
110
111 Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:
112
113  export CC=/usr/vac/bin/cc
114  export PERLCC=$CC
115
116 (Better instructions for AIX welcome!)
117
118 =head2 Building Libraries
119
120 In order to build the libraries you need a compiler on your system.
121 Unfortunately compilers are not all alike. This has an effect on the CFLAGS
122 you want to set. The examples below are for the popular GCC compiler suite.
123 If you have an other compile you have to use the following settings:
124
125 =over
126
127 =item Sun Forte
128
129  CFLAGS="-xO3 -kPIC"
130
131 =back
132
133 =over 
134
135 Some libraries want to know where other libraries are. For this to work,
136 set the following environamen variable
137
138  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
139  export PATH=$INSTALL_DIR/bin:$PATH
140
141 Since we are compiling libraries dynamically, you they must further know
142 where to find each other. This is done by setting an appropriate LDFLAG.
143 Unfortunatly the syntax differs from system to system:
144
145 =over
146
147 =item Solaris
148
149  export LDFLAGS=-R${INSTALL_DIR}/lib 
150
151 =item Linux
152
153  export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib" 
154
155 If you are on a 64bit platform, but would like to continue to use the rrd files created
156 on your old 32bit linux, you may be able 
157
158 =item HPUX
159  
160  export LDFLAGS="+b${INSTALL_DIR}/lib"
161
162 =item AIX
163
164  export LDFLAGS="-Wl,-blibpath:${INSTALL_DIR}/lib"
165
166 =back 
167
168 If you have GNUmake installed and it is not called 'make',
169 then do
170
171  export MAKE=gmake
172  export GNUMAKE=gmake
173
174 otherwhise just do
175
176  export MAKE=make
177
178 =item Building zlib
179
180 Chances are very high that you already have that on your system ... 
181
182  cd $BUILD_DIR
183  wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
184  gunzip -c zlib-1.2.3.tar.gz | tar xf -
185  cd zlib-1.2.3
186  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared
187  $MAKE
188  $MAKE install
189
190 =item Building libpng
191
192 Libpng itself requires zlib to build, so we need to help a bit. If you
193 already have a copy of zlib on your system (which is very likley) you can
194 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
195 the end of line 4 means that line 4 and line 5 are on one line.
196
197  cd $BUILD_DIR
198  wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
199  gunzip -c libpng-1.2.18.tar.gz | tar xf -
200  cd libpng-1.2.10
201  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
202  $MAKE
203  $MAKE install
204
205 =item Building freetype
206
207  cd $BUILD_DIR
208  wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
209  gunzip -c freetype-2.3.5.tar.gz | tar xf -
210  cd freetype-2.3.5
211  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
212  $MAKE
213  $MAKE install
214
215 If you run into problems building freetype on Solaris, you may want to try to
216 add the following at the start the configure line:
217
218  env EGREP=egrep
219
220 =item Building LibXML2
221
222  cd $BUILD_DIR
223  wget http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-sources-2.6.31.tar.gz
224  gunzip -c libxml2-sources-2.6.32.tar.gz | tar xf -
225  cd libxml2-sources-2.6.32
226  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
227  $MAKE
228  $MAKE install
229
230 =item Building fontconfig
231
232 Note that fontconfig has a runtime configuration file in INSTALL_DIR/etc you
233 may want to adjust that so that fontconfig finds the fonts on your system.
234 Run the fc-cache program to build the fontconfig cache after changeing the
235 config file.
236
237  cd $BUILD_DIR
238  wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz
239  gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -
240  cd fontconfig-2.4.2
241  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
242  $MAKE
243  $MAKE install
244
245 =item Building Pixman
246
247  cd $BUILD_DIR
248  wget http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz
249  gunzip -c pixman-0.10.0.tar.gz  | tar xf -
250  cd fontconfig-2.4.2
251  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
252  $MAKE
253  $MAKE install
254
255 =item Building Cairo
256
257  cd $BUILD_DIR
258  wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz
259  gunzip -c cairo-1.4.10.tar.gz   | tar xf -
260  cd cairo-1.4.10
261  ./configure --prefix=$INSTALL_DIR \
262     --enable-xlib=no \
263     --enable-xlib-render=no \
264     --enable-win32=no \
265     CFLAGS="-O3 -fPIC"
266  $MAKE
267  $MAKE install
268
269 =item Building Glib
270
271  cd $BUILD_DIR
272  wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz
273  gunzip -c glib-2.12.13.tar.gz  | tar xf -
274  cd glib-2.12.13
275  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
276  $MAKE
277  $MAKE install
278
279 =item Building Pango
280
281  cd $BUILD_DIR
282  wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.gz
283  gunzip -c pango-1.21.1.tar.gz  | tar xf -
284  cd pango-1.21.1
285  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x
286  $MAKE
287  $MAKE install
288
289 =back
290
291 Now all the dependent libraries are built and you can try again. This time
292 you tell configure where it should be looking for libraries and include
293 files. This is done via environment variables. Depending on the shell you
294 are running, the syntax for setting environment variables is different.
295
296 And finally try building again. We disable the python and tcl bindings
297 because it seems that a fair number of people have ill configured python and
298 tcl setups that would prevent rrdtool from building if they are included in
299 their current state.
300
301  cd $BUILD_DIR/rrdtool-1.3rc5
302  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
303  $MAKE clean
304  $MAKE
305  $MAKE install
306
307 SOLARIS HINT: if you want to build  the perl module for the native perl (the
308 one shipping with solaris) you will need the sun forte compiler installed on
309 your box or you have to hand-tune bindings/perl-shared/Makefile while
310 building!
311
312 Now go to I<$INSTALL_DIR>B</share/rrdtool/examples/> and run them to see if
313 your build has been successful.
314
315 =head1 AUTHOR
316
317 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
318