e513c78ffc019df3aa48d46b3210fc9a5838bc60
[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.3rc6
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.3rc6.tar.gz
59  gunzip -c rrdtool-1.3rc6.tar.gz | tar xf -
60  cd rrdtool-1.3rc6
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.
72
73 Additions to this list are welcome.
74
75 =head2 OpenSolaris 2008.05
76
77 Just add a compiler and the gnome development package:
78
79  pkg install sunstudioexpress
80  pkg install SUNWgnome-common-devel
81
82 There is a a problem with F<cairo.pc> on opensolaris. It suggests that
83 xrender is required for compilation with cairo. This is not true and also
84 bad since opensolaris does not include an F<xrender.pc> file. Use perl to
85 fix this:
86
87  perl -i~ -p -e 's/(Requires.*?)\s*xrender.*/$1/' /usr/lib/pkgconfig/cairo.pc 
88
89 =head2 Debian / Ubuntu
90
91 Use apt-get to make sure you have all that is required. A number
92 of packages will get added through dependencies.
93
94  apt-get install libpango1.0-dev libxml2-dev
95
96 =head1 BUILDING DEPENDENCIES
97
98 But again this may have been too optimistic still, and you actually have to
99 compile your own copies of some of the required libraries. Things like
100 libpng and zlib are pretty standard so you will probably have them on your
101 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
102 possible that they are pretty old and thus don't live up to our
103 expectations, so you may want to compile their latest versions.
104
105 =head3 Build Tipps for AIX
106
107 If you are woking with AIX, you may find the the B<--disable-shared> option
108 will cause things to break for you. In that case you may have to install the
109 shared libraries into the rrdtool PREFIX and work with B<--disable-static>
110 instead.
111
112 Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:
113
114  export CC=/usr/vac/bin/cc
115  export PERLCC=$CC
116
117 (Better instructions for AIX welcome!)
118
119 =head2 Building Libraries
120
121 In order to build the libraries you need a compiler on your system.
122 Unfortunately compilers are not all alike. This has an effect on the CFLAGS
123 you want to set. The examples below are for the popular GCC compiler suite.
124 If you have an other compilers here are some ides:
125
126 =over
127
128 =item Sun Forte
129
130  CFLAGS="-xO3 -kPIC"
131
132 =back
133
134 =over 
135
136 Some libraries want to know where other libraries are. For this to work,
137 set the following environamen variable
138
139  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
140  export PATH=$INSTALL_DIR/bin:$PATH
141
142 This relies on the presence of the F<pkgconfig> program. Below you find instructions
143 on how to compile pkgconfig as well.
144
145 Since we are compiling libraries dynamically, they must know
146 where to find each other. This is done by setting an appropriate LDFLAG.
147 Unfortunatly, the syntax again differs from system to system:
148
149 =over
150
151 =item Solaris
152
153  export LDFLAGS=-R${INSTALL_DIR}/lib 
154
155 =item Linux
156
157  export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib" 
158
159 =item HPUX
160  
161  export LDFLAGS="+b${INSTALL_DIR}/lib"
162
163 =item AIX
164
165  export LDFLAGS="-Wl,-blibpath:${INSTALL_DIR}/lib"
166
167 =back 
168
169 If you have GNUmake installed and it is not called 'make',
170 then do
171
172  export MAKE=gmake
173  export GNUMAKE=gmake
174
175 otherwhise just do
176
177  export MAKE=make
178
179 =item Building pkgconfig
180
181 As mentioned above, without pkgconfig the whole build process will be lots
182 of pain and suffering, so make sure you have a copy on your system. If it is
183 not available natively, here is how to compile it.
184
185  wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
186  gunzip -c pkg-config-0.23.tar.gz | tar xf -
187  cd pkg-config-0.23
188  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
189  $MAKE
190  $MAKE install
191
192 =item Building zlib
193
194 Chances are very high that you already have that on your system ... 
195
196  cd $BUILD_DIR
197  wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
198  gunzip -c zlib-1.2.3.tar.gz | tar xf -
199  cd zlib-1.2.3
200  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared
201  $MAKE
202  $MAKE install
203
204 =item Building libpng
205
206 Libpng itself requires zlib to build, so we need to help a bit. If you
207 already have a copy of zlib on your system (which is very likley) you can
208 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
209 the end of line 4 means that line 4 and line 5 are on one line.
210
211  cd $BUILD_DIR
212  wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
213  gunzip -c libpng-1.2.18.tar.gz | tar xf -
214  cd libpng-1.2.10
215  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
216  $MAKE
217  $MAKE install
218
219 =item Building freetype
220
221  cd $BUILD_DIR
222  wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
223  gunzip -c freetype-2.3.5.tar.gz | tar xf -
224  cd freetype-2.3.5
225  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
226  $MAKE
227  $MAKE install
228
229 If you run into problems building freetype on Solaris, you may want to try to
230 add the following at the start the configure line:
231
232  env EGREP=egrep
233
234 =item Building LibXML2
235
236  cd $BUILD_DIR
237  wget http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-sources-2.6.31.tar.gz
238  gunzip -c libxml2-sources-2.6.32.tar.gz | tar xf -
239  cd libxml2-sources-2.6.32
240  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
241  $MAKE
242  $MAKE install
243
244 =item Building fontconfig
245
246 Note that fontconfig has a runtime configuration file in INSTALL_DIR/etc you
247 may want to adjust that so that fontconfig finds the fonts on your system.
248 Run the fc-cache program to build the fontconfig cache after changeing the
249 config file.
250
251  cd $BUILD_DIR
252  wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz
253  gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -
254  cd fontconfig-2.4.2
255  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
256  $MAKE
257  $MAKE install
258
259 =item Building Pixman
260
261  cd $BUILD_DIR
262  wget http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz
263  gunzip -c pixman-0.10.0.tar.gz  | tar xf -
264  cd fontconfig-2.4.2
265  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
266  $MAKE
267  $MAKE install
268
269 =item Building Cairo
270
271  cd $BUILD_DIR
272  wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz
273  gunzip -c cairo-1.4.10.tar.gz   | tar xf -
274  cd cairo-1.4.10
275  ./configure --prefix=$INSTALL_DIR \
276     --enable-xlib=no \
277     --enable-xlib-render=no \
278     --enable-win32=no \
279     CFLAGS="-O3 -fPIC"
280  $MAKE
281  $MAKE install
282
283 =item Building Glib
284
285  cd $BUILD_DIR
286  wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz
287  gunzip -c glib-2.12.13.tar.gz  | tar xf -
288  cd glib-2.12.13
289  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
290  $MAKE
291  $MAKE install
292
293 =item Building Pango
294
295  cd $BUILD_DIR
296  wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.gz
297  gunzip -c pango-1.21.1.tar.gz  | tar xf -
298  cd pango-1.21.1
299  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x
300  $MAKE
301  $MAKE install
302
303 =back
304
305 Now all the dependent libraries are built and you can try again. This time
306 you tell configure where it should be looking for libraries and include
307 files. This is done via environment variables. Depending on the shell you
308 are running, the syntax for setting environment variables is different.
309
310 And finally try building again. We disable the python and tcl bindings
311 because it seems that a fair number of people have ill configured python and
312 tcl setups that would prevent rrdtool from building if they are included in
313 their current state.
314
315  cd $BUILD_DIR/rrdtool-1.3rc6
316  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
317  $MAKE clean
318  $MAKE
319  $MAKE install
320
321 SOLARIS HINT: if you want to build  the perl module for the native perl (the
322 one shipping with solaris) you will need the sun forte compiler installed on
323 your box or you have to hand-tune bindings/perl-shared/Makefile while
324 building!
325
326 Now go to I<$INSTALL_DIR>B</share/rrdtool/examples/> and run them to see if
327 your build has been successful.
328
329 =head1 AUTHOR
330
331 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
332