|Did you know ...||Search Documentation:|
|Building SWI-Prolog on MS-Windows|
There are three ways to build SWI-Prolog from source for Windows. Here are some notes regarding the different approaches:
gdbdebugger does not understand the MSVC debugging information and Microsoft debugger does not understand the GCC debugging information.
While building for Windows has improved a lot with the migration to CMake for SWI-Prolog and much improved dependency handling, it is still a tedious process that provides little benefits over using the binary installers that can be downloaded from https://www.swi-prolog.org/Download.html
We provide a Docker file that is based on Fedora Linux and builds SWI-Prolog using the MinGW cross compilers and Wine emulation to run the Prolog steps. This should work on any machine capable of running Docker.
The Docker image uses a host filesystem directory to access the source tree and create the result.
See the Makefile of the repo for using it.
This is used to build the binary releases for Windows as well as the daily builds.
There are also swi-prolog packages for MSYS2 and you can use MSYS2 to compile SWI-Prolog from source using the dependencies from MSYS2.
This is a recent addition. The process is based MSVC and the vcpkg package manager.
Install Microsoft Visual C++. You need the command line tools and
optionally Visual Studio. The the supplied shortcuts to start a
cmd.exe or PowerShell prompt setup for running the MSVC command line
vcpkg if you do not have it. The vcpkg site suggests to
install the package manager into a folder close to the device root,
c:\dev\vcpkg. We use the latter in
c: cd \ mkdir dev git clone https://github.com/Microsoft/vcpkg.git cd vcpkg .\bootstrap-vcpkg.bat
Install the dependencies we need. Run these commands inside the
c:\dev\vcpkg directory. The
--triplet x64-windows flag
demands for the 64 bit versions of the dependencies. The
pthreads dependencies are obligatory. The others are to support the
.\vcpkg install --triplet x64-windows zlib pthreads .\vcpkg install --triplet x64-windows pcre2 libjpeg-turbo libyaml libarchive
Configure the system
Go to the checked out SWI-Prolog sources and run the commands below.
Adjust the tool chain script if you installed
mkdir build cd build cmake -DCMAKE_TOOLCHAIN_FILE=/dev/vcpkg/scripts/buildsystems/vcpkg.cmake ..
Build the system
To build using the command line tools, run the following from the
build directory. Alternatively you may open the
file that opens Visual Studio.
cmake --build . --config Release
The Microsoft Visual C++ port is experimental. The above builds the
core system and all packages except for
tests pass except for a spurious failure in
Packaging has not been tested.