1 Xapian-bindings Installation
2 ============================
4 Originally based on automake's generic "Installation Instructions" which are:
6 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
7 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
9 Copying and distribution of this file, with or without modification,
10 are permitted in any medium without royalty provided the copyright
11 notice and this notice are preserved. This file is offered as-is,
12 without warranty of any kind.
17 * The bindings glue code generated by SWIG seems to require a lot of memory
18 to compile and can take several minutes even on a fast machine (at least
19 with most versions of g++). Some systems (such as OpenBSD) may require
20 you to increase the amount of memory a process can use (using ulimit is
21 the simplest way). Alternatively you can compile the bindings without
26 Xapian-bindings version 0.9.3 reduced the compile time by something like a
27 factor of 3 and probably also reduced memory usage significantly, but you
28 might still encounter this issue on slower machines with less memory.
30 Quick Installation Guide
31 ========================
33 The simplest way to compile this package is:
35 0. Make sure you have the required tools installed for the languages you
36 want to build the bindings for. Package systems often separate the
37 files you need to build the bindings into a separate package with a
38 `-dev` or `-devel` suffix. Additional per-language dependencies are:
41 - Sphinx Documentation Generator: https://www.sphinx-doc.org/
42 The package you want might be python3-sphinx.
44 1. 'cd' to the directory containing the package's source code and type
45 './configure' to configure the package for your system.
47 You need to make sure that xapian-config from xapian-core is on your path,
48 or else pass its full path to xapian-bindings's configure script:
50 ./configure XAPIAN_CONFIG=/path/to/xapian-config
52 By default, configure will enable building of bindings for all languages
53 which it can find the required tools for. Alternatively you can specify
54 exactly which bindings you want to build by passing one or more of the
55 following options to configure:
57 --with-csharp enable CSharp bindings
58 --with-java enable Java bindings
59 --with-lua enable Lua bindings
60 --with-perl enable Perl bindings
61 --with-php enable PHP bindings
62 --with-python enable Python 2 bindings
63 --with-python3 enable Python 3 bindings
64 --with-ruby enable Ruby bindings
65 --with-tcl enable Tcl bindings
67 If you've requested particular bindings using these options, then
68 configure will fail with an error if it is missing the prerequisite
69 tools, libraries, header files, etc required to build bindings for
70 any of the specified languages.
72 If you have more than one version of a particular language installed
73 you can tell configure which to build the bindings for by setting
74 variables on the configure command line. For a full list of such
75 variables, see the output of 'configure --help' - for example, for
78 ./configure PYTHON3=/opt/bin/python3.9
80 If you don't have root access and want to compile any of the bindings
81 other than C#, Java and PHP, read the next section: "Installing without
84 Running 'configure' might take a while. While running, it prints
85 some messages telling which features it is checking for.
87 2. Type 'make' to compile the package.
89 3. Optionally, type 'make check' to run the self-tests that come with
90 the package, using the just-built uninstalled binaries.
92 4. Type 'make install' to install the programs and any data files and
93 documentation. When installing into a prefix owned by root, it is
94 recommended that the package be configured and built as a regular
95 user, and only the 'make install' phase executed with root
98 5. You can remove the program binaries and object files from the
99 source code directory by typing 'make clean'. To also remove the
100 files that 'configure' created (so you can compile the package for
101 a different kind of computer), type 'make distclean'. There is
102 also a 'make maintainer-clean' target, but that is intended mainly
103 for the package's developers. If you use it, you may have to get
104 all sorts of other programs in order to regenerate files that came
105 with the distribution.
107 6. You can also type 'make uninstall' to remove the installed files
110 Installing without root access
111 ==============================
113 By default the bindings for all languages apart from Java and C# will
114 automatically detect where the language interpreter expects extension
115 modules to be installed and try to install there. This is a problem
116 if you want to install them and don't have root access. In this case
117 follow the instructions for the particular language below (note: you
118 still build several at once - just pass the arguments listed below
119 for each language to "./configure", to "make", and to "make install".)
120 Note that you also need to pass a "--prefix" option to configure so that
121 the documentation and examples can be installed.
125 With current releases of PHP, there doesn't seem to be a good way to
126 install the PHP bindings without root access such that they can be used
127 from PHP run from a webserver, which is what most users want to do.
129 If you're only interested in running code from the command line (via PHP's
130 CLI SAPI) then the following will work:
132 ./configure --with-php --prefix=$HOME/install PHP_EXTENSION_DIR=$HOME/my_php_extensions
136 You can specify the extension directory using `extension_dir` but
137 doing so will stop PHP from looking in the default place for extensions!
138 So a better approach is to specify the full path to the extension to
141 php -d extension="$HOME/my_php_extensions/xapian.so" myscript.php
143 A drawback is that this requires the exact filename of the extension which
144 varies by platform: not all Unix platforms use `.so` and on Microsoft
145 Windows it is `php_xapian.dll`. PHP 7.2 and later allow `extension=xapian`
146 as a portable way to deal with the simple case, but this doesn't work when
147 you include a path to the extension.
151 ./configure --with-python3 --prefix=$HOME/install PYTHON3_LIB=$HOME/.local
155 Python 3 looks in ~/.local for packages automatically, so you don't need
156 to do anything special to use bindings installed there.
160 ./configure --with-ruby --prefix=$HOME/install RUBY_LIB=$HOME/my_ruby_modules RUBY_LIB_ARCH=$HOME/my_ruby_modules
164 And then you'll need to tell Ruby to look for modules in this directory:
166 ruby -I$HOME/my_ruby_modules myscript.rb
170 ./configure --with-tcl --prefix=$HOME/install TCL_LIB=$HOME/my_tcl_modules
174 And then add the following to the start of your script to load Xapian:
176 load [file join "/home/USERNAME/my_tcl_modules" xapian.so]
180 ./configure --with-perl --prefix=$HOME/install PERL_LIB=$HOME/my_perl_modules
184 And then you'll need to tell Perl to look for modules in this directory:
186 perl -I$HOME/my_perl_modules myscript.pl
188 Compilers and Options
189 =====================
191 Some systems may require unusual options for compilation or linking that
192 the 'configure' script does not know about. Run './configure --help'
193 for details on some of the pertinent environment variables.
195 You can give 'configure' initial values for configuration parameters
196 by setting variables in the command line or in the environment. Here
199 ./configure CXX=g++-4.9 CFLAGS=-O2 LIBS=-lposix
201 If your system requires special flags, do let us know. Where possible
202 we'd prefer configure to determine such flags by itself, but if we can't
203 then at least we can document the special flags to help other users of
206 Compiling For Multiple Architectures
207 ====================================
209 When using GCC on platforms which support multiple architectures, the simplest
210 way to select a non-default architecture is to pass a CXX setting to configure
211 which includes the appropriate -m option - e.g. to build for x86 on x86-64
212 you would configure with:
214 ./configure CXX='g++ -m32'
216 On macOS 10.5 and later systems, you can create libraries and
217 executables that work on multiple system types--known as "fat" or
218 "universal" binaries--by specifying multiple '-arch' options to the
219 compiler but only a single '-arch' option to the preprocessor. Like
222 ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
223 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
224 CPP="gcc -E" CXXCPP="g++ -E"
226 Building in a separate directory
227 ================================
229 If you wish to perform your build in a separate directory from the source,
230 create and change to the build directory, and run the configure script (in
231 the source directory) from the build directory, like so:
240 By default, 'make install' installs the package's commands under
241 '/usr/local/bin', include files under '/usr/local/include', etc. You
242 can specify an installation prefix other than '/usr/local' by giving
243 'configure' the option '--prefix=PREFIX', where PREFIX must be an
246 You can specify separate installation prefixes for
247 architecture-specific files and architecture-independent files. If you
248 pass the option '--exec-prefix=PREFIX' to 'configure', the package uses
249 PREFIX as the prefix for installing programs and libraries.
250 Documentation and other data files still use the regular prefix.
252 In addition, if you use an unusual directory layout you can give
253 options like '--bindir=DIR' to specify different values for particular
254 kinds of files. Run 'configure --help' for a list of the directories
255 you can set and what kinds of files go in them.
257 Specifying the System Type
258 ==========================
260 There may be some features 'configure' cannot figure out
261 automatically, but needs to determine by the type of machine the package
262 will run on. Usually, assuming the package is built to be run on the
263 _same_ architectures, 'configure' can figure that out, but if it prints
264 a message saying it cannot guess the machine type, give it the
265 '--build=TYPE' option. TYPE can either be a short name for the system
266 type, such as 'sun4', or a canonical name which has the form:
270 where SYSTEM can have one of these forms:
275 See the file 'config.sub' for the possible values of each field. If
276 'config.sub' isn't included in this package, then this package doesn't
277 need to know the machine type.
279 If you want to _use_ a cross compiler, that generates code for a
280 platform different from the build platform, you should specify the
281 "host" platform (i.e., that on which the generated programs will
282 eventually be run) with '--host=TYPE'.
287 If you want to set default values for 'configure' scripts to share,
288 you can create a site shell script called 'config.site' that gives
289 default values for variables like 'CXX', 'cache_file', and 'prefix'.
290 'configure' looks for 'PREFIX/share/config.site' if it exists, then
291 'PREFIX/etc/config.site' if it exists. Or, you can set the
292 'CONFIG_SITE' environment variable to the location of the site script.
293 A warning: not all 'configure' scripts look for a site script.
298 Variables not defined in a site shell script can be set in the
299 environment passed to 'configure'. However, some packages may run
300 configure again during the build, and the customized values of these
301 variables may be lost. In order to avoid this problem, you should set
302 them in the 'configure' command line, using 'VAR=value'. For example:
304 ./configure CXX=/usr/local2/bin/g++
306 causes the specified 'g++' to be used as the C++ compiler (unless it is
307 overridden in the site shell script).
309 'configure' Invocation
310 ======================
312 As well as the options documented in the "Quick Installation Guide",
313 'configure' recognizes the following standard options to control how it
318 Print a summary of all of the options to 'configure', and exit.
322 Print the version of Autoconf used to generate the 'configure'
326 Enable the cache: use and save the results of the tests in FILE,
327 traditionally 'config.cache'. FILE defaults to '/dev/null' to
332 Alias for '--cache-file=config.cache'.
337 Do not print messages saying which checks are being made. To
338 suppress all normal output, redirect it to '/dev/null' (any error
339 messages will still be shown).
342 Look for the package's source code in directory DIR. Usually
343 'configure' can determine that directory automatically.
345 'configure' also accepts some other, not widely useful, options. Run
346 'configure --help' for more details.