My sokol-zig CI has started failing for the Emscripten builds (where the Zig code is compiled with wasm32-emscripten because the pthread_kill() symbol is missing in the link step.
Does that ring a bell? Did the Zig stdlib accidentially get a general pthread dependency on wasm32-emscripten targets very recently? (which would suck because shared-memory multithreading in browsers is better to be avoided because SharedArrayBuffer is behind a COOP/COEP gate).
…I’ll also investigate on my side, more details to follow
PS: my CI is a few days behind because of the broken package download on Windows - and now I removed Windows from the build matrix and I’m running into the wasm32-emscripten problem.
A quick search for pthread_kill in the repo suggests that these are the culprits:
I think the use_pthreads definition is too broad, but have you tried building with -fsingle_threaded (module.single_threaded = true in the build system)?
Hmm, slapping a .single_threaded = true on all my createModule() calls didn’t fix the issue, I’ll also need to investigate why that call even makes it into the build because most of the sokol-zig examples don’t even use the Zig stdlib.
PS: FWIW it works in release-fast and release-safe mode, only debug mode seems to include the pthread_kill() call.
I think it’s getting pulled in via std.debug.writeStackTrace():
Which is called by the std.start startup code that calls your main function, if your main function returns an error union:
You might be able to work around in a few different ways, for example by declaring a non-error void/u8 main function, building with error return traces disabled, building with debug info stripped, or declaring pub const std_options: std.Options = .{ .allow_stack_tracing = false };. (But clearly it would be even better if you open an issue explaining that std.Io has regressed Emscripten.)