

Note
The Windows Release Notes are kinda hidden in the page for Stable Releases.
DOC-NEEDS-HELP "Windows Release Notes" seem ancient:
The link to mingw in "Using MinGW or a compiler with a compatible calling format you can write C or C++ code" (i.e. http://www.mingw.org) is dead.
- There is now 64-bit MingW: http://mingw-w64.org/doku.php - one should use that
- The old (but still live) 32-bit MingW is at OSDN: https://osdn.net/projects/mingw/
- For some reason 32-bit MingW also remains at sourceforce https://sourceforge.net/projects/mingw/ with a last updated stamp of "2018-07-13"
Also:
- Mentions a TWiki wiki but I don't think that exists.
- There is a reference to the old mailing list rather than discourse.
Linux? Linux!
TL;DR for "Install development version on Linux" (official description is here where there actually is now less text 😬)
Build script
Here is a little bash script I use to set up a some SWIPL versions I used for development. It's too complex for general use, but it's all-in-one and rather foolproof; moving this from the back of the comment to the front of the comment. It's probably easier to pull off than doing it manually.
- Grab it
- Modify the values at the top to your liking:
system_install_dir
toplevel_dir_fq
- The command to execute is:
swiprologpull.sh clone system
to download the SWI-Prolog distro/modulesswiprologpull.sh build system
to build the SWI-Prolog distro
It will ask you before letting loose:
$ ./swiprologpull.sh build system The version string obtained from the version file is '8.3.7' Full build ordered but directory 'build' already exists in '/home/paquette/Development/swiplmaking/swiplmaking7/system/swipl-devel_original' -- removing it Going to build the SWI-Prolog distro in: swipl-devel_original The build directory is : swipl-devel_original/build The installation directory is : /usr/local/logic/swiplexe_8.3.7 Performing a full build The following jar directory exists : /home/paquette/Development/swiplmaking/swiplmaking7/jars and the hamcrest jar exists : /home/paquette/Development/swiplmaking/swiplmaking7/jars/hamcrest-2.2.jar and the junit4 jar exists : /home/paquette/Development/swiplmaking/swiplmaking7/jars/junit-4.13.jar Proceed? [Y/N]
To compile and test "JPL", the Java-Prolog bridge, you need to have a valid Java SDK on your system (Java 8 is recommended but Adopt JDK 14 seems to work too). The script needs to find the jars for hamcrest and junit in a directory called jars
at the same level as the directory into which the SWI-Prolog distribution is cloned:
jars/hamcrest-2.2.jar jars/junit-4.13.2.jar
You get those jars from
- https://mvnrepository.com/artifact/org.hamcrest/hamcrest/
- https://mvnrepository.com/artifact/junit/junit/
The script will run the tests, which should succeed but occasionally may fail.
To install the compilate into the configured directory, su to root, then change to the build
directory and issue ninja install
. This may have to be followed by some symlink changes or PATH
modifications.
Compiling manually
With bash
.
Building is done using cmake, and it uses ninja-build to compute dependencies and build.
- CMAKE must have been installed (on Fedora this is done with `dnf install cmake` but your system may have some different package tool than
dnf
, for exampleapt
) ninja-build
must have been installed (on Fedora: `dnf install ninja-build`)
Suppose we want to install SWIPL into this directory:
/usr/local/logic/swipl
You can also install it somewhere in your home directory, or at some other place, it's up to you. If you install it in your home directory, there is no need to change to user root
below.
As root:
# Define a shell variable with the location value install_under=/usr/local/logic/
You may want to prepare the installation directory:
mkdir -p "$install_under" if [[ -d "${install_under}/swipl" ]]; then # move existing out of the way! mv "${install_under}/swipl" "${install_under}/swipl_$(date +%Y%m%d%H%M%S)" fi
Now may also be the time to install additional packages that SWI-Prolog depends on, in particular:
As non-root, in your home directory
# Sometimes environment variable SWI_HOME_DIR is left from a previous installation unset SWI_HOME_DIR # Define a shell variable with the location value install_under=/usr/local/logic # Prepare everything in your home directory inside ~/COMPILE cd ~ mkdir COMPILE; cd COMPILE # - - - - - main download - - - - - - - git clone https://github.com/SWI-Prolog/swipl-devel.git # - - - - - - - - - - - - - - - - - - - cd swipl-devel # - - - - - download SWIPL packages, which are git modules - - - - git submodule update --init # - - - - - - - - - - - - - - - - - - -
(... Maybe read CMAKE.md
for more info at this point ...)
You are now inside directory swipl-devel
; not the ..
at the end of the cmake
command which tells cmake
to look for its necessary files one directory up
If you want to run functionality tests at runtime with the command test_installation/0, also add the option -DINSTALL_TESTS=ON
to the cmake
options:
mkdir build cd build/ cmake -DCMAKE_INSTALL_PREFIX="${install_under}/swipl" -G Ninja ..
By default the system configures all features (depending on whether the required packages these features depend on exist on the system). In particular, GMP, ODBC, JPL, graphics.
Soon you will see:
Build files have been written to: /home/myuser/COMPILE/swipl-devel/build
Then actually compile and run the tests:
ninja # Compile it! A lot of energy comes out of the CPU as waste heat. ctest -j 4 # Run tests concurrently 4-fold. See "man ctest" or "ctest --help"
(Note that if you want to compile the Prolog-Java bridge "JPL", you will have to have a discoverable JDK on the system; for testing you will need the hamcrest jar and junit jar but this is going too far now)
Then, install as root:
su # become root # you are still inside "swipl-devel/build" ninja install
To make sure SWI-Prolog is found on-PATH, add the following script as "logic.sh" to `/etc/profile.d/` (this should work but may depend on the system) :
#!/bin/bash function extend_path_for_swipl { local SWIPL="/usr/local/logic/swipl" local BIN="${SWIPL}/bin" if [[ -d "${BIN}" ]]; then export PATH="${BIN}:${PATH}" export SWIPL_HOME="$SWIPL" fi } extend_path_for_swipl unset extend_path_for_swipl
And create the symlink corresponding to `/usr/local/logic/swipl`, linking to `/usr/local/logic/swipl/swiplexe_8.3.7` or similar. As user root
:
# cd /usr/local/logic # ln -s swiplexe_8.3.7 swipl
Check using tree
# tree -L 2 /usr/local/logic/swipl /usr/local/logic/swipl ├── bin │ ├── swipl -> ../lib/swipl/bin/x86_64-linux/swipl │ ├── swipl-ld -> ../lib/swipl/bin/x86_64-linux/swipl-ld │ └── swipl-win -> ../lib/swipl/bin/x86_64-linux/swipl-win ├── lib │ ├── cmake │ └── swipl └── share ├── man └── pkgconfig
Drop root privileges. As non-root:
exec bash # reloads PATH swipl # run it Welcome to SWI-Prolog (threaded, 64 bits, version 8.3.7-16-g13001415d) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details.
You can now run check_intallation/0 to see whether there are any remaining problems (there may be some but you also may not be interested in fixing them):
?- check_installation. % Checking your SWI-Prolog kit for common issues ... % % Version: ............. 8.3.9-21-g431bddd1b % Address bits: ........ 64 % Architecture: ........ x86_64-linux % Installed at: ........ /usr/local/logic/swipl/lib/swipl % Cores: ............... 8 % % Checking tcmalloc ............................ not present Warning: See http://www.swi-prolog.org/build/issues/tcmalloc.html % Checking gmp ................................. ok % Loading library(archive) ..................... ok % Supported filters: bzip2, compress, gzip, grzip, lrzip, lzip, lzma, lzop, none, rpm, uu, xz % Supported formats: 7zip, ar, cab, cpio, empty, gnutar, iso9660, lha, mtree, rar, raw, tar, xar, zip % Loading library(cgi) ......................... ok % Loading library(crypt) ....................... ok % Loading library(bdb) ......................... ok % Loading library(double_metaphone) ............ ok
etc.
The above messages will point you to "problem solving pages" in this directory: