Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linking error after 1.40.0: undefined symbol: _tempFixedLengthArray (referenced by emscripten_glInvalidateFramebuffer__deps) #11771

Closed
akien-mga opened this issue Jul 31, 2020 · 9 comments · Fixed by #11780

Comments

@akien-mga
Copy link

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 (bcf65fe and 2f1d41f), though they're not referenced in the 1.40.0 release notes.

Steps to reproduce:

It should be a build from scratch, relinking a successful build from 1.39.20 with 1.40.0 does not trigger the issue.

@akien-mga
Copy link
Author

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)

akien-mga added a commit to akien-mga/godot that referenced this issue Jul 31, 2020
1.40.0 introduced a regression for us:
emscripten-core/emscripten#11771

This is not necessary in the master branch, presumably because
it doesn't build any WebGL code (yet).
@kripken
Copy link
Member

kripken commented Jul 31, 2020

Looks like a regression from #11738. cc @sbc100

@sbc100
Copy link
Collaborator

sbc100 commented Jul 31, 2020

Yup.. i wonder how we don't have tests that would catch this :(

@floooh
Copy link
Collaborator

floooh commented Jul 31, 2020

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).

@sbc100
Copy link
Collaborator

sbc100 commented Jul 31, 2020

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.

@floooh
Copy link
Collaborator

floooh commented Jul 31, 2020

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)

@floooh
Copy link
Collaborator

floooh commented Jul 31, 2020

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)

@kripken
Copy link
Member

kripken commented Jul 31, 2020

Thanks @floooh , I'll try to get some of those added!

@sbc100
Copy link
Collaborator

sbc100 commented Jul 31, 2020

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.

kripken added a commit that referenced this issue Aug 11, 2020
As suggested by floooh in

#11771 (comment)

This just adds the 3 WebGL2 ones, which seems like an area we have too
little coverage of.
huhund pushed a commit to huhund/godot that referenced this issue Nov 10, 2020
1.40.0 introduced a regression for us:
emscripten-core/emscripten#11771

This is not necessary in the master branch, presumably because
it doesn't build any WebGL code (yet).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants