Ann: SWI-Prolog 9.1.20

Dear SWI-Prolog users,

SWI-Prolog 9.1.20 is ready for download. Highlights:

  • Discussions about Janus, the Python interface are practically
    finished. The latest modifications have been incorporated.
    The documentation is extended with a compatibility note for
    all predicates and Python functions that are covered by the
    discussions.

  • A lot of changes to CMake configuration management to facilitate
    Conda. This notably streamlines building on Windows using
    VS2022 and better facilitaties to support the POSIX-like
    application layout on Windows next to the conventional
    stand-alone directory in C:\Program Files\swipl. The
    current Conda recipe is at
    GitHub - SWI-Prolog/swi-prolog-feedstock. The plan
    is to get that merged into the official Conda forge port at
    GitHub - conda-forge/swi-prolog-feedstock: A conda-smithy repository for swi-prolog..

  • Generalize the benchmark suite. See other posts. Hopefully
    this can be extended to more systems and wider coverage.

  • Several sandbox updates to facilitate clpBNR by @ridgeworks

  • A small enhancement to calling foreign predicates. This is
    a change in the VM that invalidates old states and .QLF files.
    If you do an incremental update, please remove the *.plf
    files under the build directory before building. With incremental
    build I refer to git pull && git submodule update followed by
    ninja in the build directory. If you build in a fresh
    build directory all works fine.

    Enjoy ā€” Jan

P.s. Problems with Ubuntu PPA services appear to be resolved and PPAs
are available for 9.1.20.

SWI-Prolog Changelog since version 9.1.19

  • DOC: Improve swipl --help (list ā€œappā€ mode)

  • SANDBOX: Declare flag write_attributes as safe. This may call
    portray, but local definitions are verified and global definitions
    cannot be changed.

  • CLEANUP: Move installation locations to cmake/Locations Moving it
    into a separate file keeps the main file short and it needs to be
    before Ports because we need to act on them. Possibly though, we
    need part of the locations before and part after the Ports? As is,
    that does not seem to be the case. Alternatively we could move part
    of this into the Port files?

  • PORT: Allow for not having a compiled-in ā€œhomeā€ directory Conda has
    no sensible fixed installation location.

  • FIXED: check_installation not to bail out if a feature test raises
    an exception.

  • CLEANUP: Moved default definition for file_search_path/2 foreign
    to library(shlib). This simplifies maintenance. The change also adds
    swi(lib/Arch) for all platforms, although the default SWI-Prolog
    for Windows installs the libraries in swi(bin). Possibly we can
    change that too?

  • INSTALL: Allow installing in public directory without symlink For some
    installations we want the executables in another directory than the
    ā€œhomeā€. Normally these were POSIX systems and we would symlink from
    the executable to the real location in the self-contained binary.

    But, also some Windows installations such as MSYS2 and Conda (and
    probably
    Cygwin) want this. Therefore we added SWIPL_INSTALL_AS_LINK which, if
    OFF, compiles the relative path to the anticipated home into the binary
    such that we can install the .exe in a separate directory (for Windows
    along with the DLLs needed to run them).

  • CLEANUP: format_types/2 Remove not-working attempt to make it
    bi-directional. It now properly raises an instantiation error,
    causing sandbox analyis to work without breaking anything.

  • FIXED: Conditional compilation and :- include/1. Avoid errors on

    :- if(...).
    :- include(...).
    :- elif(...).
    ...
    
  • ENHANCED: Shorten and simplify calling deterministic foreign functions
    This patch unifies I_FOPEN with the subsequent calling function and
    somewhat simpifies the design.

  • SANDBOX: added several arithmetic predicates as safe: -
    current_arithmetic_function/1 - bounded_number/3 - float_class/2 -
    float_parts/4

Package bench

  • ENHANCED: Better compensation for computing dummy overhead.
    Contributed by Jose Morales

  • PORT: Make benchmarks run on Scryer Prolog 0.9.3

  • FIXED: queens_clpfd.pl benchmark merely posted the constraints.
    Now actually solves them and does not generate all solutions as these
    are too many.

  • ADDED: Ciao lang

  • PORT: Improve portability for boyer.pl

  • PORT: Generalize, support XSB, GNU-Prolog and Trealla Prolog.

  • PORT: Support clpfd benchmark for SICStus.

  • PORT: fast_mu.pl: avoid length/2.

  • PORT: browse.pl benchmark to avoid length/2

  • PORT: sieve.pl: avoid forall/2, ignore/1 and between/3.

  • ENHANCED: Portability, Prolog driver, many details Now uses a single
    (SWI-)Prolog program for the overall management, running the Prolog
    system(s), joining the data and generating the chart.

    We now have a system in place to support pretty much every Prolog
    system, with or without modules. SWI, Yap and SICStus can do the
    job with the original sources. For e.g., Scryer we transform the
    sources and test beforehand which files Scryer can handle.

  • COMPAT: Avoid name/2 in favor of atom_codes/2 and number_codes/2.

  • PORT: Support CSV for all platforms

  • PORT: Revive YAP and SICStus compatibility.

Package clib

  • ADDED: ensure_directory/1

Package cpp

  • MODIFIED: SWI-cpp2.h includes inlined methods by default

Package http

  • ADDED: reply_html_partial/1 Reply HTML element without DOCTYPE
    and <html>.

Package pengines

  • FIXED: chunk=false. Spotted by @meditans

  • ADDED: Allow no-chunking behavior for pengines. If chunk=false
    we avoids the usage of findnsols (and the effects on global variables
    associated with its backtracking). Initially, this was motivated by
    the fact that I wanted the pengine top-level (which is recursive
    in nature) to respect the chr store, but I also think itā€™s a more
    principled thing to do.

Package pldoc

  • ADDED: @since tag Allows annotating the version when a predicate
    was added.

Package swipl-win

  • INSTALL: Sync with central cmake changes

Package swipy

  • ADDED: Allow returning Python dicts as {K:V,ā€¦} terms. Improves
    portability.

  • MODIFIED: Return dicts we cannot represent using portable style.

  • COMPAT: Python functions that as for truth values now use truth_vals
    truth_vals is the original keyword name from XSB. truth was
    considered too ambiguous.

    As decided in Janus PIP (Prolog Improvement Proposal) meeting on Nov 22.

1 Like

I take it that this is not referring to Python Janus

and instead is a private meeting between Prolog implementation developers. Is that correct?

Indeed. The Python package is agreed to be called janus_<system>, for us janus_swi

Indeed. At the ICLP conference in London the idea of PIP (Prolog Improvement Proposal) was launched. The idea is that multiple (as in more than one) teams discuss something related to Prolog and write this up as a public PIP publication. Janus was discussed between the XSB team that started Janus, me and people from Ciao that launched the PIP idea. The technical discussion is practically finished and we are now discussing what the PIP publication must look like.

The idea behind PIPs is that, due to a small number of participants that have at least some common understanding about a topic, we can make real progress. The result does not need to be exhaustive and formal like with ISO and does not need to be accepted by a large group. That way, we have proven that we cannot make progress :frowning: Still, the problem is considered from multiple perspectives and the result is typically better than what any of the individual teams could have achieved.

Surely this worked for Janus were we started with the idea that a low-level bi-directional interface that exploits the dynamic data types of both languages is what we want to build. We started with quite different viewpoints about the API though. All has landed nicely. Surely, one can see some compromises in the final result. The result is also better than what either of us started with :slight_smile:

I am now quite convinced this works nicely for topics that are either not yet settled or for which there are no serious backward compatibility issues. The whole process needs to be streamlined a bit, including establishing a team, (not) sharing progress and making the result public.

Still, something good seems to have started :slight_smile:

2 Likes

Thanks!

That was the missing info. I did not know that PIP also meant Prolog Improvement Proposal and when seeing talk of Python and the acronym PIP instintivly thought of pip Ā· PyPI

I was also wanted to clarify this before a search engine starts the Python world deciding upon this post and then we get unneeded questions.

Application crashed on startup on Intel Mac (compatibility issue with Qt and MacOS 10.14?).

Partial Details
Process:               SWI-Prolog [64904]
Path:                  /Applications/SWI-Prolog9.1.20.app/Contents/MacOS/SWI-Prolog
Identifier:            org.swi-prolog.app
Version:               9.1.20 (???)
Code Type:             X86-64 (Native)
Parent Process:        ??? [1]
Responsible:           SWI-Prolog [64904]
User ID:               501

Date/Time:             2023-11-30 11:20:33.063 -0500
OS Version:            Mac OS X 10.14.6 (18G103)
Report Version:        12
Anonymous UUID:        0E64E3EA-0024-1BF1-12FE-14BA575B1E40


Time Awake Since Boot: 1300000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000000cee300c
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [64904]

VM Regions Near 0xcee300c:
--> 
    __TEXT                 000000010cee3000-000000010cf1b000 [  224K] r-x/r-x SM=COW  /Applications/SWI-Prolog9.1.20.app/Contents/MacOS/SWI-Prolog

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   org.swi-prolog.app            	0x000000010cf0ce2c 0x10cee3000 + 171564
1   org.swi-prolog.app            	0x000000010cf06220 ConsoleEdit::ConsoleEdit(int, char**, QWidget*) + 368
2   org.swi-prolog.app            	0x000000010cef6d6e pqMainWindow::pqMainWindow(int, char**) + 94
3   org.swi-prolog.app            	0x000000010cf10107 swipl_win::swipl_win(int&, char**) + 71
4   org.swi-prolog.app            	0x000000010ceef676 main + 134
5   libdyld.dylib                 	0x00007fff68d7e3d5 start + 1

More such details available on request.

:frowning: Tested on my old Intel Mac running Ventura 13.2.1. Runs fine (but slow compared to the M1 :slight_smile: )

It is not Qt, or any of the non-macOS dependencies as the binaries thereof have not been updated. The release is compiled using MACOSX_DEPLOYMENT_TARGET=10.14. The only thing relevant I can think of that is updated is the xCode. MacOS 10 is end-of-life since Sep 2022. Possibly the command-line version still works? It is inside the app at Contents/MacOS/swipl (from my head).

Iā€™m afraid there is not much that can be done about that. What I can think of is

  • Compile from source. To keep it simple using Homebrew or Macports dependencies.
  • Upgrade MacOS. If your hardware is too old, there is still Linux for Max hardware ā€¦

Command line version starts up fine:

$ SWI-Prolog9.1.20-bndl/MacOS/swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.1.20)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- 

Sounds like it might be a MacOS version dependency in the bundle, but whatā€™s the difference between 9.1.19, which runs fine, and 9.1.20 which crashes immediately? (Changes to CMake sound a little ominous.)

Basically nothing changed except for the C/C++ compiler that was updated to the latest xCode version. None of the libraries involved in the GUI was updated. Something similar happened to GMP when used with the app quite some MacOS and Prolog versions back :frowning:

Something has obviously changed and the command line version seems to be OK, although Iā€™m not sure what that means. Iā€™ll spend some time looking at the bundle contents in more detail.

You could try to copy swipl-win from a working old version to the new version. Eventually this looks like a dead end though. SWI-Prolog tries to support an as wide as possible range of versions in dependencies, build tools and OSes. While supporting the latest versions has priority, OS versions that have passed end-of-life have no priority. If it works, fine, if not, bad luck. Sorry about that.

Replacing the 9.1.20 version of the SWI-Prolog executable with the 9.1.19 version did indeed fix the problem AFAICT. I conclude there is nothing wrong with any of the other libraries or the configuration either internal to the bundle or in the OS. Unless something has changed in the SWI-Prolog executableā€™s source, the root cause, as suspected, seems to be the new version of Appleā€™s build tools. I have to wonder what the change might be to cause such a drastic difference in behaviour (a Segmentation fault) .

As far as future considerations are concerned, my experience with Appleā€™s OS releases is ā€œif it ainā€™t broke donā€™t fix itā€. MacOS 10.14 is a perfectly serviceable OS from my perspective as I have no need to support new hardware, but a vested interest in keeping the various applications I do have functioning. If anything, this little episode would seem to validate that approach. From time to time I upgrade to suit my needs, but itā€™s never a painless experience. As someone who has to support the latest products, hardware and software, youā€™ll have a different, equally valid, perspective.

Hi Jan,

Here is an error with my setup when I do ā€œmakeā€ :

[ 67%] Generating pldoc2tex
Warning: /usr/local/swipl-devel/build/home/library/doc_latex.pl:54:
Warning: /usr/local/swipl-devel/build/home/library/prolog_xref.qlf: Invalid QLF file: incompatible VM-signature (file: 0x9fa44fc5; Prolog: 0x408bfff4)
% pldoc(doc_html): recompiling QLF file (out of date)
Warning: /usr/local/swipl-devel/build/home/library/pldoc/doc_htmlsrc.pl:43:
Warning: /usr/local/swipl-devel/build/home/library/prolog_colour.qlf: Invalid QLF file: incompatible VM-signature (file: 0x9fa44fc5; Prolog: 0x408bfff4)
ERROR: /usr/local/swipl-devel/build/home/library/pldoc/doc_colour.pl:39:
ERROR: load_files/2: No permission to load source '/usr/local/swipl-devel/build/home/library/prolog_xref.pl'' (Non-module file already loaded into module pldoc_latex; trying to load into pldoc_colours) Warning: /usr/local/swipl-devel/build/home/library/pldoc/doc_colour.pl:39: Warning: Goal (directive) failed: pldoc_colours:use_module(library(prolog_xref)) ERROR: /usr/local/swipl-devel/build/home/library/pldoc/doc_colour.pl:41: ERROR: load_files/2: No permission to load source ā€˜/usr/local/swipl-devel/build/home/library/prolog_colour.plā€™ā€™ (Non-module file already loaded into module pldoc_htmlsrc; trying to load into pldoc_colours)
Warning: /usr/local/swipl-devel/build/home/library/pldoc/doc_colour.pl:41:
Warning: Goal (directive) failed: pldoc_colours:use_module(library(prolog_colour))
ERROR: /usr/local/swipl-devel/build/home/library/pldoc/doc_htmlsrc.pl:51:
ERROR: load_files/2: No permission to load source '/usr/local/swipl-devel/build/home/library/prolog_xref.pl'' (Non-module file already loaded into module pldoc_latex; trying to load into pldoc_htmlsrc) Warning: /usr/local/swipl-devel/build/home/library/pldoc/doc_htmlsrc.pl:51: Warning: Goal (directive) failed: pldoc_htmlsrc:use_module(library(prolog_xref)) Warning: /usr/local/swipl-devel/build/home/library/pldoc/doc_htmlsrc.pl:569: Warning: /usr/local/swipl-devel/build/home/library/prolog_colour.qlf: Invalid QLF file: incompatible VM-signature (file: 0x9fa44fc5; Prolog: 0x408bfff4) Warning: /usr/local/swipl-devel/build/home/library/pldoc/doc_htmlsrc.pl:569: Warning: /usr/local/swipl-devel/build/home/library/prolog_colour.qlf: Invalid QLF file: incompatible VM-signature (file: 0x9fa44fc5; Prolog: 0x408bfff4) ERROR: /usr/local/swipl-devel/build/home/library/pldoc/doc_htmlsrc.pl:569: ERROR: [Thread 1]: exception handler failed to define pldoc_htmlsrc:syntax_colour/2 ERROR: /usr/local/swipl-devel/build/home/library/pldoc/doc_htmlsrc.pl:569: ERROR: pldoc_htmlsrc:span_term/2: Unknown procedure: pldoc_htmlsrc:syntax_colour/2 ERROR: /usr/local/swipl-devel/build/home/library/pldoc/doc_html.pl:129: ERROR: load_files/2: No permission to load source ā€˜/usr/local/swipl-devel/build/home/library/prolog_xref.plā€™ā€™ (Non-module file already loaded into module pldoc_latex; trying to load into pldoc_html)
Warning: /usr/local/swipl-devel/build/home/library/pldoc/doc_html.pl:129:
Warning: Goal (directive) failed: pldoc_html:use_module(library(prolog_xref))
ERROR: /usr/local/swipl-devel/man/pldoc2tex.pl:41:
ERROR: load_files/2: No permission to load source `ā€˜/usr/local/swipl-devel/build/home/library/prolog_xref.plā€™ā€™ (Non-module file already loaded into module pldoc_latex; trying to load into pltotex)
Warning: /usr/local/swipl-devel/man/pldoc2tex.pl:41:
Warning: Goal (directive) failed: pltotex:use_module(library(prolog_xref))
Warning: Halting with status 1 due to 7 errors and 9 warnings
make[2]: *** [man/CMakeFiles/pldoc2tex_state.dir/build.make:74 : man/pldoc2tex] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:3071 : man/CMakeFiles/pldoc2tex_state.dir/all] Erreur 2
make: *** [Makefile:166 : all] Erreur 2

As the announcements tells us ā€¦ I know, it is easy to miss. In general though, incremental builds work 99% of the time. If they fail, check the announcement or simply delete and recreate the build directory. Note there is no reason to remove the sources because the build process does not touch anything outside this directory.

Thanks Jan. Sorry for this. I must say that I do not succeed to use Ninja with my MX Linux (Debian stable) and I do not know why. If you are a Linux user, your help will be welcome, again. :wink: But of course, I can make a fresh build directory .

In this case, simply deleting the *.qlf files will do, whether you use make or ninja. I wonder why ninja does not work? I use it on all Linux and MacOS builds. Surely works on Debian as well. The user experience is much better: it is faster and reuses the same terminal line for reporting progress, only leaving warnings and errors.

Many thanks Jan. I will insist to succeed in using Ninja with my Debian. I also will write a report if that helps. All the best.

I use cmake on Debian (on a ChromeBook) - no problems.
For a complete rebuild, I do ā€œrm -rf buildā€ and then run the following commands twice (cmake thinks that the first build leaves some files needing to be built a 2nd time), followed by ninja install:

cd build
cmake -G Ninja -DCMAKE_BUILD_TYPE=PGO -DCMAKE_INSTALL_PREFIX=$HOME/.local -DINSTALL_DOCUMENTATION=ON -DBUILD_PDF_DOCUMENTATION=OFF -DTEST_PROTOBUFS_PROTOC=OFF ..
env -i PATH=/usr/bin LANG=en_US.UTF-8 /usr/bin/ctest -j8

Hi Jan,
installation successful:

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

Nevertheless, ninja install does not work in my setup and I had to make a symbolic link:

root@mx:/usr/local/swipl-devel/build/src# ln -s /usr/local/swipl-devel/build/src/swipl /usr/local/bin/swipl

Again, many thanks for SWI-Prolog !

All the best,
Jo.

Hmm. Most of that seems unneeded. Documentation and protobufs options are default. Running things twice is, AFAIK, not needed from a clean build. Surely this is not done for all the release builds. As is, the known problems are

  • The version stamp is not properly updated by simply running ninja after changes. Works fine if you frst run cmake .
  • Changes that affect the qlf format require deleting all .qlf files before the build.
  • Ensuring the library index files are up-to-date is not elegant. As is, we force updating them at the end of the build. That causes warnings with some build backends (but works on all).
  • Package dependencies are not well described, which may lead to problems when trying to use non-standard selections of packages.

Setting LANG for running the tests should not be necessary (used to be).

What goes wrong?

As is, the build is supposed to work using the following backends: ninja, Unix make, VS project files and Microsoft nmake.

What went wrong in my setup with ninja install was that it did not work like make install . With make install it seems to me that a symbolic link was created in /usr/local/bin .
By contrast, with ninja install, I get this:

root@mx:/usr/local/swipl-devel/build# ninja install
[47/48] Install the project...
-- Install configuration: "PGO"
-- Set runtime path of "/root/lib/swipl/bin/x86_64-linux/swipl" to "/root/lib/swipl/lib/x86_64-linux"
-- Set runtime path of "/root/lib/swipl/lib/x86_64-linux/libswipl.so.9.1.20" to "/root/lib/swipl/lib/x86_64-linux"
-- Set runtime path of "/root/lib/swipl/bin/x86_64-linux/swipl-ld" to "/root/lib/swipl/lib/x86_64-linux"
-- Set runtime path of "/root/lib/swipl/lib/x86_64-linux/libjpl.so" to "/root/lib/swipl/lib/x86_64-linux:/usr/lib/jvm/default-java/include:/usr/lib/jvm/default-java/include/linux:/usr/lib/jvm/default-java/lib/server"
-- Set runtime path of "/root/lib/swipl/bin/x86_64-linux/swipl-win" to "/root/lib/swipl/lib/x86_64-linux"

and as you can see, nothing is done for /usr/local/bin :face_with_raised_eyebrow: