Code

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