# Ann: SWI-Prolog 8.5.2

**URL:** <https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-2/4652>\
**Category:** Releases\
**Created:** [November 12, 2021, 3:08pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-2/4652 "2021-11-12T15:08:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [November 12, 2021, 3:08pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-2/4652/1 "2021-11-12T15:08:05Z")

</div>

Dear SWI-Prolog user,

SWI-Prolog 8.5.2 is ready for download. Most of the changes concern  
portability, testing and stability. Highlights:

- Handle C-stack overflows as normal Prolog exceptions for read/1,  
write/1 and assert/1 (and friends). Only works on POSIX systems  
that provide the sigaltstack() API.

- Several reports on test failures by @peter.ludemann. Resulted in  
a fix for a possible crash in shutdown.

- Serious rewrite for installing community packs that involve  
foreign components. Now provides support for conan for  
dependencies and much enhanced support for CMake for building.  
May cause some (pack install) regression. Please report.

- Clean build on `gcc-11` (stop some innocent warnings). Unfortunately  
gcc-11 seems to produce noticeable slower code (~5%) than 10 and 9.

- Make SWI-cpp.h compile without warnings on `g++-11`.

- Corinna Vinschen updated the Cygwin port.

@eric.zinda, I’m afraid I missed the latest MQI patches. They are now  
in the git version. Sorry.

```
Enjoy --- Jan

```

# SWI-Prolog Changelog since version 8.5.1

- STYLE: list\_void\_declarations/0, part of checks after make/0 to list  
predicates defined as discontuguous/1 while they have no clauses.  
This is, according to ISO, not a bug as such predicates are considered  
to be defined.

- FIXED: Be more relaxed about existence of the _current_ predicate  
when pushing and popping the compilation context.

- ENHANCED: Report failed build steps because no tools was willing to  
do the job. Pass `-DCMAKE_BUILD_TYPE=Type`, which may be set from  
the options to pack\_install/2.

- ENHANCED: Get version info into the Prolog flag. Now uses CMake rather  
than a shell script and provides a new Prolog flag `cmake_build_type`.

- FIXED: pack\_install/1 _install_ step for make based packages.

- FIXED: Rebuilding GNU-style packages failed due to catching wrong  
exception.

- FIXED: pack\_rebuild/1 for CMake configurations.

- ADDED: A file `<home>/cmake/swipl.cmake` that provides generics to  
use CMake for building SWI-Prolog packs.

- DOC: Updated CMake build instructions.

- ADDED: pack\_install/1: reorganized the code building foreign resources.  
This code is now in a new library(build/tools) and uses a plugin  
architecture that deals with Conan, CMake and GNU tools (autoconf  
etc.). The changes are intended to be fully compatible with the  
old system. The build system now supports more tools and provides  
mechanisms for structured extensions.

- DOC: meta\_predicate/1: updated mode declarations.

- EHNACED: pack\_rebuild/1,2 for CMake based packages to use `cmake --build` and `cmake --install` for the build and install steps rather  
than calling `make`, `ninja`, etc. directly. Suggested by Wouter Beek.

- MAINTENANCE: Possible segv in retract/1 when compiled using O\_DEBUG.

- FIXED: Possible race conditions between the various ways a thread  
can be joined.

- FIXED: Do not start a new thread to join garbage collected threads  
while shutting down the system.

- MAINTENANCE: On a system error we only go into interactive mode if  
both stdin and stderr are connected to a terminal. Otherwise we  
print the message, C and Prolog stack and abort.

- MAINTENANCE: Use of guarded C-stack using sigaltstack() doesn’t go  
with ASAN. Results in the error below. Disabled guarding the C  
stack when compiling using address sanitizer. ``` ==101190==ERROR:  
AddressSanitizer failed to deallocate 0x2000 (8192) bytes at  
address 0x6250000b1900 ==101190==AddressSanitizer CHECK failed:  
../../../../src/libsanitizer/sanitizer\_common/sanitizer\_posix.cc:60  
“((“unable to unmap” && 0)) != (0)” (0x0, 0x0)

- FIXED: CMake packs must use environment variables.

- ADDED: Support `ninja` builds when using CMake

- FIXED: pack\_install/1,2: If we use CMake for configuration, we should  
also build in the CMake directory.

- TEST: Signalled thread may already be dead.

- ADDED: pack\_install/1,2: provide pack\_install(.) to add the local  
directory to the pack registry and build it. Also add option `link(true)`  
and `rebuild(When)` to provide more fine control over the build.

- FIXED: pack\_install/1,2: do not remove contents if the package  
registered as a symbolic link.

- FIXED: memberchk/2 for partial lists where the unbound part is  
constrained. Reported on Discourse by Abramo Bagnara.

- BUILD: Avoid GCC-11 warning

- ENHANCED: Protect assertz/1 and friends (compiler) against C-stack  
overflows.

- ENHANCED: Use setjmp() instead of sigsetjmp() to reduce the overhead  
of the C-stack guarding.

- MAINTENANCE: Updated C calltree analysis for CMake build and new  
coding style and conventions.

- FIXED: Fallback to find a place for packages to install executables.

- FIXED: Hash consistency on pointer sided integers for 64-bit bigendian  
machines. Only affects consistency of term\_hash/2 over platforms.

- FIXED: Checking that an uncaught exception is caught in an _outer  
environment_, i.e., nested C\<-\>Prolog callback.

- FIXED: Make C-stack guarding work in threads.

- ENHANCED: Use C-stack guarding for read/1 and friends.

- FIXED: format/2,3: Term printing using ~[kpqw] did not propagate  
exception.

- ENHANCED: Handle C-stack overflows gracefully on POSIX targets with  
sigaltstack().

## Package cpp

- CLEANUP: SWI-cpp.h: more consistent type handling and silence several  
more casts.

- COMPATIBILITY: SWI-cpp.h to use `static_cast<type>(expression)`  
to avoid warnings on modern C++ compilers.

## Package http

- TEST: Simplified shutdown management for the http:proxy tests.

## Package jpl

- BUILD: Silence GCC-11 warning (ugly)

## Package mqi

- TEST: Handle all failures from test\_server\_options\_and\_shutdown as  
warnings unless “SWIPL\_TEST\_FAIL\_ON\_UNLIKELY=y” This test has lots  
of threading and potential race conditions so it can fail when the  
system is heavily loaded.

- DOC: Update URLs from EricZinda/swiplserver to packages-mqi

- ADDED: All files needed to actually build the Python ‘swiplserver’  
model and post to [pypi.org](http://pypi.org) so that ‘pip install swiplserver’  
works Includes instructions on how to the build the model in  
/BuildingAndTesting.md

## Package odbc

- CMAKE: Requires minimally cmake 3.9

## Package protobufs

- FIXED: Issue #15 (long directory name) Shorten directory  
protoc\_gen\_prolog\_pb to gen\_pb for R build (R build outputs a warning  
if a the path is more than 100 bytes)

## Package redis

- TEST: Prevent occasional early termination in test(primes).

- TEST: Make sure the Redis test group consumers are properly discarded.

## Package semweb

- BUILD: Trick GCC-11 we are not really freeing a non-heap address.

## Package ssl

- BUILD: Silence (incorrect) GCC-11 uninitialized warning.

## Package xpce

- PORT: remove Cygwin from targets requiring dllexport Cygwin ld uses  
auto-export by default. Mixing that with dllexport in some cases  
leaves other symbols unexported.

- BUILD: Avoid GCC-11 warning.
