| 1 | <?xml version="1.0" encoding="utf-8"?> |
| 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" lang="en" xml:lang="en"> |
| 4 | <head> |
| 5 | <title>Rasqal RDF Query Library - Building and Installing from Source</title> |
| 6 | </head> |
| 7 | <body> |
| 8 | |
| 9 | <h1>Rasqal RDF Query Library - Building and Installing from Source</h1> |
| 10 | |
| 11 | <h2>1. Getting the sources</h2> |
| 12 | |
| 13 | <p>There are several ways to get the sources. The most stable and |
| 14 | tested versions are the sources shipped with each release and these |
| 15 | are recommended as the first place to start. If you want to get a |
| 16 | newer set, then there are nightly snapshots made of the development |
| 17 | sources, which may not yet be committed to GIT. For the |
| 18 | latest developent sources, anonymous GIT access is available |
| 19 | but this may require some configuring of developer tools that are not |
| 20 | needed for the snapshot releases. |
| 21 | </p> |
| 22 | |
| 23 | <p>The source bundle and package files contain all the HTML files and |
| 24 | documentation provided on the web site. |
| 25 | </p> |
| 26 | |
| 27 | <h2>1.1 Getting the sources from releases</h2> |
| 28 | |
| 29 | <p><b>This is the recommended source to build and install Rasqal.</b> It |
| 30 | ensures that a tested and working set of files are used.</p> |
| 31 | |
| 32 | <p>The sources are available from |
| 33 | <a href="http://download.librdf.org/source/">http://download.librdf.org/source/</a>.</p> |
| 34 | |
| 35 | |
| 36 | <h2>1.2 Getting the sources from GIT</h2> |
| 37 | |
| 38 | <p><b>This is the recommended source for developers</b>. It provides |
| 39 | the latest beta or unstable code. For a stable version, use a release |
| 40 | as described above.</p> |
| 41 | |
| 42 | <pre> |
| 43 | git clone git://github.com/dajobe/rasqal.git |
| 44 | cd rasqal |
| 45 | </pre> |
| 46 | |
| 47 | <p>At this stage, or after a <tt>git pull</tt> you will |
| 48 | need to create the automake and autoconf derived files, as described |
| 49 | below in <a href="#sec-create-configure">Create the configure program</a> |
| 50 | by using the <code>autogen.sh</code> script.</p> |
| 51 | |
| 52 | <p>Building Rasqal in this way requires some particular development |
| 53 | tools not needed when building from snapshot releases - automake, |
| 54 | autoconf, libtool, gtk-doc and dependencies. |
| 55 | The <code>autogen.sh</code> script looks for the newest versions of |
| 56 | the auto* tools and checks that they meet the minimum versions.</p> |
| 57 | |
| 58 | <p>Building from development sources rather than from a release also |
| 59 | requires some additional development tools. Presently this includes |
| 60 | the <a href="http://flex.sourceforge.net/">flex scanner generator</a> |
| 61 | version 2.5.31 or later and the GNU Bison parser generator. |
| 62 | The <code>configure</code> script checks that the minimum versions |
| 63 | are present. There are optional dependencies that will be used if |
| 64 | present such as MPFR or GMP for decimal arithmetic and PCRE for |
| 65 | regex support.</p> |
| 66 | |
| 67 | |
| 68 | |
| 69 | <h2>2. Configuring and building</h2> |
| 70 | |
| 71 | <p>Rasqal uses the GNU automake and autoconf to handle system |
| 72 | dependency checking. It is developed and built on x86 Linux |
| 73 | and x86 OSX but is also tested on other systems occasionally. |
| 74 | </p> |
| 75 | |
| 76 | <p><b>Required</b> (Rasqal will not build without these):</p> |
| 77 | <ul> |
| 78 | <li>The <a href="http://librdf.org/raptor/">Raptor RDF Syntax Library</a> |
| 79 | version 2.0.4 or later for parsing RDF, retrieving WWW content from |
| 80 | URIs and other utility classes. |
| 81 | </li> |
| 82 | </ul> |
| 83 | |
| 84 | <p><b>Recommended</b> (Optional): |
| 85 | </p> |
| 86 | <ul> |
| 87 | <li><a href="http://www.pcre.org/">PCRE</a> regex library |
| 88 | or another implementing the POSIX regex API.</li> |
| 89 | <li><a href="http://www.mpfr.org/">GNU multiple-precision floating-point library (MPFR)</a> or |
| 90 | <a href="http://gmplib.org/">GNU Multiple Precision Arithmetic Library (GMP)</a> |
| 91 | |
| 92 | libraries for decimal arithmetic. |
| 93 | </li> |
| 94 | </ul> |
| 95 | <p> |
| 96 | If some of the recommended libraries are not present some of the |
| 97 | tests will fail and the query engine will fail to handle regex |
| 98 | matches or decimal arithmetic accurately. |
| 99 | </p> |
| 100 | |
| 101 | |
| 102 | <h3><a id="sec-create-configure" name="sec-create-configure"></a>2.1. Create <code>configure</code> program</h3> |
| 103 | |
| 104 | <p>If there is a <code>configure</code> program, skip to the next |
| 105 | section.</p> |
| 106 | |
| 107 | <p>If there is no <tt>configure</tt> program, you should create it |
| 108 | using the <tt>autogen.sh</tt> script, as long as you have the |
| 109 | <a href="http://www.gnu.org/software/automake/automake.html">automake</a> and |
| 110 | <a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a> |
| 111 | tools. This is done by:</p> |
| 112 | <pre> |
| 113 | ./autogen.sh |
| 114 | </pre> |
| 115 | |
| 116 | <p>and you can also pass along arguments intended for configure (see |
| 117 | below for what these are):</p> |
| 118 | <pre> |
| 119 | ./autogen.sh --prefix=/usr/local/somewhere |
| 120 | </pre> |
| 121 | |
| 122 | <blockquote> |
| 123 | <p>On OSX you may have to explicitly set the <code>LIBTOOLIZE</code> |
| 124 | variable for the <code>libtoolize</code> utility since on |
| 125 | OSX <code>libtoolize</code> is a different program:</p> |
| 126 | <pre> |
| 127 | LIBTOOLIZE=glibtoolize ./autogen.sh |
| 128 | </pre> |
| 129 | </blockquote> |
| 130 | |
| 131 | <p>autogen.sh also checks out the libmtwist GIT submodule and/or |
| 132 | updates it with the latest sources.</p> |
| 133 | |
| 134 | <p>Alternatively you can run them by hand (<b>not recommended</b>) with:</p> |
| 135 | <pre> |
| 136 | aclocal; autoheader; automake --add-missing; autoconf |
| 137 | </pre> |
| 138 | <p><b>however</b> this will not do any of the GIT submodule checkout |
| 139 | or updates that are needed for libmtwist. |
| 140 | </p> |
| 141 | |
| 142 | <p>The automake and autoconf tools have many different versions and |
| 143 | at present development is being done with automake 1.11.1 (minimum |
| 144 | version 1.11), autoconf 2.65 (minimum version 2.62) and libtool |
| 145 | 2.2.10 (minimum version 2.2.0). These are only needed when compiling |
| 146 | from GIT sources. autogen.sh enforces the requirements. |
| 147 | </p> |
| 148 | |
| 149 | <p>Rasqal also requires |
| 150 | <a href="http://flex.sourceforge.net/">flex</a> version 2.5.31 or newer |
| 151 | (2.5.4 will not work) and |
| 152 | <a href="http://www.gnu.org/software/bison/bison.html">GNU Bison</a> |
| 153 | to build lexers and parsers. |
| 154 | These are only required when building from GIT.</p> |
| 155 | |
| 156 | |
| 157 | <h3>2.2 Options for <tt>configure</tt></h3> |
| 158 | |
| 159 | <p>Rasqal's configure supports the following options:</p> |
| 160 | |
| 161 | <dl> |
| 162 | <dt><code>--enable-debug</code><br /></dt> |
| 163 | <dd><p>Enable debugging statements for developing the code. Should |
| 164 | NOT be used with any regular build that is installed since it slows |
| 165 | the code and generates lots of extra output. This is a maintainer |
| 166 | option. |
| 167 | </p></dd> |
| 168 | |
| 169 | <dt><code>--enable-query-languages=</code><em>LANGUAGES</em><br /></dt> |
| 170 | <dd><p>Select the RDF query languages to build from the list:<br /> |
| 171 | <code>sparql laqrs</code><br /> |
| 172 | The default when this option is omitted is to enable all query languages |
| 173 | except the experimental one, laqrs. <em>LANGUAGES</em> takes a |
| 174 | space-separated value. |
| 175 | </p> |
| 176 | </dd> |
| 177 | |
| 178 | <dt><code>--enable-release</code><br /></dt> |
| 179 | <dd><p>Enable configuration for building a release by not removing |
| 180 | <code>-O</code> options for compiler flags. This is a maintainer |
| 181 | option. |
| 182 | </p></dd> |
| 183 | |
| 184 | <dt><code>--with-digest-library=</code><em>NAME</em><br /></dt> |
| 185 | <dd><p>Pick the message digest library approach to use from the |
| 186 | choices of <tt>mhash</tt> (the default when available), |
| 187 | <tt>gcrypt</tt> (when libgcrypt is available) and <tt>internal</tt> |
| 188 | (always available, providing only MD5 and SHA1). |
| 189 | </p></dd> |
| 190 | |
| 191 | <dt><code>--with-gmp=</code><em>PATH</em><br /></dt> |
| 192 | <dd><p>Set the installation path for the |
| 193 | <a href="http://gmplib.org/">GNU Multiple Precision Arithmetic Library (GMP)</a> |
| 194 | if it is not in the standard lib/include prefix. |
| 195 | </p></dd> |
| 196 | |
| 197 | <dt><code>--with-libgcrypt-config=</code><em>PATH</em><br /></dt> |
| 198 | <dd><p>Set the path of the libgcrypt <code>libgcrypt-config</code> |
| 199 | program that provides the compiling and linking flags. Enables |
| 200 | libgcrypt for use as a message digest. |
| 201 | See also <code>--with-digest-library</code> |
| 202 | </p></dd> |
| 203 | |
| 204 | <dt><code>--with-memory-signing</code><br /></dt> |
| 205 | <dd><p>Enable signing of memory allocations so that when memory is |
| 206 | allocated with malloc() and released free(), a check is made that the |
| 207 | memory was allocated in the same library.</p></dd> |
| 208 | |
| 209 | <dt><code>--with-mpfr=</code><em>PATH</em><br /></dt> |
| 210 | <dd><p>Set the installation path for the |
| 211 | <a href="http://www.mpfr.org/">GNU multiple-precision floating-point library (MPFR)</a> |
| 212 | if it is not in the standard lib/include prefix. |
| 213 | </p></dd> |
| 214 | |
| 215 | <dt><code>--with-random-approach=</code><em>ALGO</em><br /></dt> |
| 216 | <dd><p>Pick the random number generator approach to use from the |
| 217 | choices of <tt>mtwist</tt> (the default - this is bundled with rasqal |
| 218 | and can be used without any additional installs), <tt>gmp</tt> (when |
| 219 | GMP is available and used for decimals), <tt>random_r</tt> (glibc |
| 220 | initstate_r and random_r), <tt>rand_r</tt> (POSIX rand_r), |
| 221 | <tt>random</tt> (BSD initstate and random) and <tt>rand</tt> (POSIX |
| 222 | srand and rand). </p></dd> |
| 223 | |
| 224 | <dt><code>--with-regex-library=</code>NAME<br /></dt> |
| 225 | <dd><p>Pick a regex library to use - either <tt>pcre</tt> (default) |
| 226 | for the <a href="http://www.pcre.org/">PCRE</a> |
| 227 | or <tt>posix</tt> a POSIX regex implementation in the C library |
| 228 | </p> |
| 229 | </dd> |
| 230 | |
| 231 | <dt><code>--with-pcre-config=</code><em>NAME</em><br /></dt> |
| 232 | <dd><p>Set the path to the <a href="http://www.pcre.org/">PCRE</a> pcre-config program</p></dd> |
| 233 | |
| 234 | </dl> |
| 235 | |
| 236 | |
| 237 | <h3>2.3 Configuring</h3> |
| 238 | |
| 239 | <p>The default configuration will install into /usr/local: |
| 240 | </p> |
| 241 | <pre> |
| 242 | ./configure |
| 243 | </pre> |
| 244 | |
| 245 | <p>To install into the standard Unix / Linux (and also Cygwin) system |
| 246 | directory, use: |
| 247 | </p> |
| 248 | <pre> |
| 249 | ./configure --prefix=/usr |
| 250 | </pre> |
| 251 | |
| 252 | |
| 253 | <p>Append to the line any additional options you need like this: |
| 254 | </p> |
| 255 | <pre> |
| 256 | ./configure --prefix=/usr --enable-query-languages=sparql |
| 257 | </pre> |
| 258 | |
| 259 | <p>The <code>configure</code> script uses |
| 260 | <a href="http://pkg-config.freedesktop.org/wiki/"><code>pkg-config(1)</code></a> |
| 261 | to find an installed version of Raptor . If configure reports that it |
| 262 | cannot find Raptor, try <code>$ pkg-config raptor2 --modversion</code> |
| 263 | on the command line and if there is an error or nothing is shown, |
| 264 | then pkg-config is not properly installed and configured. Use 'man |
| 265 | pkg-config(1)' to read how to set <code>PKG_CONFIG_PATH</code> which |
| 266 | should include a directory where <code>raptor2.pc</code> is installed. |
| 267 | When it is correct, the above command will return the Raptor version. |
| 268 | </p> |
| 269 | |
| 270 | <h3>2.4 Compiling</h3> |
| 271 | |
| 272 | <p>Compile the library and the <tt>roqet</tt> utility with:</p> |
| 273 | <pre> |
| 274 | make |
| 275 | </pre> |
| 276 | <p>Note: GNU make is probably required which may be called |
| 277 | gmake or gnumake if your system has a different make available too. |
| 278 | </p> |
| 279 | |
| 280 | |
| 281 | <h3>2.5 Testing</h3> |
| 282 | |
| 283 | <p>Rasqal has a built-in test suite that can be invoked with: |
| 284 | </p> |
| 285 | <pre> |
| 286 | make check |
| 287 | </pre> |
| 288 | |
| 289 | <p>which should emit lots of exciting test messages to the screen but |
| 290 | conclude with something like:<br /> |
| 291 | <tt>All </tt><em>n</em><tt> tests passed</tt><br /> |
| 292 | if everything works correctly. There might be some regex |
| 293 | or decimal tests that fail if no POSIX regex library or multiple |
| 294 | precision numeric library was available when Rasqal was compiled.</p> |
| 295 | |
| 296 | |
| 297 | <h3>2.6 Installing</h3> |
| 298 | |
| 299 | <p>Install the library and the <tt>roqet</tt> utility into the area |
| 300 | configure with <code>--prefix</code> (or /usr/local if not given) |
| 301 | with:</p> |
| 302 | <pre> |
| 303 | make install |
| 304 | </pre> |
| 305 | <p>Note: This may require root access if the destination area is |
| 306 | a system directory such as /usr. In that case you may have to do |
| 307 | <code>sudo make install</code>. |
| 308 | </p> |
| 309 | |
| 310 | |
| 311 | <h2>3. Using the library</h2> |
| 312 | |
| 313 | <h3>3.1 Documentation</h3> |
| 314 | |
| 315 | <p>Rasqal includes a reference manual for the library but no tutorial |
| 316 | at this time. This is installed into |
| 317 | <em>PREFIX</em><code>/share/gtk-doc/html/rasqal</code> |
| 318 | and is also available from the |
| 319 | <a href="http://librdf.org/rasqal/api/">Rasqal web site</a>. |
| 320 | </p> |
| 321 | |
| 322 | <h3>3.2 Examples</h3> |
| 323 | |
| 324 | <p>At present, to get a good idea of how to use Rasqal in a program, |
| 325 | check out the source for roqet in src/roqet.c which uses the library |
| 326 | extensively with the recommended APIs. |
| 327 | </p> |
| 328 | |
| 329 | |
| 330 | <h3>3.3 roqet utility</h3> |
| 331 | |
| 332 | <p>Rasqal provides an RDF query utility program called |
| 333 | <em>roqet</em> which can do a variety of query operations on local |
| 334 | and remote data, local and remote queries and running queries on |
| 335 | SPARQL protocol services. |
| 336 | </p> |
| 337 | |
| 338 | <p>See the roqet manual page for full details using 'man roqet' |
| 339 | or read the HTML version in docs/roqet.html or on the |
| 340 | <a href="http://librdf.org/rasqal/roqet.html">Rasqal website</a>. |
| 341 | </p> |
| 342 | |
| 343 | |
| 344 | <hr /> |
| 345 | |
| 346 | <p>Copyright (C) 2003-2014 <a href="http://www.dajobe.org/">Dave Beckett</a><br />Copyright (C) 2003-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p> |
| 347 | |
| 348 | </body> |
| 349 | </html> |