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