3 rrdbuild - Instructions for building RRDtool
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.
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.
14 This document will tell you about all the necessary steps to get going.
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
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.
25 =head1 OPTIMISTIC BUILD
27 Before you start to build RRDtool, you have to decide two things:
33 In which directory you want to build the software.
37 Where you want to install the software.
41 Once you have decided. Save the two locations into environment variables.
43 BUILD_DIR=/tmp/rrdbuild
44 INSTALL_DIR=/opt/rrdtool-1.4.3
47 If your F</tmp> is mounted with the option noexec (RHEL seems todo that) you have to choose
48 a different directory!
50 Now make sure the BUILD_DIR exists and go there:
55 Lets first assume you already have all the necessary libraries
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 -
61 ./configure --prefix=$INSTALL_DIR && make && make install
63 Ok, this was very optimistic. This try will probably have ended with
64 B<configure> complaining about several missing libraries.
66 =head1 INSTALLING DEPENDENCIES
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.
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.
77 =head2 OpenSolaris 2008.05
79 Just add a compiler and the gnome development package:
81 pkg install sunstudioexpress
82 pkg install SUNWgnome-common-devel
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
89 perl -i~ -p -e 's/(Requires.*?)\s*xrender.*/$1/' /usr/lib/pkgconfig/cairo.pc
91 Make sure the RRDtool build system finds your new compiler
93 export PATH=/opt/SunStudioExpress/bin
97 Getting NLS to work on old solaris is an open issue ... use
103 =head2 Debian / Ubuntu
105 Use apt-get to make sure you have all that is required. A number
106 of packages will get added through dependencies.
108 apt-get install libpango1.0-dev libxml2-dev
112 In Gentoo installing RRDtool is really simple you just need to B<emerge
113 rrdtool>. All dependencies will be handled automatically by the portage
114 system. The only thing you should care about are USE flags, which allow you
115 fine tune features RRDtool will be built with. Currently the following USE
118 doc - install .html and .txt documentation
119 into /usr/share/doc/rrdtool-1.x.xx/
120 perl - build and install perl language bindings
121 python - build and install python language bindings
122 ruby - build and install ruby language bindings
123 tcl - build and install tcl language bindings
124 rrdcgi - build and install rrdcgi
126 After you've decided which USE flags you need, set them either in
127 F<make.conf> or F</etc/portage/package.use> and finally run:
131 Take a look at Gentoo handbook for further details on how to manage USE
132 flags: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2
134 =head1 BUILDING DEPENDENCIES
136 But again this may have been too optimistic still, and you actually have to
137 compile your own copies of some of the required libraries. Things like
138 libpng and zlib are pretty standard so you will probably have them on your
139 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
140 possible that they are pretty old and thus don't live up to our
141 expectations, so you may want to compile their latest versions.
143 =head2 General build tips for AIX
145 If you are working with AIX, you may find the B<--disable-shared> option
146 will cause things to break for you. In that case you may have to install the
147 shared libraries into the RRDtool PREFIX and work with B<--disable-static>
150 Another hint to get RRDtool working on AIX is to use the IBM XL C Compiler:
152 export CC=/usr/vac/bin/cc
155 (Better instructions for AIX welcome!)
157 =head2 Build Instructions
159 Some libraries want to know where other libraries are. For this to work,
160 set the following environment variable
162 export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
163 export PATH=$INSTALL_DIR/bin:$PATH
165 The above relies on the presence of the F<pkgconfig> program. Below you find instructions
166 on how to compile pkgconfig.
168 Since we are compiling libraries dynamically, they must know where to find
169 each other. This is done by setting an appropriate LDFLAGS. Unfortunately,
170 the syntax again differs from system to system:
176 export LDFLAGS=-R${INSTALL_DIR}/lib
178 if you are using the Sun Studio/Forte compiler, you may also want to set
180 CFLAGS="-xO3 -xcode=pic13" (SPARC)
181 CFLAGS="-xO3 -Kpic" (x86)
185 export LDFLAGS="-Wl,--rpath -Wl,${INSTALL_DIR}/lib"
189 export LDFLAGS="+b${INSTALL_DIR}/lib"
193 export LDFLAGS="-Wl,-blibpath:${INSTALL_DIR}/lib"
197 If you have GNU make installed and it is not called 'make',
207 =head3 Building pkgconfig
209 As mentioned above, without pkgconfig the whole build process will be lots
210 of pain and suffering, so make sure you have a copy on your system. If it is
211 not available natively, here is how to compile it.
213 wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
214 gunzip -c pkg-config-0.23.tar.gz | tar xf -
216 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
220 After installing pkgconfig in a custom directory, setting up the corresponding
221 environment variable will be helpful.
223 export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config
227 Chances are very high that you already have that on your system ...
230 wget http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz
231 gunzip -c zlib-1.2.3.tar.gz | tar xf -
233 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --shared
237 =head3 Building libpng
239 Libpng itself requires zlib to build, so we need to help a bit. If you
240 already have a copy of zlib on your system (which is very likely) you can
241 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
242 the end of line 4 means that line 4 and line 5 are on one line.
245 wget http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz
246 gunzip -c libpng-1.2.18.tar.gz | tar xf -
248 env CFLAGS="-O3 -fPIC" ./configure --prefix=$INSTALL_DIR
252 =head3 Building freetype
255 wget http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz
256 gunzip -c freetype-2.3.5.tar.gz | tar xf -
258 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
262 If you run into problems building freetype on Solaris, you may want to try to
263 add the following at the start the configure line:
267 =head3 Building LibXML2
270 wget http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-2.6.32.tar.gz
271 gunzip -c libxml2-2.6.32.tar.gz | tar xf -
273 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
277 =head3 Building fontconfig
279 Note that fontconfig has a run time configuration file in INSTALL_DIR/etc you
280 may want to adjust that so that fontconfig finds the fonts on your system.
281 Run the fc-cache program to build the fontconfig cache after changing the
285 wget http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz
286 gunzip -c fontconfig-2.4.2.tar.gz | tar xf -
288 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --with-freetype-config=$INSTALL_DIR/bin/freetype-config
292 =head3 Building Pixman
295 wget http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz
296 gunzip -c pixman-0.10.0.tar.gz | tar xf -
298 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
302 =head3 Building Cairo
305 wget http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz
306 gunzip -c cairo-1.6.4.tar.gz | tar xf -
308 ./configure --prefix=$INSTALL_DIR \
310 --enable-xlib-render=no \
316 When building on Solaris you may want todo
318 ./configure --prefix=$INSTALL_DIR \
320 --enable-xlib-render=no \
322 CFLAGS="-O3 -fPIC -D_POSIX_PTHREAD_SEMANTICS"
327 wget http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz
328 gunzip -c glib-2.15.4.tar.gz | tar xf -
330 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC"
334 =head3 Building Pango
337 wget http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.bz2
338 bunzip2 -c pango-1.21.1.tar.bz2 | tar xf -
340 ./configure --prefix=$INSTALL_DIR CFLAGS="-O3 -fPIC" --without-x
344 =head2 Building rrdtool (second try)
346 Now all the dependent libraries are built and you can try again. This time
347 you tell configure where it should be looking for libraries and include
348 files. This is done via environment variables. Depending on the shell you
349 are running, the syntax for setting environment variables is different.
351 And finally try building again. We disable the python and tcl bindings
352 because it seems that a fair number of people have ill configured python and
353 tcl setups that would prevent RRDtool from building if they are included in
356 cd $BUILD_DIR/rrdtool-1.4.3
357 ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
362 SOLARIS HINT: if you want to build the Perl module for the native Perl (the
363 one shipping with Solaris) you will need the Sun Forte compiler installed on
364 your box or you have to hand-tune bindings/perl-shared/Makefile while
367 Now go to I<$INSTALL_DIR>B</share/rrdtool/examples/> and run them to see if
368 your build has been successful.
372 Tobias Oetiker E<lt>tobi@oetiker.chE<gt>