Code

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