Ann: SWI-Prolog 9.3.26

Dear SWI-Prolog user,

I have uploaded SWI-Prolog 9.3.26. From the Prolog point of view,
this merely fixes a few minor issues. As discussed though, the
tooling has changed considerably:

  • The xpce GUI toolkit is now based on the SDL3+Cairo+Pango libraries,
    using practically the same source on all platforms.
  • The GUI toolkit now runs natively on MacOS (i.e., no more need for
    XQuartz) and Wayland (the Linux display server that is now more and
    more replacing X11).
  • The swipl-win executable now uses xpce for its console window. This
    implies that the native swipl-win.exe on Windows and the Qt based
    version for MacOS and Linux have gone.
  • The GNU readline binding is disabled. We now use the BSD libedit for
    command line editing as it is more flexible and can support more
    instances, which allows it to run inside the xpce based Prolog console(s).

Availability

  • As usual, we provide binaries for Windows and MacOS. These use the
    full stack outlined above.
  • We will update the flatpak version. The snap version will be discontinued
    as it is harder to manage and serves the same purpose as the flatpak
    version.
  • We provide PPAs for Ubuntu. The one for plucky (25.04) will provide
    the gui. Versions for older Ubuntu releases will not. Users can either
    use the flatpak version or build from source, after building SDL3 and
    SDL3_image from source. Unfortunately the plucky PPA build failed to
    include the gui as well. This will be fixed.
  • The Macports version will be updated. Unfortunately there is an issue
    with Macports SDL3_image package that prevents port from building it.
    You can build SWI-Prolog using the dependencies from Macports, including
    SDL3_image. This is merely an issue on how port works.

Issues are to be expected and a quick re-release as well. Please test!

Enjoy --- Jan

SWI-Prolog Changelog since version 9.3.25

  • FIXED: swipl-win installation for MacOS when not creating a bundle.

  • PPA: Updated scripts/make-ppa to setup building without gui for
    older distros

  • ADDED: Empty light theme file.

  • FIXED: Code generation for unification moved to the head. Minimal test
    case: p(X, Y) :- X = f(Y), Y = a.. Issue occurs if a variable is
    accessed (Y) before its unification must be moved to the head.

  • FIXED: Building; typo in prolog_pack/http fix

  • BUILD: Avoid installing some libraries with missing dependencies -
    Do not install library(prolog_pack) if http support is missing.

    • Do not install SICStus timeout compatibility if multi-threading
      is not enabled.
  • FIXED: library(prolog_xref): added some missing hook declarations.

  • THEME: Dark theme declarations for class list_browser and the profiler.
    Requires the SDL version of xpce.

  • ENHANCED: Improve dark theme Only applies with new SDL based xpce

  • PORT: Fixed MacOS installer to include transitive dependencies and
    fix the @rpath.

  • BUILD: Fixed PGO build with -DEPILOG=ON

  • BUILD: Ensure proper GUI environment for building the manual.

  • ADDED: Support -Dtheme=<theme>

  • PORT: Update scripts/macos-deps.sh Update most ports, add SDL3,
    SDL3_image, cairo and pango.

  • ADDED: Working directory handling for MacOS app.

  • PORT: Create a MacOS bundle based on Epilog.

  • ENHANCED: interactor/0,1: use epilog when available. In the long
    term we will drop xterm support as well as native win32 support.

  • EPILOG: Deal with --win-app option in a way that also supports
    epilog.

  • ENHANCED: Remove thread context for threads running the REPL loop.
    This avoids the complicating [Thread xyz] note on messages in
    alternate consoles such as Epilog or SSH shells.

  • ADDED: Prolog flag toplevel_thread. This flag is true in a thread
    that is currently running a REPL loop.

  • FIXED: Edit from PceEmacs using popup could raise an error.
    E.g. ERROR: prolog_edit:is_file_spec/1: No rule matches
    prolog_edit:is_file_spec(20_625_830)

  • BUILD: Add CMake -DEPILOG option This option prepares the core
    for the upcoming Epilog configuration. It must be used with the
    sdl branch of packages/xpce. Effect:

    • Drop library(readline)
    • Drop swipl-win, either Windows version or Qt version.
    • Create a new swipl-win that is a copy of swipl that sets the
      epilog flag. Depending on the platform some more additions
      may be needed.
  • PORT: Find MinGW DLL dependencies more dynamically This provides two
    CMake functions to find the direct and indirect MinGW DLLs that must
    be included into the distribution

  • ADDED: Allow storing the tty screen size with a stream. This is
    required for environments where we use a non-tty I/O device such as a
    pipe or socket while there is a notion of a tty size. Currently used
    for Epilog on Windows.

  • MODIFIED: print_term/2: print dict tags and compound functors using
    the current write options. Both used to be printed hardwired using
    ~q (quoted).

  • FIXED: When rational_syntax is natural, write /(Int,Number) with
    spaces. This ensures such a term is not read as a rational number.

  • FIXED: Use autoload_call/1 to avoid reporting undefined predicates.

  • MODIFIED: Make the code walker ignore calls to autoload_call/1.

  • ADDED: autoload_call/1: call Goal after autoloading.

  • PORT: Avoid errors on sharing violations.

  • FIXED: Windows: comparing string equality with surrogate pairs
    Comparing strings with surrogate pairs could signal inequality while
    the strings are equal.

  • FIXED: Unification to chars or codes of wchar_t text on Windows.

Package debian

  • PPA: Updated to support xpce based GUI This deletes the Qt console
    (swi-prolog-win package) and replaces the X11 dependencies with
    SDL+cairo+pango.

Package libedit

  • ADDED: Support winlibedit hook to get the terminal size. This allows
    fetching the terminal size for Epilog on Windows.

  • PORT: Make el_history_events/2 also work on the fileno property
    on Windows.

  • ENHANCED: Use autoload_call/1 to avoid undefined errors.

  • FIXED: Read multi-byte characters on non-Windows.

  • ADDED: Support Windows pipe handles for I/O This is work in progress to
    support Epilog on Windows. It consists of changes to our winlibedit
    port of libedit. These changes do not use Console mode setting and
    read using ReadFile() rather than ReadConsoleInput().

Package xpce

  • See at the top
1 Like

Oops … my mistake when building SDL … deleted my error report.

Hi Jan

I tried building from source. First built SDL3 and SDL_image:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble

SDL3

git clone GitHub - libsdl-org/SDL: Simple Directmedia Layer
cd SDL
ls -al
cmake --version
g++ --version
mkdir build
cd build
cmake ..
ls
make -j 8
sudo make install

No errors or warnings

SDL_image

git clone GitHub - libsdl-org/SDL_image: Image decoding for many popular formats for Simple Directmedia Layer.
cd SDL_image
mkdir build
cd build
cmake ..
make
sudo make install

No errors or warnings

SWIPL

cd swipl-devel/
2030 git clean -xfd
2031 git submodule foreach git clean -xfd
2032 git pull
2033 git submodule update --init
2034 mkdir build
2035 cd build
2036 cmake -DCMAKE_INSTALL_PREFIX=$HOME -DCMAKE_BUILD_TYPE=PGO -G Ninja ..

– signal handler is not reset (BSD signals)
– Check size of double
CMake Error at /home/mike/swipl-devel/build/CMakeFiles/CMakeScratch/TryCompile-nQX4Dk/CMakeLists.txt:30 (target_link_libraries):
Target “cmTC_c07a3” links to:

SDL3::SDL3

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

CMake Error at /usr/share/cmake-3.28/Modules/CheckTypeSize.cmake:146 (try_compile):
Failed to generate test project build system.
Call Stack (most recent call first):
/usr/share/cmake-3.28/Modules/CheckTypeSize.cmake:271 (__check_type_size_impl)
packages/xpce/cmake/XPCEConfig.cmake:13 (check_type_size)
packages/xpce/CMakeLists.txt:33 (include)

I got the same error on Debian 12 (bookworm):

CMake Error at /home/peter/src/swipl-devel/build.debug/CMakeFiles/CMakeScratch/TryCompile-0dljyG/CMakeLists.txt:26 (target_link_libraries):
  Target "cmTC_8a416" links to:

    SDL3::SDL3

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

CMake Error at /usr/share/cmake-3.25/Modules/CheckIncludeFile.cmake:95 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  cmake/Utils.cmake:45 (check_include_file)
  packages/xpce/cmake/XPCEConfig.cmake:16 (AC_CHECK_HEADERS)
  packages/xpce/CMakeLists.txt:33 (include)

I built with options from Jan’s config file, but with static and test turned on (the ctest for SDL had 2 failed tests: testautomation, testautomation-no-simd, which I presume don’t matter).

I also got a warning from cmake: Could NOT find ALSA (missing: ALSA_LIBRARY ALSA_INCLUDE_DIR) .

These were the commands I used to build SDL and SDL_image:

git clone --recurse git@github.com:libsdl-org/SDL.git
git clone --recurse git@github.com:libsdl-org/SDL_image.git
cd ~/src/SDL && mkdir -p build && cd build
cmake -G Ninja -DSDL_SHARED=ON -DSDL_STATIC=ON -DSDL_TESTS=ON ..
ninja && ctest -j6 && sudo ninja install
cd ~/src/SDL_image && mkdir -p build && cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DSDLIMAGE_BACKEND_IMAGEIO=ON -DSDLIMAGE_BACKEND_STB=ON -DSDLIMAGE_JPG=ON -DSDLIMAGE_PNG=ON -DSDLIMAGE_WEBP=OFF ..
ninja && sudo ninja install

Also by @peter.ludemann . This is an issue with older versions of cmake. I stumbled on it at some point as well and fixed it by updating CMake. ChatGPT proposes another solution that makes the configuration work with older versions. Please do reconfigure from scratch.

I pushed fixes for this. There are also some other small fixes for benign compiler warnings and QLF compilation warnings if the build locale is not UTF-8 based. Also pushed fixes for two bad colours in the dark theme.

All now compiles completely clean on Debian Bookworm for me (started from a clean Docker image).

Thanks for the feedback.

Thanks Jan. Got much futher but then this:

2490/2691] Generating lib/main.tex
SDL_Init() failed: No available video device
SDL_VIDEODRIVER=(null)
[PCE fatal: nil: Failed to initialize SDL
in:
]

Host stack:
[96] pce_principal:set_pce_thread([app_name(swipl)])
[94] ‘$run_init_goal’(pce:start_dispatch)
[93] catch(system:‘$run_init_goal’(pce:start_dispatch), _132890, system:‘$initialization_error’(_132890, pce:start_dispatch, ‘/home/mike/swipl-devel/build/home/xpce/prolog/lib/pce.pl’:179))
[92] catch_with_backtrace(system:‘$run_init_goal’(pce:start_dispatch), _132890, system:‘$initialization_error’(_132890, pce:start_dispatch, ‘/home/mike/swipl-devel/build/home/xpce/prolog/lib/pce.pl’:179))
[91] ‘$run_init_goal’(pce:start_dispatch, ‘/home/mike/swipl-devel/build/home/xpce/prolog/lib/pce.pl’:179)
[2576/2691] Generating HTML documentation for core system
FAILED: man/manual.html /home/mike/swipl-devel/build/man/manual.html
cd /home/mike/swipl-devel/build/man && rm -f Manual/.html Manual/.gif && /usr/bin/cmake -E env --unset=DISPLAY SDL_VIDEODRIVER=dummy /home/mike/swipl-devel/build/src/swipl -f none --no-packs /home/mike/swipl-devel/build/home/library/ext/ltx2htm/latex2html.pl – --quiet --texinputs=lib:: SWI-Prolog-9.3.26 && /usr/bin/cmake -E remove /home/mike/swipl-devel/build/home/doc/manindex.db && /usr/bin/cmake -E touch manual.html
ERROR: [Thread main] /home/mike/swipl-devel/build/home/library/ext/ltx2htm/latex2html.pl:3224: tex:main source_sink `tex(main)’ does not exist
[2585/2691] Generating tests/test_certs/generated
ninja: build stopped: subcommand failed.

Hmm. Weird. There is the /usr/bin/cmake -E env --unset=DISPLAY SDL_VIDEODRIVER=dummy but that doesn’t seem to get through. I noticed that before in some build environment.

The simple work-around is to do export SDL_VIDEODRIVER=dummy before running ninja. You don’t have to start again. Just set the variable and re-run ninja.

The the only question remaining is why … In what environment are you building?

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04.2 LTS
Release: 24.04
Codename: noble

Thanks. Did you build in the GUI environment, i.e., can you start X11/Wayland tools from the shell in which you were building?

A great thing about SDL is that there is the dummy driver that allows the library to function without a GUI, but apparently the setting doesn’t come through :frowning:

I did this and it built fine. I tried gtrace/0 and edit/0, and they worked as expected, except I had to change ~/.config/swi-prolog/xpce/Defaults:

font.scale: @display?dpi?width/200

(I was using width/150 before)

$ lsb_release -a && uname -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm
Linux penguin 6.6.76-08024-gb30cb4a129c2 #1 SMP PREEMPT_DYNAMIC Fri, 25 Apr 2025 05:08:33 -0700 x86_64 GNU/Linux

Fine

You can just use a constant. @display?dpi is bogus as SDL does not report that. It is fixed to 96. SDL uses logical pixels that should be treated as old style low-res displays. SDL, Cairo and Pango all deal with sub-pixel resolutions (each in their own way …) and parts of xpce now handle dimensions as floats.

So, is this what I should have in Defaults file?:

display.dpi: 96
font.scale: 1.0

BTW, ctrl-C (from my terminal) with gtrace doesn’t behave the way I remember it … it seems to get stuck. And when closing the trace window, “Exit from Prolog” simply returns to the SWI-Prolog REPL.