Ann: SWI-Prolog 10.1.1 (devel)

Hi Jan, feel free to copy my message and your helpful reply :

It seems to me that there is really a bug that prevents my compilation of WASM . All the library are installed, ninja compiles, and near at the end, I always meet this error message. Sorry, but I hope that it will help.


root@mx:/usr/local/wasm/swipl-devel/build.wasm# ninja

[587/592] QLF compile library

FAILED: src/__library_QLF_files__ /usr/local/wasm/swipl-devel/build.wasm/src/__library_QLF_files__

cd /usr/local/wasm/swipl-devel/build.wasm && /usr/bin/cmake -E env --unset=DISPLAY SDL_VIDEODRIVER=dummy -- /usr/bin/nodejs /usr/local/wasm/swipl-devel/build.wasm/src/swipl.js --no-packs --home=/usr/local/wasm/swipl-devel/build.wasm/home -DSDL_VIDEODRIVER=dummy -q -f none -t halt -l /usr/local/wasm/swipl-devel/build.wasm/home/library/prolog_qlfmake.pl -g qlf_make --

/usr/local/wasm/swipl-devel/build.wasm/src/swipl.js:1

var Module=typeof Module!="undefined"?Module:{};var ENVIRONMENT_IS_WEB=!!globalThis.window;var ENVIRONMENT_IS_WORKER=!!globalThis.WorkerGlobalScope;var ENVIRONMENT_IS_NODE=globalThis.process?.versions?.node&&globalThis.process?.type!="renderer";var arguments_=[];var thisProgram="./this.program";var quit_=(status,toThrow)=>{throw toThrow};var _scriptName=globalThis.document?.currentScript?.src;if(typeof __filename!="undefined"){_scriptName=__filename}else if(ENVIRONMENT_IS_WORKER){_scriptName=self.location.href}var scriptDirectory="";function locateFile(path){if(Module["locateFile"]){return Module["locateFile"](path,scriptDirectory)}return scriptDirectory+path}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs");scriptDirectory=__dirname+"/";readBinary=filename=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename);return ret};readAsync=async(filename,binary=true)=>{filename=isFileURI(filename)?new URL(filename):filename;var ret=fs.readFileSync(filename,binary?undefined:"utf8");return ret};if(process.argv.length>1){thisProgram=process.argv[1].replace(/\\/g,"/")}arguments_=process.argv.slice(2);if(typeof module!="undefined"){module["exports"]=Module}quit_=(status,toThrow)=>{process.exitCode=status;throw toThrow}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){try{scriptDirectory=new URL(".",_scriptName).href}catch{}{if(ENVIRONMENT_IS_WORKER){readBinary=url=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.responseType="arraybuffer";xhr.send(null);return new Uint8Array(xhr.response)}}readAsync=async url=>{if(isFileURI(url)){return new Promise((resolve,reject)=>{var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=()=>{if(xhr.status==200||xhr.status==0&&xhr.response){resolve(xhr.response);return}reject(xhr.status)};xhr.onerror=reject;xhr.send(null)})}var response=await fetch(url,{credentials:"same-origin"});if(response.ok){return response.arrayBuffer()}throw new Error(response.status+" : "+response.url)}}}else{}var`

Hi Joseph,
Seems this is an issue with the latest Emscripten. After switching back to my previous version (4.0.15), all works fine again. There is no context with the crash, so it is hard to say anything sensible. Ideally we find the breaking version and figure out whether it is our bug, Emscripten’s bug or some combination … Not now … And, this should be on Discourse. No need to copy/paste the entire minimized swipl.js JavaScript. Cheers — Jan

Many thanks. The version of Emscripten was indeed the problem. Compilation succeeded with version 4.015. Tonight , the last version of WASM SWI-Prolog runs on my laptop and the Tinker also runs smoothly. As soon as possible, I will write a more complete report on my blog, hoping that it will be helpful.

All the best,

Jo.

1 Like

Hi,

This is online now:

Notes on building SWI-Prolog for WebAssembly (WASM)

I am going to announce it in Announce section.

All the best, and again, many thanks to you, Jan.

1 Like

Thanks for the complete story. Most is fine, except for the dependencies for building the native Prolog. See Prerequisites for Debian based systems (Ubuntu, Mint, ...) for these. You have some old dependencies and miss some new ones. Notably the X11 dependencies are replaced by SDL3, Pango and Cairo.

1 Like

Hello Jan, I have asked to claude.ai to update this part of the text, in agreement of your suggestion. The updated text in online now.
All the best,
Jo.