add trap sequences for emscripten

31 views
Skip to first unread message

Milan Hauth

unread,
Apr 21, 2026, 4:43:53 PMApr 21
to pdfium
i need this for the WASM module of my ccitt_g4_tiff
https://github.com/milahu/ccitt_g4_tiff

fix:
pdfium/core/fxcrt/immediate_crash.h:107:2: error: No supported trap sequence!

possible solution:

also use abort as the default trap sequence

Lei Zhang

unread,
Apr 21, 2026, 9:50:14 PMApr 21
to Milan Hauth, pdfium
Hi,

You are welcome to modify your PDFium fork however you like. If you
want it in upstream PDFium. then you will need to follow the
instructions in CONTRIBUTING.md.

Is anyone else building PDFium with Emscripten and running into this issue?
> --
> You received this message because you are subscribed to the Google Groups "pdfium" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pdfium+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/pdfium/56c70023-8926-4377-8873-9dd5251fac09n%40googlegroups.com.

Milan Hauth

unread,
Apr 22, 2026, 2:10:41 AMApr 22
to Lei Zhang, pdfium
Is anyone else building PDFium with Emscripten and running into this issue?

there is

they compile pdfium for WASM
without patching the trap sequences
but they use the GN build system

maybe i see this issue
because i dont use the GN build system
i use cmake to build only core/fxcodec/fax/faxmodule.cpp

what i find surprising is that
core/fxcrt/immediate_crash.h
requires a GCC or MSVC compiler in
#if defined(COMPILER_GCC)
// ...
#elif defined(COMPILER_MSVC)
// ...
#else
#error No supported trap sequence!
#endif  // COMPILER_GCC

core/fxcrt/immediate_crash.h
is included into all cpp files via core/fxcrt/check.h

If you want it in upstream PDFium

yes
defining trap sequences for all compilers
seems to be an easy fix

the fallback to abort()
could be guarded with a
#pragma message "falling back to abort as trap sequence. you may want to change this for your compiler"

... better than refusing compilation with
#error No supported trap sequence!

Reply all
Reply to author
Forward
0 new messages