1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
Installing SWI-Prolog
=====================
Last updated: Aug 12, 2008
Configuration, compilation and installation is based on the GNU autoconf
package and consists of two steps: builting the basic SWI-Prolog system
and building the packages.
SWI-Prolog can only be built using GNU-Make. On many non-linux systems
this is installed as gmake.
Although the system compiles using a wide variety of C-compilers, using
GCC avoids a lot of trouble. The configure script has very incomplete
and sometimes aged default compiler settings for the system native
compiler, so in most case you will need to modify the CFLAGS and LDFLAGS
definitions in the Makefile to reach at optimal results.
GIT
---
This guide assumes installation from the source tar-ball. If you use GIT
to download, please consult README.git to learn how to complete your
pack.
Prerequisites
-------------
SWI-Prolog depends on a lot of other (open source) tools and libraries
that is not bundled and must be installed seperately. The file
README.debian contains the package requirements for Debian Linux and is
probably a good start for any Unix system. README.MacOSX contains notes
for Apples' MacOSX and README.windows contains pointers for MS-Windows
that requires a totally different approach (stop reading this if you
want to compile on Windows). Notably, one needs:
Tools:
* gcc (with some effort, other C compilers may work as well)
* GNU-make
* autoconf (when building from GIT, see README.git)
* LaTeX (optional for documentation, see README.doc)
* perl (optional for documentation, see README.doc)
Libraries (core system):
* gmp (http://gmplib.org/)
Provides unbounded integers and rational numbers. Optional,
but especially some of the constraint libraries demand it.
* GNU readline library
Optional, provides commandline editing and completion. You
really want this!
Libraries (packages):
* UNIXodbc (http://www.unixodbc.org/)
Optional for building package odbc, providing database access.
* OpenSSL (www.openssl.org/)
Optional for building package ssl (Secure Socket layer)
* zlib
Optional for building package zlib (compressed streams)
* SUN Java SDK
Optional for building JPL (Java interface). Note that auto-detection
of JPL prerequisites often fails. See DISABLE_PKGS in build.templ
* libXt, X11 core libraries, libjpeg and libxpm
Required libraries for XPCE, the SWI-Prolog graphics layer that
provides the built-in editor, graphical debugger and many other
developers tools.
* libXft, libfontconfig and pkg-config
Provide proper Unicode font support for XPCE. Without, XPCE may work
or not, depending on locale and installed fonts.
Using the build.templ script
----------------------------
The bash-script build.templ contains the default build procedure and
some comments and skeleton environment changes marked with [EDIT].
Especially for those who want to update SWI-Prolog regulary, it is
recommended to copy this file to 'build' and edit it to suit your needs.
The file also gives some hints dealing with non-default locations of
libraryes, non-standard compiler settings, etc.
If this fails, considering following the step-by-step instructions below
to get everything in place.
Building SWI-Prolog lite
------------------------
In normal cases, the following should do:
% cd src
% ./configure
% gmake
% gmake check
% gmake install
By default, the system is installed as /usr/local/bin/pl, with the
libraries in /usr/local/lib/pl-<version>.
% ./configure --prefix=PREFIX
Building the SWI-Prolog packages
--------------------------------
(Ensure the installed pl executable is in your path)
% cd packages
% ./configure
% gmake
% gmake install
The packages can also be configured and build individually from the
package itself. Most packages are installed with the ./configure && make
&& make install sequence.
Put the Prolog kernel in a shared object
========================================
There is limited support to compile the Prolog kernel in a shared object
rather than an executable and static library. This feature only works on
platforms where gcc provided standard support for creating and managing
shared objects. Using shared objects is default on some platforms (MacOS
X and Linux on x86_64 (AMD64)).
./configure --enable-shared
This creates $PLBASE/lib/$ARCH/libswipl.so.<version> and a symbolic link
from $PLBASE/lib/$ARCH/libswipl.so to this file. The executable pl is
linked using -rpath=$PLBASE/lib/$ARCH. This schema is likely to work on
other ELF-based platforms using GCC and GNU-ld.
Doing this causes the Prolog sources to be compiled with -fPIC (position
independent code). On some platform this can lead to significant
performance degradation. The approach has some advantages and
disadvantages:
- `stand-alone' executables need the shared object
- less performance for some processors (particularly on IA32)
+ Easier linking, especially for complicated embedded systems
|