INSTALL.html 16 KB

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