# Ann: SWI-Prolog 8.5.17

**URL:** <https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781>\
**Category:** Releases\
**Created:** [September 19, 2022, 11:54am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781 "2022-09-19T11:54:09Z")\
**Posts on this page:** 11\
**Page:** 2

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [September 23, 2022, 9:35pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/21 "2022-09-23T21:35:43Z")

</div>

I admit that I don’t understand all the details, but I am happy with the first sentence.

Move on. Great work.

Edit: Tests are passing now (except for semweb:turtle and semweb:ntripes that fail because of the large Unicode codepoints IIRC).

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [September 24, 2022, 8:00am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/22 "2022-09-24T08:00:40Z")

</div>

One more little thing. IIUC, after having run cmake and ninja from swipl-devel/build, there’s a fully functioning system in build/src, so that I can run the following commands:

mkdir build  
cd build  
cmake -G Ninja ..  
ninja  
src/swipl  
?- check\_installation.  
?- pack\_install(environ).

The last command fails because c\_libdir is not set properly for the build environment.

```prolog
6 ?- pack_install(environ).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
Install environ@1.0 from http://www.swi-prolog.org/download/pack/environ-1.0.tgz Y/n?
make_directory: c:/users/matth/appdata/local/swi-prolog/pack/environ
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% "environ-1.0.tgz" was downloaded 106 times
Package: environ
Title: Demo package with C code, fetching the program environment
Installed version: 1.0
Author: Jan Wielemaker <jan@swi-prolog.org>
Home page: http://www.swi-prolog.org/howto/ForeignPack.html
Download URL: http://www.swi-prolog.org/download/pack/environ-*.tgz
Install "environ-1.0.tgz" (1,084 bytes) Y/n?
ERROR: C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lswipl: No such file or directory
ERROR: collect2.exe: error: ld returned 1 exit status
ERROR: make: *** [Makefile:9: lib/x64-win64/environ.dll] Error 1
% gcc -fPIC -pthread -I"c:/msys64/home/matthias/swipl-devel/build/home/include" -c -o c/environ.o c/environ.c
% mkdir -p lib/x64-win64
% C:/msys64/mingw64/bin/cc.exe -shared -L"c:/msys64/home/matthias/swipl-devel/build/home/bin" -o lib/x64-win64/environ.dll c/environ.o -lswipl
ERROR: Process "process(c:/msys64/usr/bin/make.exe,[])": exit status: 2

```

Note the -L"c:/msys64/home/matthias/swipl-devel/build/home/bin" that should read as -L"c:/msys64/home/matthias/swipl-devel/build/src".

This applies only for the build environment. Things work well after installation (i.e. ninja install and then invoking swipl.exe from the installation folder).

I guess c\_libdir needs to be tweaked from boot/build\_home.pl, doesn’t it?

The problem is not seen under Linux since there’s not need to link modules to libswipl.so under linux.

---

<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:** [September 24, 2022, 2:15pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/23 "2022-09-24T14:15:52Z")

</div>

I see. The flags are generated from library/prolog\_config.pl. This can be hooked using prolog:runtime\_config(Flag, Value). Probably the best option is to add this hook to the build-tree init file that is in boot/build\_home.pl. I think you can figure that out 🙂

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [September 24, 2022, 10:21pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/24 "2022-09-24T22:21:56Z")

</div>

The thing is that prolog:runtime\_config(Flag, Value) already returns the correct settings.

src/swipl  
? - prolog:runtime\_config(Flag, Value).  
Flag = c\_libdir,  
Value = ‘c:/msys64/home/matthias/swipl-devel/build/src’.

For some reason, the setting is not used in pack\_rebuild.

This is working:

```prolog
1 ?- assert(prolog:build_environment('CC', 'C:/msys64/mingw64/bin/gcc.exe')).
true.

2 ?- assert(prolog:build_environment('LDSOFLAGS', '-shared -L"C:\\msys64\\home\\Matthias\\swipl-devel\\build\\src"')).
true.

3 ?- pack_rebuild(environ).
% rm -f c/environ.o
% rm -f lib/x64-win64/environ.dll
% C:/msys64/mingw64/bin/gcc.exe -fPIC -pthread -I"c:/msys64/home/matthias/swipl-devel/build/home/include" -c -o c/environ.o c/environ.c
% mkdir -p lib/x64-win64
% C:/msys64/mingw64/bin/cc.exe -shared -L"C:\msys64\home\Matthias\swipl-devel\build\src" -o lib/x64-win64/environ.dll c/environ.o -lswipl
% make: Nothing to be done for 'check'.
% make: Nothing to be done for 'install'.

```

---

<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:** [September 25, 2022, 7:58am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/25 "2022-09-25T07:58:45Z")

</div>

Seems pack\_install/2 follows a different route. See `library/build/tools.pl`, def\_environment/3, clause at line 307. This code deals with setting up the build infrastructure for either make or cmake. Needs a little puzzle to deal with the many configurations ☹

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [September 25, 2022, 9:54am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/26 "2022-09-25T09:54:36Z")

</div>

A PR is on it’s way. I need to find a solution that does not break swipl at the installation folder.

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [September 26, 2022, 10:18am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/27 "2022-09-26T10:18:54Z")

</div>

Works! Thanks!

I have one more little “wish” (not strictly an error or missing feature). I think we had a conversation about this before. In Ports.cmake, SWIPL\_ARCH is set for the different architectures, and a default is based on CMAKE\_SYSTEM\_PROCESSOR and CMAKE\_SYSTEM\_NAME.

```prolog
if(APPLE)
  include(port/Darwin)
elseif(WIN32)
  include(port/Windows)
elseif(EMSCRIPTEN)
  include(port/Emscripten)
elseif(ANDROID)
  include(port/Android)
endif()

# Architecture id (Prolog flag `arch`, architecture subdirs)
if(NOT SWIPL_ARCH)
  string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}
         SWIPL_ARCH)
endif()

```

For Windows, SWIPL\_ARCH is hardcoded in ports/Windows.cmake:

```prolog
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
  add_compile_options(-DWIN64)
  set(WIN64 1)
  set(WIN_PROGRAM_FILES "Program Files")
  set(SWIPL_ARCH x64-win64)
else()
  set(WIN_PROGRAM_FILES "Program Files (x86)")
  set(SWIPL_ARCH i386-win32)
endif()

```

I wonder if the hard-coded names can be omitted, so that the default based on CMAKE\_SYSTEM\_PROCESSOR and CMAKE\_SYSTEM\_NAME is taken under Windows, like under Linux (on my system, this is amd64-windows). It might simplify finding e.g. libswipl.dll from external programs, because they can rely on the cmake settings and do not have to memorize the hard-coded names of the architecture.

I admit that it’s only a little thing, but maybe you could consider it.

---

<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:** [September 26, 2022, 11:15am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/28 "2022-09-26T11:15:01Z")

</div>

> [@mgondan1](#):
>
> I wonder if the hard-coded names can be omitted

I have my doubts. First of all, it will break existing binary packages. Second, I’m not sure how stable these results are. In my cross compiling environment `CMAKE_SYSTEM_PROCESSOR` is empty.

Ideally we provide a CMake include file that provides all you need at a well known place. This already happens for non-Windows systems (at `<prefix>/lib/cmake/swipl`)

I also have some CMake script laying around that calls swipl to setup the targets using `swipl --dump-runtime-variables`. If you just want the architecture, use `swipl --arch`.

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [September 26, 2022, 1:42pm UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/29 "2022-09-26T13:42:30Z")

</div>

I see your points.

---

<div class="post-metadata">

**Author:** ![mike.elston](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mike.elston/32/3691_2.png) [@mike.elston](https://swi-prolog.discourse.group/u/mike.elston)\
**Post date:** [September 30, 2022, 3:21am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/30 "2022-09-30T03:21:48Z")

</div>

Hi. Is this release supposed to have the WASM support? I can see the WASM documentation but no WASM Javascript.

-Thanks

---

<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:** [September 30, 2022, 7:19am UTC](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781/31 "2022-09-30T07:19:46Z")

</div>

> [@mike.elston](#):
>
> Hi. Is this release supposed to have the WASM support?

Depends what you consider “support”. Yes, the WASM build process is integrated and documented and yes, the high level wrapper that makes Prolog easily accessible from JavaScript and allows Prolog to call JavaScript and interact with the browser is all there. I think these interfaces are stable enough to start using them. There is a node package `swipl-wasm` by @rla.

As noted in the WASM wiki and discussion, there is still a lot to wish for. For now I need to do a work that pays the bills, so the WASM version stalls around here unless people contribute code, examples, documentation, etc., or find some way to make its development pay the bills 🙂

[Previous page](https://swi-prolog.discourse.group/t/ann-swi-prolog-8-5-17/5781.md?page=1)
