Codebase list swi-prolog / upstream/6.4.1 INSTALL
upstream/6.4.1

Tree @upstream/6.4.1 (Download .tar.gz)

INSTALL @upstream/6.4.1raw · history · blame

			Installing SWI-Prolog
			=====================

Last updated: Jan 27, 2011

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 are not  bundled  and  must   be  installed  seperately.  The  file
README.linux  contains  the  package   requirements    for   some  Linux
distributions 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.  Although
    the system compiles without it we strongly encourage you do
    use GMP.  Libraries and other software written for SWI-Prolog
    may fail to work properly without GMP.
    * 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 or OpenSDK
    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/$PLARCH/libswipl.so.<version>  and  a symbolic
link from $PLBASE/lib/$PLARCH/libswipl.so  to this file. The  executable
pl is linked using -rpath=$PLBASE/lib/$PLARCH.  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