Code

Imported upstream version 1.4.8
[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=/opt/rrdtool-1.4.8</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.4.8.tar.gz">http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.8.tar.gz</a>
110  gunzip -c rrdtool-1.4.8.tar.gz | tar xf -
111  cd rrdtool-1.4.8
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 compiling RRDtool.</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 the RRDtool build system finds your new compiler</p>
140 <pre>
141  export PATH=/opt/SunStudioExpress/bin</pre>
142 <p>
143 </p>
144 <h2><a name="debian___ubuntu">Debian / Ubuntu</a></h2>
145 <p>Use apt-get to make sure you have all that is required. A number
146 of packages will get added through dependencies.</p>
147 <pre>
148  apt-get install libpango1.0-dev libxml2-dev</pre>
149 <p>
150 </p>
151 <h2><a name="gentoo">Gentoo</a></h2>
152 <p>In Gentoo installing RRDtool is really simple you just need to <strong>emerge
153 rrdtool</strong>. All dependencies will be handled automatically by the portage
154 system. The only thing you should care about are USE flags, which allow you
155 fine tune features RRDtool will be built with. Currently the following USE
156 flags are available:</p>
157 <pre>
158  doc    - install .html and .txt documentation
159           into /usr/share/doc/rrdtool-1.x.xx/
160  perl   - build and install perl language bindings
161  python - build and install python language bindings
162  ruby   - build and install ruby language bindings
163  tcl    - build and install tcl language bindings
164  rrdcgi - build and install rrdcgi</pre>
165 <p>After you've decided which USE flags you need, set them either in
166 <em class="file">make.conf</em> or <em class="file">/etc/portage/package.use</em> and finally run:</p>
167 <pre>
168  # emerge -va rrdtool</pre>
169 <p>Take a look at Gentoo handbook for further details on how to manage USE
170 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>
171 <p>
172 </p>
173 <hr />
174 <h1><a name="building_dependencies">BUILDING DEPENDENCIES</a></h1>
175 <p>But again this may have been too optimistic still, and you actually have to
176 compile your own copies of some of the required libraries. Things like
177 libpng and zlib are pretty standard so you will probably have them on your
178 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
179 possible that they are pretty old and thus don't live up to our
180 expectations, so you may want to compile their latest versions.</p>
181 <p>
182 </p>
183 <h2><a name="general_build_tips_for_aix">General build tips for AIX</a></h2>
184 <p>If you are working with AIX, you may find the <strong>--disable-shared</strong> option
185 will cause things to break for you. In that case you may have to install the
186 shared libraries into the RRDtool PREFIX and work with <strong>--disable-static</strong>
187 instead.</p>
188 <p>Another hint to get RRDtool working on AIX is to use the IBM XL C Compiler:</p>
189 <pre>
190  export CC=/usr/vac/bin/cc
191  export PERLCC=$CC</pre>
192 <p>(Better instructions for AIX welcome!)</p>
193 <p>
194 </p>
195 <h2><a name="build_instructions">Build Instructions</a></h2>
196 <p>Some libraries want to know where other libraries are. For this to work,
197 set the following environment variable</p>
198 <pre>
199  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
200  export PATH=$INSTALL_DIR/bin:$PATH</pre>
201 <p>The above relies on the presence of the <em class="file">pkgconfig</em> program. Below you find instructions
202 on how to compile pkgconfig.</p>
203 <p>Since we are compiling libraries dynamically, they must know where to find
204 each other. This is done by setting an appropriate LDFLAGS. Unfortunately,
205 the syntax again differs from system to system:</p>
206 <dl>
207 <dt><strong><a name="solaris" class="item">Solaris</a></strong></dt>
209 <dd>
210 <pre>
211  export LDFLAGS=-R${INSTALL_DIR}/lib</pre>
212 <p>if you are using the Sun Studio/Forte compiler, you may also want to set</p>
213 <pre>
214  CFLAGS=&quot;-xO3 -xcode=pic13&quot;   (SPARC)
215  CFLAGS=&quot;-xO3 -Kpic&quot;          (x86)</pre>
216 </dd>
217 <dt><strong><a name="linux" class="item">Linux</a></strong></dt>
219 <dd>
220 <pre>
221  export LDFLAGS=&quot;-Wl,--rpath -Wl,${INSTALL_DIR}/lib&quot;</pre>
222 </dd>
223 <dt><strong><a name="hpux" class="item">HPUX</a></strong></dt>
225 <dd>
226 <pre>
227  export LDFLAGS=&quot;+b${INSTALL_DIR}/lib&quot;</pre>
228 </dd>
229 <dt><strong><a name="aix" class="item">AIX</a></strong></dt>
231 <dd>
232 <pre>
233  export LDFLAGS=&quot;-Wl,-blibpath:${INSTALL_DIR}/lib&quot;</pre>
234 </dd>
235 </dl>
236 <p>If you have GNU make installed and it is not called 'make',
237 then do</p>
238 <pre>
239  export MAKE=gmake
240  export GNUMAKE=gmake</pre>
241 <p>otherwise just do</p>
242 <pre>
243  export MAKE=make</pre>
244 <p>
245 </p>
246 <h3><a name="building_pkgconfig">Building pkgconfig</a></h3>
247 <p>As mentioned above, without pkgconfig the whole build process will be lots
248 of pain and suffering, so make sure you have a copy on your system. If it is
249 not available natively, here is how to compile it.</p>
250 <pre>
251  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>
252  gunzip -c pkg-config-0.23.tar.gz | tar xf -
253  cd pkg-config-0.23
254  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
255  $MAKE
256  $MAKE install</pre>
257 <p>After installing pkgconfig in a custom directory, setting up the corresponding
258 environment variable will be helpful.</p>
259 <pre>
260  export PKG_CONFIG=$INSTALL_DIR/bin/pkg-config</pre>
261 <p>
262 </p>
263 <h3><a name="building_zlib">Building zlib</a></h3>
264 <p>Chances are very high that you already have that on your system ...</p>
265 <pre>
266  cd $BUILD_DIR
267  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>
268  gunzip -c zlib-1.2.3.tar.gz | tar xf -
269  cd zlib-1.2.3
270  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot; --shared
271  $MAKE
272  $MAKE install</pre>
273 <p>
274 </p>
275 <h3><a name="building_libpng">Building libpng</a></h3>
276 <p>Libpng itself requires zlib to build, so we need to help a bit. If you
277 already have a copy of zlib on your system (which is very likely) you can
278 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
279 the end of line 4 means that line 4 and line 5 are on one line.</p>
280 <pre>
281  cd $BUILD_DIR
282  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>
283  gunzip -c libpng-1.2.18.tar.gz | tar xf -
284  cd libpng-1.2.10
285  env CFLAGS=&quot;-O3 -fPIC&quot; ./configure --prefix=$INSTALL_DIR
286  $MAKE
287  $MAKE install</pre>
288 <p>
289 </p>
290 <h3><a name="building_freetype">Building freetype</a></h3>
291 <pre>
292  cd $BUILD_DIR
293  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>
294  gunzip -c freetype-2.3.5.tar.gz | tar xf -
295  cd freetype-2.3.5
296  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
297  $MAKE
298  $MAKE install</pre>
299 <p>If you run into problems building freetype on Solaris, you may want to try to
300 add the following at the start the configure line:</p>
301 <pre>
302  env EGREP=egrep</pre>
303 <p>
304 </p>
305 <h3><a name="building_libxml2">Building LibXML2</a></h3>
306 <pre>
307  cd $BUILD_DIR
308  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>
309  gunzip -c libxml2-2.6.32.tar.gz | tar xf -
310  cd libxml2-2.6.32
311  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
312  $MAKE
313  $MAKE install</pre>
314 <p>
315 </p>
316 <h3><a name="building_fontconfig">Building fontconfig</a></h3>
317 <p>Note that fontconfig has a run time configuration file in INSTALL_DIR/etc you
318 may want to adjust that so that fontconfig finds the fonts on your system.
319 Run the fc-cache program to build the fontconfig cache after changing the
320 config file.</p>
321 <pre>
322  cd $BUILD_DIR
323  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>
324  gunzip -c fontconfig-2.4.2.tar.gz   | tar xf -
325  cd fontconfig-2.4.2
326  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot; --with-freetype-config=$INSTALL_DIR/bin/freetype-config
327  $MAKE
328  $MAKE install</pre>
329 <p>
330 </p>
331 <h3><a name="building_pixman">Building Pixman</a></h3>
332 <pre>
333  cd $BUILD_DIR
334  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>
335  gunzip -c pixman-0.10.0.tar.gz  | tar xf -
336  cd pixman-0.10.0
337  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
338  $MAKE
339  $MAKE install</pre>
340 <p>
341 </p>
342 <h3><a name="building_cairo">Building Cairo</a></h3>
343 <pre>
344  cd $BUILD_DIR
345  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>
346  gunzip -c cairo-1.6.4.tar.gz   | tar xf -
347  cd cairo-1.6.4
348  ./configure --prefix=$INSTALL_DIR \
349     --enable-xlib=no \
350     --enable-xlib-render=no \
351     --enable-win32=no \
352     CFLAGS=&quot;-O3 -fPIC&quot;
353  $MAKE
354  $MAKE install</pre>
355 <p>When building on Solaris you may want todo</p>
356 <pre>
357  ./configure --prefix=$INSTALL_DIR \
358     --enable-xlib=no \
359     --enable-xlib-render=no \
360     --enable-win32=no \
361     CFLAGS=&quot;-O3 -fPIC -D_POSIX_PTHREAD_SEMANTICS&quot;</pre>
362 <p>
363 </p>
364 <h3><a name="building_glib">Building Glib</a></h3>
365 <pre>
366  cd $BUILD_DIR
367  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>
368  gunzip -c glib-2.15.4.tar.gz  | tar xf -
369  cd glib-2.15.4
370  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot;
371  $MAKE
372  $MAKE install</pre>
373 <p>
374 </p>
375 <h3><a name="building_pango">Building Pango</a></h3>
376 <pre>
377  cd $BUILD_DIR
378  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>
379  bunzip2 -c pango-1.21.1.tar.bz2 | tar xf -
380  cd pango-1.21.1
381  ./configure --prefix=$INSTALL_DIR CFLAGS=&quot;-O3 -fPIC&quot; --without-x
382  $MAKE
383  $MAKE install</pre>
384 <p>
385 </p>
386 <h2><a name="building_rrdtool__second_try_">Building rrdtool (second try)</a></h2>
387 <p>Now all the dependent libraries are built and you can try again. This time
388 you tell configure where it should be looking for libraries and include
389 files. This is done via environment variables. Depending on the shell you
390 are running, the syntax for setting environment variables is different.</p>
391 <p>And finally try building again. We disable the python and tcl bindings
392 because it seems that a fair number of people have ill configured python and
393 tcl setups that would prevent RRDtool from building if they are included in
394 their current state.</p>
395 <pre>
396  cd $BUILD_DIR/rrdtool-1.4.8
397  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
398  $MAKE clean
399  $MAKE
400  $MAKE install</pre>
401 <p>SOLARIS HINT: if you want to build  the Perl module for the native Perl (the
402 one shipping with Solaris) you will need the Sun Forte compiler installed on
403 your box or you have to hand-tune bindings/perl-shared/Makefile while
404 building!</p>
405 <p>Now go to <em>$INSTALL_DIR</em><strong>/share/rrdtool/examples/</strong> and run them to see if
406 your build has been successful.</p>
407 <p>
408 </p>
409 <hr />
410 <h1><a name="author">AUTHOR</a></h1>
411 <p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
413 </body>
415 </html>