added shared library locations into the docs
[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 bash shell. If you use csh/tcsh,
19 then you can either type 'bash' to switch to bash for the compilation or if
20 you know what you are doing just replace 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 Depending on the shell you are using, you can do either (bash,zsh):
45
46  BUILD_DIR=/tmp/rrdbuild
47  INSTALL_DIR=/usr/local/rrdtool-1.2.99907080300
48
49 Or if you run tcsh:
50
51  set BUILD_DIR=/tmp/rrdbuild
52  set INSTALL_DIR=/usr/local/rrdtool-1.2.99907080300
53
54 If your F</tmp> is mounted with the option noexec (RHEL seems todo that) you have to choose
55 a different directory!
56
57 Now make sure the BUILD_DIR exists and go there:
58
59  mkdir -p $BUILD_DIR
60  cd $BUILD_DIR
61
62 Lets first assume you already have all the necessary libraries
63 pre-installed. 
64
65  wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.99907080300.tar.gz
66  gunzip -c rrdtool-1.2.99907080300.tar.gz | tar xf -
67  cd rrdtool-1.2.99907080300
68  ./configure --prefix=$INSTALL_DIR && make && make install
69
70 Ok, this was very optimistic. This try will probably have ended with
71 B<configure> complaining about several missing libraries. If you are on a
72 Linux or *bsd system you may want to just install the missing bits from your
73 software repository. When you do that, make sure you also get the B<-dev>
74 package for each library you install. Once you have the missing bits on
75 board, just re-run the last line of the instructions above.
76
77 But again this may have been too optimistic, and you actually have to
78 compile your own copies of some of the required libraries. Things like
79 libpng and zlib are pretty standard so you will probably have them on your
80 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
81 possible that they are pretty old and thus don't live up to the
82 expectations, so you may want to compile their latest versions.
83
84 =head3 Build Tipps for AIX
85
86 If you are woking with AIX, you may find the the B<--disable-shared> option
87 will cause things to break for you. In that case you may have to install the
88 shared libraries into the rrdtool PREFIX and work with B<--disable-static>
89 instead.
90
91 Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:
92
93  export CC=/usr/vac/bin/cc
94  export PERLCC=$CC
95
96 (Better instructions for AIX welcome!)
97
98 =head2 Building Libraries
99
100 In order to build the libraries you need a compiler on your system.
101 Unfortunately compilers are not all alike. This has an effect on the CFLAGS
102 you want to set. The examples below are for the popular GCC compiler suite.
103 If you have an other compile you have to use the following settings:
104
105 =over
106
107 =item Sun Forte
108
109  CFLAGS="-xO3 -kPIC"
110
111 =back
112
113 =over 
114
115 Some libraries want to know where other libraries are. For this to work,
116 set the following environamen variable
117
118  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
119  export PATH=$INSTALL_DIR/bin:$PATH
120
121 Since we are compiling libraries dynamically, you they must further know
122 where to find each other. This is done by setting an appropriate LDFLAG.
123 Unfortunatly the syntax differs from system to system:
124
125 =over
126
127 =item Solaris
128
129  export LDFLAGS=-R${INSTALL_DIR}/lib 
130
131 =item Linux
132
133  export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib" 
134
135 =item HPUX
136  
137  export LDFLAGS="+b${INSTALL_DIR}/lib"
138
139 =item AIX
140
141  export LDFLAGS="-Wl,-blibpath:${INSTALL_DIR}/lib"
142
143 =back 
144
145 If you have GNUmake installed and it is not called 'make',
146 then do
147
148  export MAKE=gmake
149  export GNUMAKE=gmake
150
151 otherwhise just do
152
153  export MAKE=make
154
155  
156 =item Building zlib
157
158 Chances are very high that you already have that on your system ... 
159
160  cd $BUILD_DIR
161  wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
162  gunzip -c zlib-1.2.3.tar.gz | tar xf -
163  cd zlib-1.2.3
164  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
165  $MAKE
166  $MAKE install
167
168 =item Building libpng
169
170 Libpng itself requires zlib to build, so we need to help a bit. If you
171 already have a copy of zlib on your system (which is very likley) you can
172 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
173 the end of line 4 means that line 4 and line 5 are on one line.
174
175  cd $BUILD_DIR
176  wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
177  gunzip -c libpng-1.2.18.tar.gz | tar xf -
178  cd libpng-1.2.10
179  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
180  $MAKE
181  $MAKE install
182
183 =item Building freetype
184
185  cd $BUILD_DIR
186  wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
187  gunzip -c freetype-2.3.5.tar.gz | tar xf -
188  cd freetype-2.3.5
189  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
190  $MAKE   (or gmake)
191  $MAKE install (or gmake install)
192
193 If you run into problems building freetype on Solaris, you may want to try to
194 add the following at the start the configure line:
195
196  env GNUMAKE=gmake EGREP=egrep
197
198 =item Building fontconfig
199
200 Note that fontconfig has a runtime configuration file in INSTALL_DIR/etc you
201 may want to adjust that so that fontconfig finds the fonts on your system.
202 Run the fc-cache program to build the fontconfig cache after changeing the
203 config file.
204
205  cd $BUILD_DIR
206  wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz
207  gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -
208  cd fontconfig-2.4.2
209  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
210  $MAKE
211  $MAKE install
212
213 =item Building Cairo
214
215  cd $BUILD_DIR
216  wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.4.10.tar.gz
217  gunzip -c cairo-1.4.10.tar.gz   | tar xf -
218  cd cairo-1.4.10
219  ./configure --prefix=$INSTALL_DIR \
220     --enable-xlib=no \
221     --enable-xlib-render=no \
222     --enable-win32=no \
223     CFLAGS="-O3 -fPIC"
224  $MAKE
225  $MAKE install
226
227 =item Building Glib
228
229  cd $BUILD_DIR
230  wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.12.13.tar.gz
231  gunzip -c glib-2.12.13.tar.gz  | tar xf -
232  cd glib-2.12.13
233  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
234  $MAKE
235  $MAKE install
236
237 =item Building Pango
238
239  cd $BUILD_DIR
240  wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.17.5.tar.gz
241  gunzip -c pango-1.17.5.tar.gz  | tar xf -
242  cd pango-1.17.5
243  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
244  $MAKE
245  $MAKE install
246
247 =back
248
249 Now all the dependent libraries are built and you can try again. This time
250 you tell configure where it should be looking for libraries and include
251 files. This is done via environment variables. Depending on the shell you
252 are running, the syntax for setting environment variables is different.
253
254  CPPFLAGS=-I$INSTALL_DIR/include
255  LDFLAGS="-R$INSTALL_DIR/lib -L$INSTALL_DIR/lib"
256  CFLAGS=-O3
257  export CPPFLAGS LDFLAGS CFLAGS
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