Zig-cc, wasi and setjmp

,

Hello.

I am trying to compile an existing project with wasi-cc. (It’s ghostscript, but it includes freetype as a dependency, and freetype is now the problem.)

It is using setjmp/longjmp.

I am looking at this

To quote:

Build an application

To build an application using setjmp/longjmp, you need two things:

  • Enable the necessary LLVM translation (-mllvm -wasm-enable-sjlj)
  • Link the setjmp library (-lsetjmp)

Example without LTO

clang -Os -mllvm -wasm-enable-sjlj -o your_app.wasm your_app.c -lsetjmp

Example with LTO

clang -Os -flto=full -mllvm -wasm-enable-sjlj -Wl,-mllvm,-wasm-enable-sjlj -o your_app.wasm your_app.c -lsetjmp

I am not clear if zig cc with --target=wasm32-wasi can do this and what to put where? :smiley:

I don’t think this is something we support right now.

If you file an issue on ziglang/zig, I can take a look at how hard it would be to add this.