Closed kleisauke closed 3 months ago
On a somewhat tangent, LTO also causes some other test failures within wasm-vips' test suite.
Disabling the support for dynamic modules at runtime or via the --disable-modules
build option seems to fix that.
https://github.com/kleisauke/wasm-vips/blob/1a0160a367afb1f5137b27cb745dae2d01781e60/test/unit/node-helper.js#L12-L13
https://github.com/kleisauke/wasm-vips/blob/1a0160a367afb1f5137b27cb745dae2d01781e60/build.sh#L79-L82
LTO also causes some other test failures within wasm-vips' test suite.
These test failures are no longer reproducible, first good commit is e1cc2ddaecff889d1d9f2b8fb12e53fab51ccfad according to git bisect. Unfortunately, the main issue still persists on git master (tested with commit b5764895a98ea29e44f30c79b0f8e35603459b4b).
Upstream issue: https://github.com/emscripten-core/emscripten/issues/20414.
Closing this issue as "won't fix" for now, see: https://github.com/emscripten-core/emscripten/issues/20414#issuecomment-2273394239.
This test program:
Fails with:
Readable stack trace
``` 1) SVG input Convert SVG with embedded images to PNG, respecting dimensions, autoconvert to PNG: Uncaught TypeError: type incompatibility when transforming from/to JS at rosvgtree::parse::parse::h46e668755e5e4dd7 (wasm://wasm/030b2c16:wasm-function[1098]:0xe5bf3) at invoke_vii (build/Release/sharp-emscripten-wasm32.node.js:7803:27) at _$LT$usvg_tree..Tree$u20$as$u20$usvg_parser..TreeParsing$GT$::from_str::h2ad984f34c8b8916 (wasm://wasm/030b2c16:wasm-function[1699]:0x161843) at _$LT$usvg_tree..Tree$u20$as$u20$usvg_parser..TreeParsing$GT$::from_data::hb74bbe40b8ecb9f0 (wasm://wasm/030b2c16:wasm-function[596]:0x60ca1) at invoke_viiii (build/Release/sharp-emscripten-wasm32.node.js:7936:27) at resvg_parse_tree_from_file (wasm://wasm/030b2c16:wasm-function[594]:0x60283) at vips_foreign_load_svg_file_header (wasm://wasm/030b2c16:wasm-function[5339]:0x2b4596) at vips_foreign_load_build (wasm://wasm/030b2c16:wasm-function[4480]:0x21e4af) at vips_object_build (wasm://wasm/030b2c16:wasm-function[4667]:0x2313ac) at vips_cache_operation_buildp (wasm://wasm/030b2c16:wasm-function[4227]:0x1ea98a) ```When wasm-vips was build with LTO enabled, i.e:
It looks like this error orginates from V8: https://github.com/nodejs/node/blob/v18.16.0/deps/v8/src/common/message-template.h#L600
Building without LTO or removing
id="svg-root"
from this particular SVG seems to fix this.This was found while trying to update wasm-vips in https://github.com/lovell/sharp/pull/3522.