f292ab8ce960c2171eaf473c6d6858bc9cc02c76
[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 third 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.3.2
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.3.2.tar.gz
59  gunzip -c rrdtool-1.3.2.tar.gz | tar xf -
60  cd rrdtool-1.3.2
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 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 Make sure rrdtool finds your new compiler
90
91  export PATH=/opt/SunStudioExpress/bin
92
93 Since there does not seem to be a viable msgfmt tool on OpenSolaris (short
94 of installing it yourself). You have to call configure with the
95
96  --disable-libintl
97
98 option.
99
100 =head2 Debian / Ubuntu
101
102 Use apt-get to make sure you have all that is required. A number
103 of packages will get added through dependencies.
104
105  apt-get install libpango1.0-dev libxml2-dev
106
107 =head2 Gentoo
108
109 In Gentoo installing rrdtool is really simple you just need to B<emerge
110 rrdtool>. All dependencies will be handled automatically by the portage
111 system. The only thing you should care about are USE flags, which allow you
112 fine tune features rrdtool will be built with. Currently the following USE
113 flags are available:
114
115  doc    - install .html and .txt documentation
116           into /usr/share/doc/rrdtool-1.x.xx/
117  perl   - build and install perl language bindings
118  python - build and install python language bindings
119  ruby   - build and install ruby language bindings
120  tcl    - build and install tcl language bindings
121  rrdcgi - build and install rrdcgi
122
123 After you've decided which USE flags you need, set them either in
124 F<make.conf> or F</etc/portage/package.use> and finally run:
125
126  # emerge -va rrdtool
127
128 Take a look at Gentoo handbook for further details on how to manage USE
129 flags: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2
130
131 =head1 BUILDING DEPENDENCIES
132
133 But again this may have been too optimistic still, and you actually have to
134 compile your own copies of some of the required libraries. Things like
135 libpng and zlib are pretty standard so you will probably have them on your
136 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
137 possible that they are pretty old and thus don't live up to our
138 expectations, so you may want to compile their latest versions.
139
140 =head2 General build tips for AIX
141
142 If you are working with AIX, you may find the B<--disable-shared> option
143 will cause things to break for you. In that case you may have to install the
144 shared libraries into the rrdtool PREFIX and work with B<--disable-static>
145 instead.
146
147 Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:
148
149  export CC=/usr/vac/bin/cc
150  export PERLCC=$CC
151
152 (Better instructions for AIX welcome!)
153
154 =head2 Build Instructions
155
156 Some libraries want to know where other libraries are. For this to work,
157 set the following environment variable
158
159  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
160  export PATH=$INSTALL_DIR/bin:$PATH
161
162 The above relies on the presence of the F<pkgconfig> program. Below you find instructions
163 on how to compile pkgconfig.
164
165 Since we are compiling libraries dynamically, they must know where to find
166 each other. This is done by setting an appropriate LDFLAGS. Unfortunately,
167 the syntax again differs from system to system:
168
169 =over
170
171 =item Solaris
172
173  export LDFLAGS=-R${INSTALL_DIR}/lib 
174
175 if you are using the Sun Studio/Forte compiler, you may also want to set
176
177  CFLAGS="-xO3 -xcode=pic13"   (SPARC)
178  CFLAGS="-xO3 -Kpic"          (x86)
179
180 =item Linux
181
182  export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib" 
183
184 =item HPUX
185
186  export LDFLAGS="+b${INSTALL_DIR}/lib"
187
188 =item AIX
189
190  export LDFLAGS="-Wl,-blibpath:${INSTALL_DIR}/lib"
191
192 =back 
193
194 If you have GNU make installed and it is not called 'make',
195 then do
196
197  export MAKE=gmake
198  export GNUMAKE=gmake
199
200 otherwise just do
201
202  export MAKE=make
203
204 =head3 Building pkgconfig
205
206 As mentioned above, without pkgconfig the whole build process will be lots
207 of pain and suffering, so make sure you have a copy on your system. If it is
208 not available natively, here is how to compile it.
209
210  wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
211  gunzip -c pkg-config-0.23.tar.gz | tar xf -
212  cd pkg-config-0.23
213  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
214  $MAKE
215  $MAKE install
216
217 =head3 Building zlib
218
219 Chances are very high that you already have that on your system ... 
220
221  cd $BUILD_DIR
222  wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
223  gunzip -c zlib-1.2.3.tar.gz | tar xf -
224  cd zlib-1.2.3
225  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared
226  $MAKE
227  $MAKE install
228
229 =head3 Building libpng
230
231 Libpng itself requires zlib to build, so we need to help a bit. If you
232 already have a copy of zlib on your system (which is very likely) you can
233 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
234 the end of line 4 means that line 4 and line 5 are on one line.
235
236  cd $BUILD_DIR
237  wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
238  gunzip -c libpng-1.2.18.tar.gz | tar xf -
239  cd libpng-1.2.10
240  env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
241  $MAKE
242  $MAKE install
243
244 =head3 Building freetype
245
246  cd $BUILD_DIR
247  wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
248  gunzip -c freetype-2.3.5.tar.gz | tar xf -
249  cd freetype-2.3.5
250  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
251  $MAKE
252  $MAKE install
253
254 If you run into problems building freetype on Solaris, you may want to try to
255 add the following at the start the configure line:
256
257  env EGREP=egrep
258
259 =head3 Building LibXML2
260
261  cd $BUILD_DIR
262  wget http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-sources-2.6.31.tar.gz
263  gunzip -c libxml2-sources-2.6.31.tar.gz | tar xf -
264  cd libxml2-sources-2.6.31
265  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
266  $MAKE
267  $MAKE install
268
269 =head3 Building fontconfig
270
271 Note that fontconfig has a run time configuration file in INSTALL_DIR/etc you
272 may want to adjust that so that fontconfig finds the fonts on your system.
273 Run the fc-cache program to build the fontconfig cache after changing the
274 config file.
275
276  cd $BUILD_DIR
277  wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz
278  gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -
279  cd fontconfig-2.4.2
280  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
281  $MAKE
282  $MAKE install
283
284 =head3 Building Pixman
285
286  cd $BUILD_DIR
287  wget http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz
288  gunzip -c pixman-0.10.0.tar.gz  | tar xf -
289  cd pixman-0.10.0
290  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
291  $MAKE
292  $MAKE install
293
294 =head3 Building Cairo
295
296  cd $BUILD_DIR
297  wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz
298  gunzip -c cairo-1.6.4.tar.gz   | tar xf -
299  cd cairo-1.4.10
300  ./configure --prefix=$INSTALL_DIR \
301     --enable-xlib=no \
302     --enable-xlib-render=no \
303     --enable-win32=no \
304     CFLAGS="-O3 -fPIC"
305  $MAKE
306  $MAKE install
307
308 =head3 Building Glib
309
310  cd $BUILD_DIR
311  wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz
312  gunzip -c glib-2.15.4.tar.gz  | tar xf -
313  cd glib-2.15.4
314  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
315  $MAKE
316  $MAKE install
317
318 =head3 Building Pango
319
320  cd $BUILD_DIR
321  wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.gz
322  gunzip -c pango-1.21.1.tar.gz  | tar xf -
323  cd pango-1.21.1
324  ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x
325  $MAKE
326  $MAKE install
327
328 =head2 Building rrdtool (second try)
329
330 Now all the dependent libraries are built and you can try again. This time
331 you tell configure where it should be looking for libraries and include
332 files. This is done via environment variables. Depending on the shell you
333 are running, the syntax for setting environment variables is different.
334
335 And finally try building again. We disable the python and tcl bindings
336 because it seems that a fair number of people have ill configured python and
337 tcl setups that would prevent rrdtool from building if they are included in
338 their current state.
339
340  cd $BUILD_DIR/rrdtool-1.3.2
341  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
342  $MAKE clean
343  $MAKE
344  $MAKE install
345
346 SOLARIS HINT: if you want to build  the Perl module for the native Perl (the
347 one shipping with Solaris) you will need the Sun Forte compiler installed on
348 your box or you have to hand-tune bindings/perl-shared/Makefile while
349 building!
350
351 Now go to I<$INSTALL_DIR>B</share/rrdtool/examples/> and run them to see if
352 your build has been successful.
353
354 =head1 AUTHOR
355
356 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>
357