bramvdbogaerde / z3-wasm

Scripts and Javascript Glue code to use Z3 in the browser using WASM
13 stars 7 forks source link

Avoid using -pthread #2

Open bramvdbogaerde opened 3 years ago

bramvdbogaerde commented 3 years ago

We are currently compiling Z3 to WebAssembly using the -pthread option, the reason for this is because Z3 seems to be using some Z3 functionality.

Emscripten supports pthreads, but needs a SharedArrayBuffer which is only available on pages that have specific COP headers set [1].

This somewhat limits the hosting possibilities (although they can be mitigated using service workers [2]).

Using the Z3 supported --single-threaded option does not seem to resolve the issue.

The proposal of this issue is to investigate the origins of the pthread dependency, and remove it from Z3 (either by doing some automated patch work, or by contributing a fix to the official Z3 repository).

[1] https://emscripten.org/docs/porting/pthreads.html [2] https://github.com/gzuidhof/coi-serviceworker