You may want to ensure that environment variable SWI_HOME_DIR is unset before compiling:
|Did you know ...||Search Documentation:|
|SWI-Prolog -- Installation on Linux, *BSD (Unix)|
The official packages are often out of date. PPAs are created automatically for every release. PPAs are available for Ubuntu by following directions on the PPA page.
Installing from source is often the best option for installing on Linux and *BSD based systems. Building is not complex. This document describes building 7.7.20 or later using cmake. See this page for building older versions using GNU autoconf and make.
Download the SWI-Prolog source
The tar ball is self contained. The GIT repository contains sub modules. The git repository is downloaded (cloned) using the commands below:
git clone https://github.com/SWI-Prolog/swipl-devel.git cd swipl-devel git submodule update --init
Similarly, the sequence to update the source using git and rebuild is
cd swipl-devel git pull git submodule update --init
Building SWI-Prolog from source requires tools as well as libraries. We maintain pages that describes the required dependencies by platform. The last entry of the list below describes the dependencies in platform independent way.
Using cmake the system is typically build in a subdirectory of the
downloaded sources. The build system does not add or modify any file in
the source tree and (thus) multiple subdirectories can be created
holding different configurations. A built system can simply be removed
by removing the build directory. Basic instruction to build the system
are below. The first alternative installs the system in your home
directory and used ninja to build the
system. The second alternative uses classicaly
make and installs in
`/usr/local`. The `ctest -j 4` tests the system using 4 parallel jobs.
Testing is encouraged but not required.
cd swipl-devel mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=$HOME -G Ninja .. ninja ctest -j 4 ninja install
cd swipl-devel mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. make ctest -j 4 sudo make install
A full description for installing a particular configuration in a particular location, dealing with development workflows, etc. can be found in the file CMAKE.md
If you want to call Java from Prolog using JPL, you need to add the
directory holding the JVM shared objects to the dynamic linker search
path. Using default installation on Ubuntu, this is achieved by adding
the following to your
~/.profile. Check your Java configuration to
find the exact path.