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