mosra/magnum

Linking in Emscripten >= 3.1.52 doesn't work

bz-next opened this issue · 4 comments

I think the issue is analogous to emscripten-core/emscripten#21128

The cube example builds with emscripten 3.1.51, but on 3.1.52 and above, I get the following error during linking of Release/bin/magnum-primitives.js

[100%] Linking CXX executable Release/bin/magnum-primitives.js
Release/lib/MagnumSdl2Application.bc:1:2: error: expected integer
    1 | !<arch>
      |  ^
1 error generated.
em++: error: '/home/user/emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fignore-exceptions -fvisibility=default --sysroot=/home/user/emsdk/upstream/emscripten/cache/sysroot -DEMSCRIPTEN -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -DNDEBUG -O3 -flto -O3 -DNDEBUG -O3 -flto Release/lib/MagnumSdl2Application.bc -c -o /tmp/emscripten_temp_zy0k2l8p/MagnumSdl2Application_0.o' failed (returned 1)
make[2]: *** [CMakeFiles/magnum-primitives.dir/build.make:112: Release/bin/magnum-primitives.js] Error 1
make[1]: *** [CMakeFiles/Makefile2:762: CMakeFiles/magnum-primitives.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Ugh, this one is annoying. I don't see why would they want to change a behavior that worked well for a decade...

But what can I do 😅 I'll have to update all my Emscripten toolchains and builds to not use *.bc but *.a instead and ensure everything reflects that. It'll take a while for this to propagate to all repos, and I don't really have time to do such a sweeping change at the moment. Is it fine if this waits a bit, can you stay on 3.1.51 for now? (It'll bite me as soon as I have 3.1.52 in Arch repos, so it will get fixed eventually, just not now.)

Of course, no worries. It seems like anything tangentially related to web or js is doomed to break randomly anyway :) Just thought you should know!

Oh yeah, thanks for that!

Emscripten breaks a lot and very often, so this is something to be aware of. Basically every other upgrade breaks something, last time it was with 3.1.49 in 8048b65. So ideally on your side if possible you pin to some particular Emscripten version and upgrade only when you feel like you need to, or when you have a lot of extra time on your hands :D

This is fixed with mosra/toolchains@7c5e504, update of the submodule in Magnum repos will follow soon as well.