Code

Merge branch 'upstream'
[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                 <li><a href="#general_build_tips_for_aix">General build tips for AIX</a></li>
33                 <li><a href="#build_instructions">Build Instructions</a></li>
34                 <ul>
36                         <li><a href="#building_pkgconfig">Building pkgconfig</a></li>
37                         <li><a href="#building_zlib">Building zlib</a></li>
38                         <li><a href="#building_libpng">Building libpng</a></li>
39                         <li><a href="#building_freetype">Building freetype</a></li>
40                         <li><a href="#building_libxml2">Building LibXML2</a></li>
41                         <li><a href="#building_fontconfig">Building fontconfig</a></li>
42                         <li><a href="#building_pixman">Building Pixman</a></li>
43                         <li><a href="#building_cairo">Building Cairo</a></li>
44                         <li><a href="#building_glib">Building Glib</a></li>
45                         <li><a href="#building_pango">Building Pango</a></li>
46                 </ul>
48                 <li><a href="#building_rrdtool__second_try_">Building rrdtool (second try)</a></li>
49         </ul>
51         <li><a href="#author">AUTHOR</a></li>
52 </ul>
53 -->
54 <!-- INDEX END -->
56 <p>
57 </p>
58 <h1><a name="name">NAME</a></h1>
59 <p>rrdbuild - Instructions for building RRDtool</p>
60 <p>
61 </p>
62 <hr />
63 <h1><a name="overview">OVERVIEW</a></h1>
64 <p>If you downloaded the source of rrdtool you have to compile it. This
65 document will give some information on how this is done.</p>
66 <p>RRDtool relies on services of third part libraries. Some of these libraries
67 may already be installed on your system. You have to compile copies of the other
68 ones before you can build RRDtool.</p>
69 <p>This document will tell you about all the necessary steps to get going.</p>
70 <p>These instructions assume you are using a <strong>bash</strong> shell. If you use csh/tcsh,
71 then you can either type <em>bash</em> to switch to bash for the compilation or if
72 you know what you are doing just replace the export bits with
73 setenv.</p>
74 <p>We further assume that your copies of <strong>tar</strong> and <strong>make</strong> are actually <strong>GNU
75 tar</strong> and <strong>GNU make</strong> respectively. It could be that they are installed as
76 <strong>gtar</strong> and <strong>gmake</strong> on your system.</p>
77 <p>
78 </p>
79 <hr />
80 <h1><a name="optimistic_build">OPTIMISTIC BUILD</a></h1>
81 <p>Before you start to build RRDtool, you have to decide two things:</p>
82 <ol>
83 <li>
84 <p>In which directory you want to build the software.</p>
85 </li>
86 <li>
87 <p>Where you want to install the software.</p>
88 </li>
89 </ol>
90 <p>Once you have decided. Save the two locations into environment variables.</p>
91 <pre>
92  BUILD_DIR=/tmp/rrdbuild
93  INSTALL_DIR=/usr/local/rrdtool-1.3.7</pre>
94 <p>If your <em>/tmp</em> is mounted with the option noexec (RHEL seems todo that) you have to choose
95 a different directory!</p>
96 <p>Now make sure the BUILD_DIR exists and go there:</p>
97 <pre>
98  mkdir -p $BUILD_DIR
99  cd $BUILD_DIR</pre>
100 <p>Lets first assume you already have all the necessary libraries
101 pre-installed.</p>
102 <pre>
103  wget <a href="http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.7.tar.gz">http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.3.7.tar.gz</a>
104  gunzip -c rrdtool-1.3.7.tar.gz | tar xf -
105  cd rrdtool-1.3.7
106  ./configure --prefix=$INSTALL_DIR &amp;&amp; make &amp;&amp; make install</pre>
107 <p>Ok, this was very optimistic. This try will probably have ended with
108 <strong>configure</strong> complaining about several missing libraries.</p>
109 <p>
110 </p>
111 <hr />
112 <h1><a name="installing_dependencies">INSTALLING DEPENDENCIES</a></h1>
113 <p>If your OS lets you install additional packages from a software repository,
114 you may get away with installing the missing packages. When the packages are
115 installed, run configure again and try to compile again. Below you find some
116 hints on getting your OS ready for the rrdtool compilation.</p>
117 <p>Additions to this list are welcome. In general rrdtool should work with the
118 latest versions of the libraries. The versions listed here are just what was
119 current when I tested this.</p>
120 <p>
121 </p>
122 <h2><a name="opensolaris_2008_05">OpenSolaris 2008.05</a></h2>
123 <p>Just add a compiler and the gnome development package:</p>
124 <pre>
125  pkg install sunstudioexpress
126  pkg install SUNWgnome-common-devel</pre>
127 <p>There is a problem with <em>cairo.pc</em> on OpenSolaris. It suggests that
128 xrender is required for compilation with cairo. This is not true and also
129 bad since OpenSolaris does not include an <em>xrender.pc</em> file. Use Perl to
130 fix this:</p>
131 <pre>
132  perl -i~ -p -e 's/(Requires.*?)\s*xrender.*/$1/' /usr/lib/pkgconfig/cairo.pc</pre>
133 <p>Make sure rrdtool finds your new compiler</p>
134 <pre>
135  export PATH=/opt/SunStudioExpress/bin</pre>
136 <p>Since there does not seem to be a viable msgfmt tool on OpenSolaris (short
137 of installing it yourself). You have to call configure with the</p>
138 <pre>
139  --disable-libintl</pre>
140 <p>option.</p>
141 <p>
142 </p>
143 <h2><a name="debian___ubuntu">Debian / Ubuntu</a></h2>
144 <p>Use apt-get to make sure you have all that is required. A number
145 of packages will get added through dependencies.</p>
146 <pre>
147  apt-get install libpango1.0-dev libxml2-dev</pre>
148 <p>
149 </p>
150 <h2><a name="gentoo">Gentoo</a></h2>
151 <p>In Gentoo installing rrdtool is really simple you just need to <strong>emerge
152 rrdtool</strong>. All dependencies will be handled automatically by the portage
153 system. The only thing you should care about are USE flags, which allow you
154 fine tune features rrdtool will be built with. Currently the following USE
155 flags are available:</p>
156 <pre>
157  doc    - install .html and .txt documentation
158           into /usr/share/doc/rrdtool-1.x.xx/
159  perl   - build and install perl language bindings
160  python - build and install python language bindings
161  ruby   - build and install ruby language bindings
162  tcl    - build and install tcl language bindings
163  rrdcgi - build and install rrdcgi</pre>
164 <p>After you've decided which USE flags you need, set them either in
165 <em>make.conf</em> or <em>/etc/portage/package.use</em> and finally run:</p>
166 <pre>
167  # emerge -va rrdtool</pre>
168 <p>Take a look at Gentoo handbook for further details on how to manage USE
169 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>
170 <p>
171 </p>
172 <hr />
173 <h1><a name="building_dependencies">BUILDING DEPENDENCIES</a></h1>
174 <p>But again this may have been too optimistic still, and you actually have to
175 compile your own copies of some of the required libraries. Things like
176 libpng and zlib are pretty standard so you will probably have them on your
177 system anyway. Freetype, Fontinst, Cairo, Pango may be installed, but it is
178 possible that they are pretty old and thus don't live up to our
179 expectations, so you may want to compile their latest versions.</p>
180 <p>
181 </p>
182 <h2><a name="general_build_tips_for_aix">General build tips for AIX</a></h2>
183 <p>If you are working with AIX, you may find the <strong>--disable-shared</strong> option
184 will cause things to break for you. In that case you may have to install the
185 shared libraries into the rrdtool PREFIX and work with <strong>--disable-static</strong>
186 instead.</p>
187 <p>Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:</p>
188 <pre>
189  export CC=/usr/vac/bin/cc
190  export PERLCC=$CC</pre>
191 <p>(Better instructions for AIX welcome!)</p>
192 <p>
193 </p>
194 <h2><a name="build_instructions">Build Instructions</a></h2>
195 <p>Some libraries want to know where other libraries are. For this to work,
196 set the following environment variable</p>
197 <pre>
198  export PKG_CONFIG_PATH=${INSTALL_DIR}/lib/pkgconfig
199  export PATH=$INSTALL_DIR/bin:$PATH</pre>
200 <p>The above relies on the presence of the <em>pkgconfig</em> program. Below you find instructions
201 on how to compile pkgconfig.</p>
202 <p>Since we are compiling libraries dynamically, they must know where to find
203 each other. This is done by setting an appropriate LDFLAGS. Unfortunately,
204 the syntax again differs from system to system:</p>
205 <dl>
206 <dt><strong><a name="item_solaris">Solaris</a></strong></dt>
208 <dd>
209 <pre>
210  export LDFLAGS=-R${INSTALL_DIR}/lib</pre>
211 <p>if you are using the Sun Studio/Forte compiler, you may also want to set</p>
212 <pre>
213  export CFLAGS=&quot;-xO3 -xcode=pic13&quot;   (SPARC)
214  export CFLAGS=&quot;-xO3 -Kpic&quot;          (x86)</pre>
215 </dd>
216 <dt><strong><a name="item_linux">Linux</a></strong></dt>
218 <dd>
219 <pre>
220  export CFLAGS=&quot;-O3 -fPIC&quot;
221  export LDFLAGS=&quot;-Wl,--rpath -Wl,${INSTALL_DIR}/lib&quot;</pre>
222 </dd>
223 <dt><strong><a name="item_hpux">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="item_aix">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
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 --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.18
285  ./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
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 --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
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  $MAKE
353  $MAKE install</pre>
354 <p>
355 </p>
356 <h3><a name="building_glib">Building Glib</a></h3>
357 <pre>
358  cd $BUILD_DIR
359  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>
360  gunzip -c glib-2.15.4.tar.gz  | tar xf -
361  cd glib-2.15.4
362  ./configure --prefix=$INSTALL_DIR
363  $MAKE
364  $MAKE install</pre>
365 <p>
366 </p>
367 <h3><a name="building_pango">Building Pango</a></h3>
368 <pre>
369  cd $BUILD_DIR
370  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>
371  bunzip2 -c pango-1.21.1.tar.bz2 | tar xf -
372  cd pango-1.21.1
373  ./configure --prefix=$INSTALL_DIR --without-x
374  $MAKE
375  $MAKE install</pre>
376 <p>
377 </p>
378 <h2><a name="building_rrdtool__second_try_">Building rrdtool (second try)</a></h2>
379 <p>Now all the dependent libraries are built and you can try again. This time
380 you tell configure where it should be looking for libraries and include
381 files. This is done via environment variables. Depending on the shell you
382 are running, the syntax for setting environment variables is different.</p>
383 <p>And finally try building again. We disable the python and tcl bindings
384 because it seems that a fair number of people have ill configured python and
385 tcl setups that would prevent rrdtool from building if they are included in
386 their current state.</p>
387 <pre>
388  cd $BUILD_DIR/rrdtool-1.3.7
389  ./configure --prefix=$INSTALL_DIR --disable-tcl --disable-python
390  $MAKE clean
391  $MAKE
392  $MAKE install</pre>
393 <p>SOLARIS HINT: if you want to build  the Perl module for the native Perl (the
394 one shipping with Solaris) you will need the Sun Forte compiler installed on
395 your box or you have to hand-tune bindings/perl-shared/Makefile while
396 building!</p>
397 <p>Now go to <em>$INSTALL_DIR</em><strong>/share/rrdtool/examples/</strong> and run them to see if
398 your build has been successful.</p>
399 <p>
400 </p>
401 <hr />
402 <h1><a name="author">AUTHOR</a></h1>
403 <p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
405 </body>
407 </html>