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="#description">DESCRIPTION</a></li>
20         <ul>
22                 <li><a href="#overview">Overview</a></li>
23                 <li><a href="#building">Building</a></li>
24                 <ul>
26                         <li><a href="#build_tipps_for_aix">Build Tipps for AIX</a></li>
27                 </ul>
29                 <li><a href="#building_libraries">Building Libraries</a></li>
30         </ul>
32         <li><a href="#author">AUTHOR</a></li>
33 </ul>
34 -->
35 <!-- INDEX END -->
37 <p>
38 </p>
39 <h1><a name="name">NAME</a></h1>
40 <p>rrdbuild - Instructions for building RRDtool</p>
41 <p>
42 </p>
43 <hr />
44 <h1><a name="description">DESCRIPTION</a></h1>
45 <p>
46 </p>
47 <h2><a name="overview">Overview</a></h2>
48 <p>If you downloaded the source of rrdtool you have to compile it. This
49 document will give some information on how this is done.</p>
50 <p>RRDtool relies on services of thrid part libraries. Some of these libraries
51 may already be installed on your system. You have to compile copies of the other
52 ones before you can build RRDtool.</p>
53 <p>This document will tell you about all the necessary steps to get going.</p>
54 <p>
55 </p>
56 <h2><a name="building">Building</a></h2>
57 <p>Before you start to build RRDtool, you have to decide two things:</p>
58 <ol>
59 <li>
60 <p>In which directory you want to build the software.</p>
61 </li>
62 <li>
63 <p>Where you want to install the software.</p>
64 </li>
65 </ol>
66 <p>Once you have decided. Save the two locations into environment variables.
67 Depending on the shell you are using, you can do either (bash,zsh):</p>
68 <pre>
69  BUILD_DIR=/tmp/rrdbuild
70  INSTALL_DIR=/usr/local/rrdtool-1.2.28</pre>
71 <p>Or if you run tcsh:</p>
72 <pre>
73  set BUILD_DIR=/tmp/rrdbuild
74  set INSTALL_DIR=/usr/local/rrdtool-1.2.28</pre>
75 <p>If your <em>/tmp</em> is mounted with the option noexec (RHEL seems todo that) you have to choose
76 a different directory!</p>
77 <p>Now make sure the BUILD_DIR exists and go there:</p>
78 <pre>
79  mkdir -p $BUILD_DIR
80  cd $BUILD_DIR</pre>
81 <p>Lets first assume you already have all the necessary libraries
82 pre-installed. Note that these instructions assume that your copies of
83 <strong>tar</strong> and <strong>make</strong> are actually <strong>GNU tar</strong> and <strong>GNU make</strong> respectively. It
84 could be that they are installed as <strong>gtar</strong> and <strong>gmake</strong> on your system.</p>
85 <pre>
86  wget <a href="http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.28.tar.gz">http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.28.tar.gz</a>
87  tar zxf rrdtool-1.2.28.tar.gz
88  cd rrdtool-1.2.28
89  ./configure --prefix=$INSTALL_DIR &amp;&amp; make &amp;&amp; make install</pre>
90 <p>Ok, this was very optimistic. This try will probably have ended with
91 <strong>configure</strong> complaining about several missing libraries. If you are on a
92 Linux or *bsd system you may want to just install the missing bits from your
93 software repository. When you do that, make sure you also get the <strong>-dev</strong>
94 package for each library you install. Once you have the missing bits on
95 board, just re-run the last line of the instructions above.</p>
96 <p>But again this may have been too optimistic, and you actually have to
97 compile your own copies of the required libraries.</p>
98 <p>
99 </p>
100 <h3><a name="build_tipps_for_aix">Build Tipps for AIX</a></h3>
101 <p>If you are woking with AIX, you may find the the <strong>--disable-shared</strong> option
102 will cause things to break for you. In that case you may have to install the
103 shared libraries into the rrdtool PREFIX and work with <strong>--disable-static</strong>
104 instead.</p>
105 <p>Another hint to get rrdtool working on AIX is to use the IBM XL C Compiler:</p>
106 <pre>
107  export CC=/usr/vac/bin/cc
108  export PERLCC=$CC</pre>
109 <p>(Better instructions for AIX welcome!)</p>
110 <p>
111 </p>
112 <h2><a name="building_libraries">Building Libraries</a></h2>
113 <p>In order to build the libraries you need a compiler on your system.
114 Unfortunately compilers are not all alike. This has an effect on the CFLAGS
115 you want to set. The examples below are for the popular GCC compiler suite.
116 If you have an other compile you have to use the following settings:</p>
117 <dl>
118 <dt><strong><a name="item_sun_forte">Sun Forte</a></strong></dt>
120 <dd>
121 <pre>
122  CFLAGS=&quot;-xO3 -kPIC&quot;</pre>
123 </dd>
124 </dl>
125 <dl>
126 <dt><strong><a name="item_building_zlib">Building zlib</a></strong></dt>
128 <dd>
129 <pre>
130  cd $BUILD_DIR
131  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>
132  tar  zxf zlib-1.2.3.tar.gz
133  cd zlib-1.2.3
134  env CFLAGS=&quot;-O3 -fPIC&quot; ./configure --prefix=$BUILD_DIR/lb
135  make
136  make install</pre>
137 </dd>
138 <dt><strong><a name="item_building_libpng">Building libpng</a></strong></dt>
140 <dd>
141 <p>Libpng itself requires zlib to build, so we need to help a bit. If you
142 already have a copy of zlib on your system (which is very likley) you can
143 drop the settings of LDFLAGS and CPPFLAGS. Note that the backslash (\) at
144 the end of line 4 means that line 4 and line 5 are on one line.</p>
145 <pre>
146  cd $BUILD_DIR
147  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.10.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/libpng-1.2.10.tar.gz</a>
148  tar zxvf libpng-1.2.10.tar.gz
149  cd libpng-1.2.10
150  env CPPFLAGS=&quot;-I$BUILD_DIR/lb/include&quot; LDFLAGS=&quot;-L$BUILD_DIR/lb/lib&quot; CFLAGS=&quot;-O3 -fPIC&quot; \
151      ./configure --disable-shared --prefix=$BUILD_DIR/lb
152  make
153  make install</pre>
154 </dd>
155 <dt><strong><a name="item_building_freetype">Building freetype</a></strong></dt>
157 <dd>
158 <pre>
159  cd $BUILD_DIR
160  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.1.10.tar.bz2">http://oss.oetiker.ch/rrdtool/pub/libs/freetype-2.1.10.tar.bz2</a>
161  tar jxvf freetype-2.1.10.tar.bz2
162  cd freetype-2.1.10
163  env CPPFLAGS=&quot;-I$BUILD_DIR/lb/include&quot; LDFLAGS=&quot;-L$BUILD_DIR/lb/lib&quot; CFLAGS=&quot;-O3 -fPIC&quot; \
164      ./configure --disable-shared --prefix=$BUILD_DIR/lb
165  make
166  make install</pre>
167 <p>If you run into problems building freetype on Solaris, you may want to try to
168 add the following at the end of the configure line:</p>
169 <pre>
170  GNUMAKE=gmake EGREP=egrep</pre>
171 </dd>
172 <dt><strong><a name="item_building_libart_lgpl">Building libart_lgpl</a></strong></dt>
174 <dd>
175 <pre>
176  cd $BUILD_DIR
177  wget <a href="http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz">http://oss.oetiker.ch/rrdtool/pub/libs/libart_lgpl-2.3.17.tar.gz</a>
178  tar zxvf libart_lgpl-2.3.17.tar.gz
179  cd libart_lgpl-2.3.17
180  env CFLAGS=&quot;-O3 -fPIC&quot; ./configure --disable-shared --prefix=$BUILD_DIR/lb
181  make
182  make install</pre>
183 </dd>
184 </dl>
185 <p>Now all the dependent libraries are built and you can try again. Since these
186 are static libraries, you may have to use <em>ranlib</em> to make them accessible.
187 Especially BSD systems like Mac OS X may require this, Linux and Solaris
188 will do just fine without since their <em>ar</em> command does ranlibs job as well.</p>
189 <pre>
190  ranlib $BUILD_DIR/lb/lib/*.a</pre>
191 <p>This time you tell configure where it should be looking for libraries and
192 include files. This is done via environment variables. Depending on the
193 shell you are running, the syntax for setting environment variables is
194 different. Under csh/tcsh you use:</p>
195 <pre>
196  set IR=-I$BUILD_DIR/lb/include
197  setenv CPPFLAGS &quot;$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng&quot;
198  setenv LDFLAGS  -L$BUILD_DIR/lb/lib
199  setenv CFLAGS -O3</pre>
200 <p>If you are running bash/sh/ash/ksh/zsh use this:</p>
201 <pre>
202  IR=-I$BUILD_DIR/lb/include
203  CPPFLAGS=&quot;$IR $IR/libart-2.0 $IR/freetype2 $IR/libpng&quot;
204  LDFLAGS=&quot;-L$BUILD_DIR/lb/lib&quot;
205  CFLAGS=-O3
206  export CPPFLAGS LDFLAGS CFLAGS</pre>
207 <p>And finally try building again. We disable the python and tcl bindings
208 because it seems that a fair number of people have ill configured python and
209 tcl setups that would prevent rrdtool from building if they are included in
210 their current state.</p>
211 <pre>
212  cd $BUILD_DIR/rrdtool-1.2.28
213  ./configure --prefix=$INSTALL_DIR --disable-python --disable-tcl
214  make clean
215  make
216  make install</pre>
217 <p>SOLARIS HINT: if you want to build  the perl module for the native perl (the
218 one shipping with solaris) you will need the sun forte compiler
219 installed on your box or you have to hand-tune bindings/perl-shared/Makefile
220 while building!</p>
221 <p>Now go to <em>$INSTALL_DIR</em><strong>/share/rrdtool/examples/</strong> and run them to see if your
222 build has been successful.</p>
223 <p>
224 </p>
225 <hr />
226 <h1><a name="author">AUTHOR</a></h1>
227 <p>Tobias Oetiker &lt;<a href="mailto:tobi@oetiker.ch">tobi@oetiker.ch</a>&gt;</p>
229 </body>
231 </html>