Debian Codegraph @

INSTALL.html

raw symbols SCIP
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>Redland librdf RDF API Library - Building and Installing from Source</title>
6 </head>
7 <body>
8
9 <h1>Redland librdf RDF API Library - Building and Installing from Source</h1>
10
11
12 <h2>1. Getting the sources</h2>
13
14 <p>There are several ways to get the sources. The most stable and
15 tested versions are the sources shipped with each release and these
16 are recommended as the first place to start. For the latest
17 developent sources, anonymous GIT access is available but this may
18 require some configuring of developer tools that are not needed for
19 the releases.</p>
20
21 <p>The source bundle and package files contain all the HTML files and
22 documentation provided on the web site.</p>
23
24 <p>Redland (librdf) requires the Raptor and Rasqal to be already
25 built and installed (libraries, headers and pkg-config .pc files).
26 See the
27 <a href="http://librdf.org/raptor/INSTALL.html">Raptor install document</a>
28 and
29 <a href="http://librdf.org/rasqal/INSTALL.html">Rasqal install document</a>
30 for the details of installing them.
31 </p>
32
33
34 <h3>1.1. Getting released sources</h3>
35
36 <p>Every release comes with full sources and these are available from
37 <a href="http://download.librdf.org/source/">http://download.librdf.org/source/</a> master site as well as the
38 <a href="http://sourceforge.net/projects/librdf/">SourceForge site</a>.
39 </p>
40
41
42 <h3>1.2. Getting the sources from GIT</h3>
43
44 <pre>
45 git clone git://github.com/dajobe/librdf.git
46 cd librdf
47 </pre>
48
49
50 <p>At this stage, or after a <code>git pull</code> you will
51 need to create the automake and autoconf derived files, as described
52 below in <a href="#sec-create-configure">Create the configure program</a>
53 by using the <code>autogen.sh</code> script.</p>
54
55 <p>Building Redland in this way requires some particular development
56 tools not needed when building from snapshot releases - automake,
57 autoconf, libtool and dependencies.
58 The <code>autogen.sh</code> script looks for the newest versions
59 of the auto* tools and checks that they meet the minimum versions.</p>
60
61
62
63 <h2>2. Configuring and building</h2>
64
65 <p>Redland uses the GNU automake and autoconf to handle system
66 dependency checking. It is developed and built on x86 Linux
67 and x86 OSX but is also tested on other systems occasionally.
68 </p>
69
70
71 <p>configure tries very hard to find several programs and libraries
72 that Redland might need. These include the storage modules
73 (Berkeley/Sleepycat DB, MySQL, PostgreSQL 3store) and various others.
74 A summary of the modular parts found is given at the end of the
75 configure run. Several options to configure given below can be used
76 to point to locations or names of dependencies that cannot be
77 automatically determined.</p>
78
79
80 <h3><a id="sec-create-configure" name="sec-create-configure"></a>2.1. Create <code>configure</code> program</h3>
81
82 <p>If there is no <code>configure</code> program, you can create it
83 by running the <code>autogen.sh</code> script, as long as you have the
84 <a href="http://www.gnu.org/software/automake/automake.html">automake</a> and
85 <a href="http://www.gnu.org/software/autoconf/autoconf.html">autoconf</a>
86 tools. This is done by:</p>
87 <pre>
88 ./autogen.sh
89 </pre>
90 <p>and you can also pass along arguments intended for configure (see
91 below for what these are):</p>
92 <pre>
93 ./autogen.sh --prefix=/usr/local/somewhere
94 </pre>
95
96 <blockquote>
97 <p>On OSX you may have to explicitly set the <code>LIBTOOLIZE</code>
98 variable for the <code>libtoolize</code> utility since on
99 OSX <code>libtoolize</code> is a different program. The full
100 path to the utility should be given:</p>
101 <pre>
102 LIBTOOLIZE=/opt/local/bin/glibtoolize ./autogen.sh
103 </pre>
104 </blockquote>
105
106 <p>Alternatively you can run the automake and autoconf programs by
107 hand with:</p>
108 <pre>
109 aclocal; autoheader; automake --add-missing; autoconf
110 </pre>
111
112 <p>The automake and autoconf tools have many different versions and
113 <code>autogen.sh</code> enforces the minimums. At present development
114 is being done with automake 1.10.2 (minimum version 1.7), autoconf
115 2.63 (minimum version 2.54) and libtool 2.2.6 (minimum version 2.2.0).
116 These are only needed when compiling from GIT sources.
117 autogen.sh enforces the requirements.</p>
118
119
120 <h3>2.2. Options for <code>configure</code></h3>
121
122 <p>See also the generic GNU installation instructions in
123 <a href="INSTALL">INSTALL</a> for information about general options
124 such as <code>--prefix</code> etc.</p>
125
126 <dl>
127 <dt><code>--disable-assert</code><br /></dt>
128 <dd><p>Disable compiling run-time assertions. In maintainer
129 mode, assertion failures are fatal.</p>
130 </dd>
131
132 <dt><code>--disable-assert-messages</code><br /></dt>
133 <dd><p>Disable compiling run-time assertion failure messages.
134 In maintainer mode, assertion failures are fatal after the assertion
135 failure is reported.</p>
136 </dd>
137
138 <dt><code>--enable-debug</code><br /></dt>
139 <dd><p>Enable debug messages (default not enabled).
140 Maintainer mode automatically enables this.</p>
141 </dd>
142
143 <dt><code>--enable-digests=LIST</code><br /></dt>
144 <dd><p>Does nothing - only builtin content digests are available now:
145 MD5 and SHA1.</p></dd>
146
147 <dt><code>--enable-parsers=LIST</code><br /></dt>
148 <dd><p>Select the list of RDF parsers to be included if the are availble. The
149 valid list of RDF parsers is currently only <code>raptor</code> (the default)
150 since the older repat parser has been removed. Raptor uses either of
151 libxml2 (prefered) or expat. Redland requires the Raptor parser for
152 other functionality, so it cannot be disabled.
153 </p></dd>
154
155 <dt><code>--with-bdb=</code> <em>ROOT</em> or <code>no</code><br /></dt>
156 <dd><p>Enable use of the Berkeley DB library installed at
157 <em>ROOT</em>. That means <em>ROOT</em><code>/include</code> must
158 contain the BDB header <code>db.h</code> and <em>ROOT</em><code>/lib</code>
159 must contain the library <code>libdb.a</code> (or whatever shared library
160 version/name your system uses).</p>
161
162 <p>If the value is <code>no</code>, the BDB backend store is disabled.</p>
163
164 <p>Berkeley DB was also known as Sleepycat DB (after version 2 before
165 being bought by Oracle) and is distributed and supported by
166 <a href="http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html">Oracle</a>
167 Versions 4.1.25, 4.1.24, 4.0.14, 3.3.11, 3.2.9, 3.1.17, 3.1.14, 2.7.7
168 and 2.4.14 have been tested and work. Some systems do not come
169 installed with a working Berkeley DB so on those systems,
170 Redland will have no persistent storage unless BDB is built
171 separately and enabled via this option.</p>
172
173 <p><b>Note</b>: If you change installed versions of BDB then you will
174 need to re-configure Redland carefully to let it discover the
175 features of the newer BDB as follows:</p>
176 <pre>
177 rm -f config.cache
178 make clean
179 ./configure ... # any configure arguments here
180 </pre>
181 <p>(plus you might need to use the
182 <code>db</code><em>X</em><code>_upgrade</code>
183 utility to update the BDB database files to the formats supported by
184 the newer version <em>X</em> - see the BDB documentation to find out
185 if this is required.)</p>
186
187 <p>If the BerkeleyDB is installed in different places from
188 <em>ROOT</em><code>/lib</code> (library) and
189 <em>ROOT</em><code>/include</code> (header) or
190 the library name is something that can't be worked out automatically,
191 then you can use the next set of options to specify them.</p>
192
193 <p>If all of the BDB options are omitted, Redland will do
194 a best efforts guess to find the newest BDB installation but
195 this may not work for all configurations.</p>
196 </dd>
197
198 <dt><code>--with-bdb-lib=</code><em>LIBDIR</em><br /></dt>
199 <dt><code>--with-bdb-include=</code><em>INCDIR</em><br /></dt>
200 <dt><code>--with-bdb-name=</code><em>NAME</em><br /></dt>
201 <dd><p>Use Berkeley DB with the installed library in <em>LIBDIR</em>
202 and the <code>db.h</code> header in <em>INCDIR</em> and
203 the installed library called <em>NAME</em>
204 like <code>-l</code><em>NAME</em>. This is relative to <em>LIBDIR</em>.
205 All of these options can be omitted and <code>configure</code> will
206 try to find or guess the values from the system.</p>
207
208 <p>For example, to compile redland on OSX with
209 <a href="http://fink.sourceforge.net/">fink</a>
210 might require a configure line something like this:</p>
211 <pre>
212 ./configure --with-bdb-lib=/sw/lib \
213 --with-bdb-include=/sw/include/db3
214 </pre>
215 <p>The name of the BDB library was correctly discovered for this
216 configuration, as <code>db-3.3</code>.</p>
217
218 <p>If all of the BDB options are omitted, Redland will do
219 a best efforts guess to find the newest BDB installation but
220 this may not work for all configurations.</p>
221
222 <p>(At present, Redland knows of the default <code>/sw</code> Fink
223 installation directory and will look there for BDB installs)</p>
224
225 </dd>
226
227 <dt><code>--with-mysql</code>(<code>=</code><em>CONFIG</em>|<code>yes</code>|<code>no</code>)<br /></dt>
228
229 <dd><p>Enable use of the Redland MySQL 3.x, 4.x triple store backend
230 using <em>CONFIG</em> for the <em>mysql_config</em> program. The
231 default when either no argument is given, or
232 <code>--with-mysql</code> alone, is to search for
233 <em>mysql_config</em> on the search PATH. With
234 <code>--with-mysql=no</code>, this store is disabled.</p>
235
236 <p>Versions 3.23.58 and 4.0.4 have been tested and work.</p>
237
238 </dd>
239
240 <dt><code>--with-openssl-digests</code><br /></dt>
241 <dd><p>Enable the content digests provided by the
242 <a href="http://www.openssl.org/">OpenSSL</a>
243 libcrypto library (MD5, SHA1 and RIPEMD160) if the library is
244 available. configure will automatically enable this unless disabled
245 by setting this option to <em>no</em>.</p></dd>
246
247 <dt><code>--with-postgresql</code>(<code>=</code><em>CONFIG</em>|<code>yes</code>|<code>no</code>)<br /></dt>
248 <dd><p>Enable use of the Redland PostgreSQL triple store backend
249 using <em>CONFIG</em> for the <em>pg_config</em> program. The
250 default when either no argument is given, or
251 <code>--with-postgresql</code> alone, is to search for
252 <em>pg_config</em> on the search PATH. With
253 <code>--with-postgresql=no</code>, this store is disabled.
254 </p></dd>
255
256 <dt><code>--with-sqlite=</code>(<code>yes</code>|<code>no</code>|<code>2</code>|<code>3</code>)<br /></dt>
257 <dd><p>Enable use of <a href="http://www.sqlite.org/">SQLite</a>
258 triple store backend with a particular version V2 or V3,
259 an automatically chosen one with <code>yes</code> or disable it
260 (with <code>no</code>).
261 </p></dd>
262
263 <dt><code>--with-threestore</code>(<code>=</code><em>CONFIG</em>|<code>yes</code>|<code>no</code>)<br /></dt>
264 <dd><p>Enable use of the AKT project
265 <a href="http://www.aktors.org/technologies/3store/">3store triple store</a>
266 backend using <em>CONFIG</em>
267 for the <em>3store-config</em> program. The default when either
268 no argument is given, or <code>--with-threestore</code> alone, is to search for
269 the 3store-config on the search PATH. With
270 <code>--with-threestore=no</code>, this store is disabled.</p></dd>
271
272 <dt><code>--with-xml-parser=NAME</code><br /></dt>
273 <dd><p>Pick an XML parser to use for Raptor - either <code>libxml</code>
274 (default) or <code>expat</code>. If this option is not given,
275 either will be used, with libxml preferred if both are present.
276 One of these much be available for Raptor to parse XML syntaxes.</p>
277
278 <p>Raptor has been tested with various combinations of these libraries
279 that are described further in the Raptor
280 <a href="http://librdf.org/raptor/INSTALL.html">install</a>
281 documentation.
282 </p>
283 </dd>
284
285 </dl>
286
287
288 <p><b>WARNING</b> If the Sleepycat/Berkeley DB library is installed
289 in a non-default directory, when the final linking occurs, the
290 libraries may not be found at run time. To fix this you will need to
291 use a system-specific method of passing this information to the
292 run-time loader. On most systems you can set the LD_LIBRARY_PATH
293 environment variable to include the directory where the libdb*
294 libraries are found. (On OSX this is DYLD_LIBRARY_PATH) You can also
295 configure it via a system wide file - see the <code>ld</code>,
296 <code>ld.so</code> or<code>ld.so.1</code> manual pages for
297 details.</p>
298
299
300 <h3>2.3 Configuring</h3>
301
302 <p>The default configuration will install into /usr/local:
303 </p>
304 <pre>
305 ./configure
306 </pre>
307
308 <p>To install into the standard Unix / Linux (and also Cygwin) system
309 directory, use:
310 </p>
311 <pre>
312 ./configure --prefix=/usr
313 </pre>
314
315 <p>Append to the line any additional options you need like this:
316 </p>
317 <pre>
318 ./configure --prefix=/usr --with-bdb=/usr/local/berkeleydb
319 </pre>
320
321 <p>If you are having problems with configuring several times when
322 adding or removing options, you may have to tidy up first with either
323 of these:</p>
324 <pre>
325 make clean
326 rm -f config.cache
327 </pre>
328
329 <h3>2.4 Compiling</h3>
330
331 <p>Compile the library and the <tt>rdfproc</tt> utility with:
332 </p>
333 <pre>
334 make
335 </pre>
336 <p>Note: GNU make is probably required which may be called
337 gmake or gnumake if your system has a different make available too.
338 </p>
339
340
341 <h2 id="sec-testing">2.5. Testing</h2>
342
343 <p>You can build and run the built-in tests for Redland with:</p>
344 <pre>
345 make check
346 </pre>
347 <p>which should emit lots of exciting test messages to the screen but
348 conclude with something like:<br />
349 <code>All </code><em>n</em><code> tests passed</code><br />
350 if everything works correctly.</p>
351
352
353 <p>(If you have got all the required subsidiary development tools,
354 you can also do <code>make distcheck</code> which does a longer
355 check that the distribution installation, configuring and building
356 works. This does not perform any additional core testing).</p>
357
358
359
360 <h3 id="sec-install">2.6 Installing the library</h3>
361
362 <p>To install the C library (static and shared typically) plus the
363 interface header (.h) files do:</p>
364
365 <pre>
366 make install
367 </pre>
368
369
370
371
372 <h2>3. Using the library</h2>
373
374 <p>Once the library has been configured and built, there are
375 several C example programs that can be used. They are
376 in the <code>examples</code> sub-directory and can be built with:</p>
377 <pre>
378 cd examples
379
380 make EXAMPLE
381 # or on cygwin
382 make EXAMPLE.exe
383 </pre>
384
385 <p>or to build all of them</p>
386 <pre>
387 make examples
388 </pre>
389
390
391 <p>If no Berkeley DB was found by configure, some of the examples will fail
392 since there is no on-disk storage system available. To change them
393 to use the in-memory hashes, edit the lines reading something like</p>
394 <pre>
395 storage=librdf_new_storage("hashes",
396 "test",
397 "hash_type='bdb',dir='.'");
398 </pre>
399 <p>to read</p>
400 <pre>
401 storage=librdf_new_storage("hashes",
402 "test",
403 "hash_type='memory',dir='.'");
404 </pre>
405
406
407
408 <h3>3.1 rdfproc</h3>
409
410 <p>The <code>rdfproc</code> utility in the utils directory exercises
411 the majority of the useful parts of the Redland API and can
412 demonstrate many ways to store, search and manipulate the graph from C.
413 </p>
414
415 <h3>3.2. <a href="example1.c">example1.c</a></h3>
416
417 <p><code>example1</code> uses a RDF parser, if you have one available, to
418 parse a URI of RDF/XML content, store it in multple Berkeley DB
419 hashes on the disk and run queries against them. It takes two
420 arguments, the first the URI of the RDF/XML content (or
421 <code>file:</code><em>filename</em>) and the second, optional one, is the
422 name of the RDF parser to use.</p>
423
424 <h3>3.3. <a href="example2.c">example2.c</a></h3>
425
426 <p><code>example2</code> does not use a RDF parser, but reads from a
427 simple triple dump format and again stores the data on disk in
428 multiple Berkeley DB hashes.</p>
429
430 <h3>3.4. <a href="example3.c">example3.c</a></h3>
431
432 <p><code>example3</code> contains a 10 line main program that creates
433 an RDF model, a statement, adds it to the model and stores it on
434 disk.</p>
435
436 <h3>3.5. <a href="example4.c">example4.c</a></h3>
437
438 <p><code>example4</code> contains an example of how to
439 serialize an RDF model to a syntax.</p>
440
441
442 <hr />
443
444 <p>Copyright (C) 2000-2013 <a href="http://www.dajobe.org/">Dave Beckett</a><br />Copyright (C) 2000-2005 <a href="http://www.bristol.ac.uk/">University of Bristol</a></p>
445
446 </body>
447 </html>