Ann: SWI-Prolog 9.3.6

Dear SWI-Prolog user,

SWI-Prolog 9.3.6 is ready for download. This release mostly
marks completion of the first phase of transition to the new
data representation. @mgondan and @peter.ludemann spotted
and helped fixing some issues improving standard compliance
of the code base. This version will be distributed as Docker
image again.

New is the toplevel now separating the use of elipsis (write_term/2
max_depth option) from other toplevel write options. The keys ‘+’
and ‘-’ multiple (divide) the depth to which the output is printed 10
fold, while ‘w’ and ‘p’ toggle between using portray/1 or not.

A final big step is that I switched my development platform from
Ubuntu to Fedora Linux. Fedora Linux has better support for the
latest versions of the development tools (now gcc-14). In the past,
Ubuntu was better with proprietary software such as Slack, Zoom,
Spotify, etc. This problem is gone now that this software is mostly
distributed as snap or flatpak images. This was on my mind for a
while, but Ubuntu dropping installation support on LVM (Logical Volume
Manager) was a concrete and accute reason. CI and the website will
keep running on Ubuntu LTS and we will continue to create Ubuntu PPA
releases.

Enjoy --- Jan

SWI-Prolog Changelog since version 9.3.5

  • ENHANCED: Crash reports Avoid recursive crash reports and
    only print the GC and shift stacks if the environment variable
    SWIPL_DEBUG_GC_STACK is set.

  • DOC: Add --sigalert=NUM to swipl --help.

  • FIXED: trie_gen_compiled/3: deal with small integer value

  • FIXED: trie_gen_compiled/2,3: add indirect data (big integers,
    strings, rational)

  • FIXED: trie_gen_compiles/2,3: possible stack corruption

  • FIXED: #1277 crash in trie_gen_compiled/3.

  • CLEANUP: Avoid to undefined sanitizer warnings.

  • CLEANUP: Avoid UBSAN error Test for arity > 0

  • CLEANUP: workaround for an UBSAN error UBSAN complained about a left
    shift of -1

  • CLEANUP: avoid UBSAN error in mkvmi.c The error is raised because we
    have e5 -= 0 for e5 == NULL

    else-branch of if ( !e4 || (is_vmh && !e5) )
    <=> e4 && !(is_vmh && !e5)
    <=> e4 && (!is_vmh || e5)

    Consequence is e4-- (which is fine) and e5 -= is_vmh which is either
    a noop* for is_vmh == 0 or fine for is_vmh != 0 && e5 != NULL.

    The noop case raises the error if e5 == NULL. * CLEANUP: Use
    unsigned int for variable table bitmap.
    This avoids an officially undefined shift in C.

  • FIXED: Possibly undefined too large shift

  • FIXED: bf_set_si for -INT_MIN avoid undefined behavior raised by UBSAN

  • PORT: !1269 Deal with the type z_crc_t used by minizip zlib This
    works around a type conflict over get_crc_table(). Some headers define
    this as returning z_crc_t* without defining this type while others
    (Fedora 40) defines the function as uint32_t* and defines z_crc_t.
    This patch makes CMake check for the z_crc_t type and, if defined,
    use this definition.

  • ADDED: qsave_program/2: --foreign=copy to copy DLLs for Windows.

  • ADDED: library(www_browser): support host relative links.

  • ENHANCED: Added toplevel options +, - to modify max_depth This option
    also changes ‘w’ to merely drop portrayed(true) and p to add it.

  • DOC: write_term/2: document interaction between portrayed and
    numbervars

  • FIXED: Do not name binding variables if the answer options to not
    handle '$VAR'(N)

  • RELEASE: update-macports: verify we can download the source file This
    avoids forgetting to update the source file as well as the CDN delay.

Package clib

  • CLEANUP: Use unsigned integers for bitmaps Avoids undefined shifts
    and makes the code more readable.

Package http

  • ADDED: http_reply_from_files/3: option not_found(+Action) Using
    not_found(404), reply using http_404/1 if the requested file does
    not exist.

Package pldoc

  • ADDED: plDoc: support __text__ and **text** for strong.

  • ADDED: Support [Label](mailto:me@example.com) links in PlDoc

Package xpce

  • CLEANUP: Avoid relying on too big integer shift Also document that
    the save format is not 64-bit robust. I do not know the consequences.
    Probably it just limits the size of some objects.
2 Likes

“reinstall” command of Homebrew on macOS successfully has installed v.9.3.6.

% brew reinstall swi-prolog
Log
==> Fetching swi-prolog
==> Downloading https://raw.githubusercontent.com/Homebrew/homebrew-core/7360447deaa
############################################################################# 100.0%
==> Cloning https://github.com/SWI-Prolog/swipl-devel.git
Updating /Users/cantor/Library/Caches/Homebrew/swi-prolog--git
From github:SWI-Prolog/swipl-devel
f4d008220..be3ff0be2 master -> origin/master
Fetching submodule packages/http
From github:SWI-Prolog/packages-http
cb2a3a7..b21fa80 master -> origin/master
Fetching submodule packages/redis
From github:SWI-Prolog/packages-redis
df11509..c2f77e4 master -> origin/master
Fetching submodule packages/xpce
From github:SWI-Prolog/packages-xpce
4ce859ff..6ba256c9 master -> origin/master
==> Checking out branch master
Already on 'master'
Your branch is behind 'origin/master' by 15 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
HEAD is now at be3ff0be2 Possibly uninstantiated variable when compiled for debugging.
Entering 'bench'
Entering 'debian'
Entering 'packages/PDT'
Entering 'packages/RDF'
Entering 'packages/archive'
Entering 'packages/bdb'
Entering 'packages/chr'
Entering 'packages/clib'
Entering 'packages/clpqr'
Entering 'packages/cpp'
Entering 'packages/cql'
Entering 'packages/http'
Entering 'packages/inclpr'
Entering 'packages/jpl'
Entering 'packages/libedit'
Entering 'packages/ltx2htm'
Entering 'packages/mqi'
Entering 'packages/nlp'
Entering 'packages/odbc'
Entering 'packages/paxos'
Entering 'packages/pcre'
Entering 'packages/pengines'
Entering 'packages/pldoc'
Entering 'packages/plunit'
Entering 'packages/protobufs'
Entering 'packages/readline'
Entering 'packages/redis'
Entering 'packages/semweb'
Entering 'packages/sgml'
Entering 'packages/ssl'
Entering 'packages/stomp'
Entering 'packages/sweep'
Entering 'packages/swipl-win'
Entering 'packages/swipy'
Entering 'packages/table'
Entering 'packages/tipc'
Entering 'packages/utf8proc'
Entering 'packages/windows'
Entering 'packages/xpce'
Entering 'packages/yaml'
Entering 'packages/zlib'
Submodule path 'packages/http': checked out 'b21fa807bd3cd4fe93f2381bf71088f362e59a8e'
Submodule path 'packages/redis': checked out 'c2f77e446f6c28ca3e1c1cbb2314a55602e090b1'
Submodule path 'packages/xpce': checked out '6ba256c991323242afbca6172729df7a9cdc7f2d'
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/bench
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/debian
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/PDT
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/RDF
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/archive
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/bdb
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/chr
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/clib
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/clpqr
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/cpp
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/cql
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/http
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/inclpr
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/jpl
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/libedit
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/ltx2htm
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/mqi
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/nlp
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/odbc
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/paxos
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/pcre
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/pengines
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/pldoc
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/plunit
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/protobufs
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/readline
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/redis
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/semweb
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/sgml
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/ssl
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/stomp
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/sweep
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/swipl-win
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/swipy
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/table
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/tipc
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/utf8proc
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/windows
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/xpce
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/yaml
/Users/cantor/Library/Caches/Homebrew/swi-prolog--git/packages/zlib
==> Reinstalling swi-prolog
==> cmake -S . -B build -DSWIPL_PACKAGES_JAVA=OFF -DSWIPL_PACKAGES_X=OFF -DCMAKE_INS
==> cmake --build build
==> cmake --install build
🍺 /usr/local/Cellar/swi-prolog/HEAD-be3ff0b: 1,078 files, 22.4MB, built in 2 minutes 33 seconds
==> Running `brew cleanup swi-prolog`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
% swipl --version
SWI-Prolog version 9.3.6 for x86_64-darwin
%

Thanks to Homebrew and your formula for the homebrew, now I ( we, a mac user) need not keep the cloned git directory any more to get latest version.

All good on my Arch Linux laptop. I got one warning because I don’t have emacs installed, but that wasn’t a show stopper. “100% tests passed, 0 tests failed out of 83”.

I see Arch Linux’s pacman would install “extra/swi-prolog 9.2.4-1” so I’m thinking of going with it since then I’d automatically update once a month or so. The last time I used the distribution’s SWI-Prolog many years ago I recall there was a problem with it not having ODBC support, but since I’ve switched to having PostgreSQL communicating with swipl rather than vice-versa, that wouldn’t be a problem for me anymore.

On my Arch Linux server, unfortunately, ninja failed:

[1089/1461] Generating pldoc2tex
FAILED: man/pldoc2tex /home/roblaing/src/swipl-9.3.6/build/man/pldoc2tex 
cd /home/roblaing/src/swipl-9.3.6/build/man && /home/roblaing/src/swipl-9.3.6/build/src/swipl -f none --no-packs -o /home/roblaing/src/swipl-9.3.6/build/man/pldoc2tex --class=development --no-autoload --no-stand_alone -c /home/roblaing/src/swipl-9.3.6/man/pldoc2tex.pl -- --nopce
ERROR: /home/roblaing/src/swipl-9.3.6/build/home/library/ext/utf8proc/unicode.pl:44:
ERROR:    /home/roblaing/src/swipl-9.3.6/build/home/library/ext/utf8proc/unicode.pl:44: Initialization goal raised exception:
...
Warning: Halting with status 1 due to 11 errors and 0 warnings
[1091/1461] Building C object packages...CMakeFiles/plugin_odbc4pl.dir/odbc.c.o
ninja: build stopped: subcommand failed.

The offending line has

:- use_foreign_library(foreign(unicode4pl)).

This means something is wrong building unicode4pl.so. There should either be some warning above about this, or there is a missing dependency that causes the build order to be incorrect. That hasn’t been reported for a long time, but one never knows.

There is a simple way to find out by running ninja once more. If it happily continues and the result seems fine (see check_installation/0 and ctest), we are facing a dependency problem.

No luck with running ninja again. But I’ve decided that on the server to be conservative and rather go with pacman -S swi-prolog which installed version 9.2.4 with ODBC support no problem.

Not sure what I installed on my laptop that the server doesn’t have. I don’t bother with any X related stuff on the server since everything has to run in a terminal via ssh, so I’m guessing that caused the missing unicode4pl library.

Dropping xpce is surely a good thing for something that must run in the terminal. It is no reason why the utf8proc package does not build. This is rather curious as this is a completely self contained package, i.e., it has no dependencies. Could you run this and report any messages?

ninja -t clean utf8proc
ninja utf8proc

It should remove and rebuild 5 files and give no errors or warnings.

That fixed it:

[roblaing@localhost src]$ cd swipl-9.3.6/build
[roblaing@localhost build]$ ninja -t clean utf8proc
Cleaning... 4 files.
[roblaing@localhost build]$ ninja utf8proc
[5/5] Linking C shared module packages/utf8proc/unicode4pl.so
[roblaing@localhost build]$ ninja
[363/363] Generating tests/test_certs/generated
[roblaing@localhost build]$ ctest -j $(nproc) --output-on-failure
...
100% tests passed, 0 tests failed out of 83

Total Test time (real) =  35.23 sec

But I’m not going to install, just sticking to my package manager to be safe. Will use the latest version on my development machine though.

Thanks. Remains why it was not built in the first run :frowning: Considering the clean, it built just 4 of the 5 files for this package!?

Yip. Also a bit conservative. At the moment, the stable version might indeed be more stable. Most of the time, the development releases have fewer issues :slight_smile:

It’s really weird that it builds fine on one computer I have with Arch Linux installed but not on another. The problem one is a “minimalist” installation so some or other library is missing, but it’s beyond my knowledge to figure out what.

I used to be a “Linux from Scratch” guy, but as the xz hack debacle has shown, it’s become too complicated for anyone to understand how everything fits together anymore and what dangers lurk in various dependencies.

It was a missing dependency declaration. It turned up because the nightly builds for Windows were failing on the same issue. Pushed a fix (now only in the git version as 9.3.7 was just released :frowning: )

1 Like

Installed swi-prolog via Homebrew a few minutes ago and the executable reports

SWI-Prolog version 9.2.5 for arm64-darwin

After a reinstall the version number has not changed.

Hardware: Mac mini M1
Software: Sonoma 14.5

While v9.2.5 will suffice for the moment would prefer to have the latest fixes and enhancements.

I thought, once homebrew install --HEAD swi-prolog then
it will always upgrade with --HEAD (without --HEAD option). Anyway I will be careful whether it is the case.

% swipl --version
SWI-Prolog version 9.3.7 for arm64-darwin
%

I meet always errors with ninja…

joseph@mx:~/swipl-devel/build$ ninja
ninja: error: 'man/archive', needed by 'man/lib/prologpack.tex', missing and no known rule to make it

This problem has come up in the past and should have been fixed. Did you delete the “build directory” before running cmake and ninja?

Here is an old thread (Jan’s response to my solution of “mkdir -p …/man/archive”):

I only followed the instructions here : https://www.swi-prolog.org/build/unix.html . So , I was in build directory. It is not said that this build directory must be deleted…

In some situations, cmake and/or ninja can get confused about what needs to be built; deleting the “build” directory ensures that everything is rebuilt.

Thanks for your interest and your help.
In fact, creating an archive directory in build/man solved my problem. ( Ninja said :

ninja: error: 'man/archive', needed by 'man/lib/prologpack.tex', missing and no known rule to make it

Now I have the new release of SWI-Prolog:

joseph@mx:~$ swipl --version
SWI-Prolog version 9.3.7 for x86_64-linux

It seems you do not have the libarchive dependency installed. Probably a missing dependency in homebrew. I think the recipe needs some maintenance. Any homebrew users willing to do that?

As homebrew user, I have checked that libarchive has been installed, though I have no idea what it does for
the user.

% brew search libarchi
==> Formulae
libarchive ✔