Godot builds have started failing with Emscripten 1.40.0 with the following linking error:
error: undefined symbol: _tempFixedLengthArray (referenced by emscripten_glInvalidateFramebuffer__deps: ['_tempFixedLengthArray'], referenced by top-level compiled C/C++ code)
warning: Link with `-s LLD_REPORT_UNDEFINED` to get more information on undefined symbols
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
warning: __tempFixedLengthArray may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _heapObjectForWebGLType (referenced by emscripten_glTexImage3D__deps: ['_heapObjectForWebGLType','_heapAccessShiftForWebGLHeap'], referenced by top-level compiled C/C++ code)
warning: __heapObjectForWebGLType may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
error: undefined symbol: _heapAccessShiftForWebGLHeap (referenced by emscripten_glTexImage3D__deps: ['_heapObjectForWebGLType','_heapAccessShiftForWebGLHeap'], referenced by top-level compiled C/C++ code)
warning: __heapAccessShiftForWebGLHeap may need to be added to EXPORTED_FUNCTIONS if it arrives from a system library
Error: Aborting compilation due to previous errors
emcc: error: '/home/runner/work/godot/godot/emsdk-cache/emsdk-master/node/12.18.1_64bit/bin/node /home/runner/work/godot/godot/emsdk-cache/emsdk-master/upstream/emscripten/src/compiler.js /tmp/tmp6oe11o6w.txt' failed (1)
It built fine a few hours before with 1.39.20.
Last successful build logs: https://github.com/godotengine/godot/runs/929922260
First failing build log: https://github.com/godotengine/godot/runs/931617809 (same code, it's a merge of the PR tested in the last successful CI build, which was up to date with its base branch)
This is only reproducible with the 3.2 branch of Godot, as the master branch is migrating to Vulkan and does not have a GL backend yet.
I see a few WebGL related changes in 1.40.0 (https://github.com/emscripten-core/emscripten/commit/bcf65fe129a4a621cd4c34fbabbc1178f69ed199 and https://github.com/emscripten-core/emscripten/commit/2f1d41f22948c42b4a62745772717ff8a9bc554e), though they're not referenced in the 1.40.0 release notes.
Steps to reproduce:
3.2 branchscons p=javascript -j8It should be a build from scratch, relinking a successful build from 1.39.20 with 1.40.0 does not trigger the issue.
First failing build log: https://github.com/godotengine/godot/runs/931617809 (same code, it's a merge of the PR tested in the last successful CI build, which was up to date with its base branch)
As this PR is also rendering-related in Godot I first thought it was the culprit, but to be sure I tried building an antecedent commit which built fine with 1.39.20, and it does fail similarly with 1.40.0. (CC @Faless)
Looks like a regression from #11738. cc @sbc100
Yup.. i wonder how we don't have tests that would catch this :(
Same problem here.
I get linker errors because of a missing __heapAccessShiftForWebGLHeap function (and a handful others) when linking WebGL2 apps (linking WebGL1 applications appears to work).
Yeah... I just can't understand how we don't have tests that use webgl2 (or at least those symbols from webgl2). I've got a simple fix, but I'd like to add test coverage when I land it too.
how we don't have tests that use webgl2
Both in Godot's and in my case it seems to be related to creating 3D textures, so maybe it doesn't generally happen when linking WebGL2 apps, but only when calling specific WebGL2 functions (which might explain why it isn't currently covered by tests)
Btw, maybe I can contribute some tests with nearly zero effort: the samples in this directory are all self-contained and easy to compile with just emcc (no build system needed):
https://github.com/floooh/sokol-samples/tree/master/html5
The CMakeLists.txt file can be ignored, and instead the sokol_gfx.h file from here copied into the same directory as the source files:
https://github.com/floooh/sokol
Then the samples can be compiled with (for instance):
> emcc triangle-emsc.c -o triangle-emsc.html -s MAX_WEBGL_VERSION=2
Most of the samples actually don't require WebGL2 though (only mipmap-emsc.c, arraytex-emsc.c and mrt-emsc.c), and sokol_gfx.h doesn't call all WebGL2 functions, but still has pretty good coverage.
(PS: maybe ignore the imgui-emsc.c sample, since this depends on Dear ImGui)
Thanks @floooh , I'll try to get some of those added!
Perhaps we should also have a super simple webgl2 test that references all the symbols.. I think that can be done by simply calling the getProcAddress function which pulls in the while API.