Code

Imported upstream SVN snapshot 1.4~rc2+20090928.
[pkg-rrdtool.git] / doc / rrdbuild.html
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>rrdbuild</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:root@localhost" />
8 </head>
10 <body style="background-color: white">
13 <!-- INDEX BEGIN -->
14 <div name="index">
15 <p><a name="__index__"></a></p>
16 <!--
18 <ul>
20         <li><a href="#name">NAME</a></li>
21         <li><a href="#overview">OVERVIEW</a></li>
22         <li><a href="#optimistic_build">OPTIMISTIC BUILD</a></li>
23         <li><a href="#installing_dependencies">INSTALLING DEPENDENCIES</a></li>
24         <ul>
26                 <li><a href="#opensolaris_2008_05">OpenSolaris 2008.05</a></li>
27                 <li><a href="#debian___ubuntu">Debian / Ubuntu</a></li>
28                 <li><a href="#gentoo">Gentoo</a></li>
29         </ul>
31         <li><a href="#building_dependencies">BUILDING DEPENDENCIES</a></li>
32         <ul>
34                 <li><a href="#general_build_tips_for_aix">General build tips for AIX</a></li>
35                 <li><a href="#build_instructions">Build Instructions</a></li>
36                 <ul>
38                         <li><a href="#building_pkgconfig">Building pkgconfig</a></li>
39                         <li><a href="#building_zlib">Building zlib</a></li>
40                         <li><a href="#building_libpng">Building libpng</a></li>
41                         <li><a href="#building_freetype">Building freetype</a></li>
42                         <li><a href="#building_libxml2">Building LibXML2</a></li>
43                         <li><a href="#building_fontconfig">Building fontconfig</a></li>
44                         <li><a href="#building_pixman">Building Pixman</a></li>
45                         <li><a href="#building_cairo">Building Cairo</a></li>
46                         <li><a href="#building_glib">Building Glib</a></li>
47                         <li><a href="#building_pango">Building Pango</a></li>
48                 </ul>
50                 <li><a href="#building_rrdtool__second_try_">Building rrdtool (second try)</a></li>
51         </ul>
53         <li><a href="#author">AUTHOR</a></li>
54 </ul>
56 -->
59 </div>
60 <!-- INDEX END -->
62 <p>
63 </p>
64 <h1><a name="name">NAME</a></h1>
65 <p>rrdbuild - Instructions for building RRDtool</p>
66 <p>
67 </p>
68 <hr />
69 <h1><a name="overview">OVERVIEW</a></h1>
70 <p>If you downloaded the source of rrdtool you have to compile it. This
71 document will give some information on how this is done.</p>
72 <p>RRDtool relies on services of third part libraries. Some of these libraries
73 may already be installed on your system. You have to compile copies of the other
74 ones before you can build RRDtool.</p>
75 <p>This document will tell you about all the necessary steps to get going.</p>
76 <p>These instructions assume you are using a <strong>bash</strong> shell. If you use csh/tcsh,
77 then you can either type <em class="file">bash</em> to switch to bash for the compilation or if
78 you know what you are doing just replace the export bits with
79 setenv.</p>
80 <p>We further assume that your copies of <strong>tar</strong> and <strong>make</strong> are actually <strong>GNU
81 tar</strong> and <strong>GNU make</strong> respectively. It could be that they are installed as
82 <strong>gtar</strong> and <strong>gmake</strong> on your system.</p>
83 <p>
84 </p>
85 <hr />
86 <h1><a name="optimistic_build">OPTIMISTIC BUILD</a></h1>
87 <p>Before you start to build RRDtool, you have to decide two things:</p>
88 <ol>
89 <li>
90 <p>In which directory you want to build the software.</p>
91 </li>
92 <li>
93 <p>Where you want to install the software.</p>
94 </li>
95 </ol>
96 <p>Once you have decided. Save the two locations into environment variables.</p>
97 <pre>
98  BUILD_DIR=/tmp/rrdbuild
99  INSTALL_DIR=/usr/local/rrdtool-1.3.2</pre>
100 <p>If your <em class="file">/tmp</em> is mounted with the option noexec (RHEL seems todo that) you have to choose
101 a different directory!</p>
102 <p>Now make sure the BUILD_DIR exists and go there:</p>
103 <pre>
104  mkdir -p $BUILD_DIR
105  cd $BUILD_DIR</pre>
106 <p>Lets first assume you already have all the necessary libraries
107 pre-installed.</p>
108 <pre>
109  wget <a href="http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.2.tar.gz">http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.2.tar.gz</a>
110  gunzip -c rrdtool-1.3.2.tar.gz | tar xf -
111  cd rrdtool-1.3.2
112  ./configure --prefix=$INSTALL_DIR &amp;&amp; make &amp;&amp; make install</pre>
113 <p>Ok, this was very optimistic. This try will probably have ended with
114 <strong>configure</strong> complaining about several missing libraries.</p>
115 <p>
116 </p>
117 <hr />
118 <h1><a name="installing_dependencies">INSTALLING DEPENDENCIES</a></h1>
119 <p>If your OS lets you install additional packages from a software repository,
120 you may get away with installing the missing packages. When the packages are
121 installed, run configure again and try to compile again. Below you find some
122 hints on getting your OS ready for the rrdtool compilation.</p>
123 <p>Additions to this list are welcome. In general rrdtool should work with the
124 latest versions of the libraries. The versions listed here are just what was
125 current when I tested this.</p>
126 <p>
127 </p>
128 <h2><a name="opensolaris_2008_05">OpenSolaris 2008.05</a></h2>
129 <p>Just add a compiler and the gnome development package:</p>
130 <pre>
131  pkg install sunstudioexpress
132  pkg install SUNWgnome-common-devel</pre>
133 <p>There is a problem with <em class="file">cairo.pc</em> on OpenSolaris. It suggests that
134 xrender is required for compilation with cairo. This is not true and also
135 bad since OpenSolaris does not include an <em class="file">xrender.pc</em> file. Use Perl to
136 fix this:</p>
137 <pre>
138  perl -i~ -p -e 's/(Requires.*?)\s*xrender.*/$1/' /usr/lib/pkgconfig/cairo.pc</pre>
139 <p>Make sure rrdtool finds your new compiler</p>
140 <pre>
141  export PATH=/opt/SunStudioExpress/bin</pre>
142 <p>Since there does not seem to be a viable msgfmt tool on OpenSolaris (short
143 of installing it yourself). You have to call configure with the</p>
144 <pre>
145  --disable-libintl</pre>
146 <p>option.</p>
147 <p>
148 </p>
149 <h2><a name="debian___ubuntu">Debian / Ubuntu</a></h2>
150 <p>Use apt-get to make sure you have all that is required. A number
151 of packages will get added through dependencies.</p>
152 <pre>
153  apt-get install libpango1.0-dev libxml2-dev</pre>
154 <p>
155 </p>
156 <h2><a name="gentoo">Gentoo</a></h2>
157 <p>In Gentoo installing rrdtool is really simple you just need to <strong>emerge
158 rrdtool</strong>. All dependencies will be handled automatically by the portage
159 system. The only thing you should care about are USE flags, which allow you
160 fine tune features rrdtool will be built with. Currently the following USE
161 flags are available:</p>
162 <pre>
163  doc    - install .html and .txt documentation
164           into /usr/share/doc/rrdtool-1.x.xx/
165  perl   - build and install perl language bindings
166  python - build and install python language bindings
167  ruby   - build and install ruby language bindings
168  tcl    - build and install tcl language bindings
169  rrdcgi - build and install rrdcgi</pre>
170 <p>After you've decided which USE flags you need, set them either in
171 <em class="file">make.conf</em> or <em class="file">/etc/portage/package.use</em> and finally run:</p>
172 <pre>
173  # emerge -va rrdtool</pre>
174 <p>Take a look at Gentoo handbook for further details on how to manage USE
175 flags: <a href="http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2">http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2</a></p>
176 <p>
177 </p>
178 <hr />
179 <h1><a name="building_dependencies">BUILDING DEPENDENCIES</a></h1>
180 <p>But again this may have been too optimistic still, and you actually have to
181 compile your own copies of some of the required libraries. Things like
182 libpng and zlib are pretty standard so you will probably have them on your
183 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
184 possible that they are pretty old and thus don't live up to our
185 expectations, so you may want to compile their latest versions.</p>
186 <p>
187 </p>
188 <h2><a name="general_build_tips_for_aix">General build tips for AIX</a></h2>
189 <p>If you are working with AIX, you may find the <strong>--disable-shared</strong> option
190 will cause things to break for you. In that case you may have to install the
191 shared libraries into the rrdtool PREFIX and work with <strong>--disable-static</strong>
192 instead.</p>
193 <p>Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:</p>
194 <pre>
195  export CC=/usr/vac/bin/cc
196  export PERLCC=$CC</pre>
197 <p>(Better instructions for AIX welcome!)</p>
198 <p>
199 </p>
200 <h2><a name="build_instructions">Build Instructions</a></h2>
201 <p>Some libraries want to know where other libraries are. For this to work,
202 set the following environment variable</p>
203 <pre>
204  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
205  export PATH=$INSTALL_DIR/bin:$PATH</pre>
206 <p>The above relies on the presence of the <em class="file">pkgconfig</em> program. Below you find instructions
207 on how to compile pkgconfig.</p>
208 <p>Since we are compiling libraries dynamically, they must know where to find
209 each other. This is done by setting an appropriate LDFLAGS. Unfortunately,
210 the syntax again differs from system to system:</p>
211 <dl>
212 <dt><strong><a name="solaris" class="item">Solaris</a></strong></dt>
214 <dd>
215 <pre>
216  export LDFLAGS=-R${INSTALL_DIR}/lib</pre>
217 <p>if you are using the Sun Studio/Forte compiler, you may also want to set</p>
218 <pre>
219  CFLAGS=&quot;-xO3 -xcode=pic13&quot;   (SPARC)
220  CFLAGS=&quot;-xO3 -Kpic&quot;          (x86)</pre>
221 </dd>
222 <dt><strong><a name="linux" class="item">Linux</a></strong></dt>
224 <dd>
225 <pre>
226  export LDFLAGS=&quot;-Wl,--rpath -Wl,${INSTALL_DIR}/lib&quot;</pre>
227 </dd>
228 <dt><strong><a name="hpux" class="item">HPUX</a></strong></dt>
230 <dd>
231 <pre>
232  export LDFLAGS=&quot;+b${INSTALL_DIR}/lib&quot;</pre>
233 </dd>
234 <dt><strong><a name="aix" class="item">AIX</a></strong></dt>
236 <dd>
237 <pre>
238  export LDFLAGS=&quot;-Wl,-blibpath:${INSTALL_DIR}/lib&quot;</pre>
239 </dd>
240 </dl>
241 <p>If you have GNU make installed and it is not called 'make',
242 then do</p>
243 <pre>
244  export MAKE=gmake
245  export GNUMAKE=gmake</pre>
246 <p>otherwise just do</p>
247 <pre>
248  export MAKE=make</pre>
249 <p>
250 </p>
251 <h3><a name="building_pkgconfig">Building pkgconfig</a></h3>
252 <p>As mentioned above, without pkgconfig the whole build process will be lots
253 of pain and suffering, so make sure you have a copy on your system. If it is
254 not available natively, here is how to compile it.</p>
255 <pre>
256  wget <a href="http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz">http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz</a>
257  gunzip -c pkg-config-0.23.tar.gz | tar xf -
258  cd pkg-config-0.23
259  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
260  $MAKE
261  $MAKE install</pre>
262 <p>After installing pkgconfig in a custom directory, setting up the corresponding
263 environment variable will be helpful.</p>
264 <pre>
265  export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config</pre>
266 <p>
267 </p>
268 <h3><a name="building_zlib">Building zlib</a></h3>
269 <p>Chances are very high that you already have that on your system ...</p>
270 <pre>
271  cd $BUILD_DIR
272  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/zlib-1.2.3.tar.gz</a>
273  gunzip -c zlib-1.2.3.tar.gz | tar xf -
274  cd zlib-1.2.3
275  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot; --shared
276  $MAKE
277  $MAKE install</pre>
278 <p>
279 </p>
280 <h3><a name="building_libpng">Building libpng</a></h3>
281 <p>Libpng itself requires zlib to build, so we need to help a bit. If you
282 already have a copy of zlib on your system (which is very likely) you can
283 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
284 the end of line 4 means that line 4 and line 5 are on one line.</p>
285 <pre>
286  cd $BUILD_DIR
287  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.18.tar.gz</a>
288  gunzip -c libpng-1.2.18.tar.gz | tar xf -
289  cd libpng-1.2.10
290  env CFLAGS=&quot;-O3 -fPIC&quot; ./configure --prefix=$INSTALL_DIR
291  $MAKE
292  $MAKE install</pre>
293 <p>
294 </p>
295 <h3><a name="building_freetype">Building freetype</a></h3>
296 <pre>
297  cd $BUILD_DIR
298  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.3.5.tar.gz</a>
299  gunzip -c freetype-2.3.5.tar.gz | tar xf -
300  cd freetype-2.3.5
301  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
302  $MAKE
303  $MAKE install</pre>
304 <p>If you run into problems building freetype on Solaris, you may want to try to
305 add the following at the start the configure line:</p>
306 <pre>
307  env EGREP=egrep</pre>
308 <p>
309 </p>
310 <h3><a name="building_libxml2">Building LibXML2</a></h3>
311 <pre>
312  cd $BUILD_DIR
313  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-2.6.32.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/libxml2-2.6.32.tar.gz</a>
314  gunzip -c libxml2-2.6.32.tar.gz | tar xf -
315  cd libxml2-2.6.32
316  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
317  $MAKE
318  $MAKE install</pre>
319 <p>
320 </p>
321 <h3><a name="building_fontconfig">Building fontconfig</a></h3>
322 <p>Note that fontconfig has a run time configuration file in INSTALL_DIR/etc you
323 may want to adjust that so that fontconfig finds the fonts on your system.
324 Run the fc-cache program to build the fontconfig cache after changing the
325 config file.</p>
326 <pre>
327  cd $BUILD_DIR
328  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/fontconfig-2.4.2.tar.gz</a>
329  gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -
330  cd fontconfig-2.4.2
331  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot; --with-freetype-config=$INSTALL_DIR/bin/freetype-config
332  $MAKE
333  $MAKE install</pre>
334 <p>
335 </p>
336 <h3><a name="building_pixman">Building Pixman</a></h3>
337 <pre>
338  cd $BUILD_DIR
339  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/pixman-0.10.0.tar.gz</a>
340  gunzip -c pixman-0.10.0.tar.gz  | tar xf -
341  cd pixman-0.10.0
342  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
343  $MAKE
344  $MAKE install</pre>
345 <p>
346 </p>
347 <h3><a name="building_cairo">Building Cairo</a></h3>
348 <pre>
349  cd $BUILD_DIR
350  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/cairo-1.6.4.tar.gz</a>
351  gunzip -c cairo-1.6.4.tar.gz   | tar xf -
352  cd cairo-1.4.10
353  ./configure --prefix=$INSTALL_DIR \
354     --enable-xlib=no \
355     --enable-xlib-render=no \
356     --enable-win32=no \
357     CFLAGS=&quot;-O3 -fPIC&quot;
358  $MAKE
359  $MAKE install</pre>
360 <p>
361 </p>
362 <h3><a name="building_glib">Building Glib</a></h3>
363 <pre>
364  cd $BUILD_DIR
365  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/glib-2.15.4.tar.gz</a>
366  gunzip -c glib-2.15.4.tar.gz  | tar xf -
367  cd glib-2.15.4
368  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
369  $MAKE
370  $MAKE install</pre>
371 <p>
372 </p>
373 <h3><a name="building_pango">Building Pango</a></h3>
374 <pre>
375  cd $BUILD_DIR
376  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.bz2">http://oss.oetiker.ch/rrdtool/pub/libs/pango-1.21.1.tar.bz2</a>
377  bunzip2 -c pango-1.21.1.tar.bz2 | tar xf -
378  cd pango-1.21.1
379  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot; --without-x
380  $MAKE
381  $MAKE install</pre>
382 <p>
383 </p>
384 <h2><a name="building_rrdtool__second_try_">Building rrdtool (second try)</a></h2>
385 <p>Now all the dependent libraries are built and you can try again. This time
386 you tell configure where it should be looking for libraries and include
387 files. This is done via environment variables. Depending on the shell you
388 are running, the syntax for setting environment variables is different.</p>
389 <p>And finally try building again. We disable the python and tcl bindings
390 because it seems that a fair number of people have ill configured python and
391 tcl setups that would prevent rrdtool from building if they are included in
392 their current state.</p>
393 <pre>
394  cd $BUILD_DIR/rrdtool-1.3.2
395  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
396  $MAKE clean
397  $MAKE
398  $MAKE install</pre>
399 <p>SOLARIS HINT: if you want to build  the Perl module for the native Perl (the
400 one shipping with Solaris) you will need the Sun Forte compiler installed on
401 your box or you have to hand-tune bindings/perl-shared/Makefile while
402 building!</p>
403 <p>Now go to <em>$INSTALL_DIR</em><strong>/share/rrdtool/examples/</strong> and run them to see if
404 your build has been successful.</p>
405 <p>
406 </p>
407 <hr />
408 <h1><a name="author">AUTHOR</a></h1>
409 <p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
411 </body>
413 </html>