Code

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