-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
pthread + simd + fexceptions generates SIMD opcodes incompatible with Node.js in emsdk #18084
Comments
-fexceptions causes some issues: emscripten-core/emscripten#18084 After trial and error it seems that moving them to apply only to C++ (via CXXFLAGS) works best.
The Wasm SIMD opcodes were finalized in V8 9.1.54, which corresponds to Node.js 16.4.0. So, indeed, emsdk needs to update its Node version (emscripten-core/emsdk#1064). After PR #18070, Emscripten's test suite only adds those FWIW, I noticed the commit linked above, another workaround would be to do something similar to this in the emscripten/.circleci/config.yml Lines 488 to 492 in 00daf40
|
Might as well install Node from NodeSources apt :) Either way, it's only used for CMake checks so which workaround to use doesn't matter too much, but the issues above still need to be fixed on Emscripten side for other users. |
-fexceptions causes some issues: emscripten-core/emscripten#18084 After trial and error it seems that moving them to apply only to C++ (via CXXFLAGS) works best.
It would be nice to update node in emsdk. See emscripten-core/emsdk#877 and emscripten-core/emsdk#947 for some context on why we haven't recently. I wonder if those reasons still apply now. |
Looking at the first link, @juj said:
Sounds like it should be safe to upgrade by now? I still wonder why pthread and exception flags matter for even this simple C program that uses neither of those features, but that's just curiosity and doesn't matter much since the Node.js fixes it anyway. What about part (3) of my issue, about not using exit code for Cmake check, should I extract that into a separate issue? Having sizeof SIZE_T detected as 7 was preeetty weird to debug 😅 |
Yes I think the exit code issue might be worth digger deeper into. I think the separate issue would make sense. I imagine that what we want to do is make this kind of failure look like a crash to the host OS, rather than an |
-fexceptions causes some issues: emscripten-core/emscripten#18084 After trial and error it seems that moving them to apply only to C++ (via CXXFLAGS) works best.
+1 to this. I've run into this issue twice recently and it was painful (see #17811). I don't see an issue for this yet, are you still planning to file one @RReverser? |
Update the CheckTypeSize files to v3.20.0 (mostly arbitrary version). Local patch to CheckTypeSize is not much smaller. Instead of executing the program and using the return value (doesn't work for return values greater than 255), we simply inject `-oformat=wasm` onto the link command, and then we can use `strings` on the binary just like the upstream check. This is basically a single line patch against upstream now. Fixes: #18278 #18238 #17268 #18084 #17811
Update the CheckTypeSize files to v3.10.2 (mostly arbitrary version, but this is what we use in CI). Local patch to CheckTypeSize is not much smaller. Instead of executing the program and using the return value (doesn't work for return values greater than 255), we simply inject `-oformat=wasm` onto the link command, and then we can use `strings` on the binary just like the upstream check. This is basically a single line patch against upstream now. Fixes: #18278 #18238 #17268 #18084 #17811
Update the CheckTypeSize files to v3.10.2 (mostly arbitrary version, but this is what we use in CI). Local patch to CheckTypeSize is not much smaller. Instead of executing the program and using the return value (doesn't work for return values greater than 255), we simply inject `-oformat=wasm` onto the link command, and then we can use `strings` on the binary just like the upstream check. This is basically a single line patch against upstream now. Fixes: #18278 #18238 #17268 #18084 #17811
Update the CheckTypeSize files to v3.10.2 (mostly arbitrary version, but this is what we use in CI). Local patch to CheckTypeSize is not much smaller. Instead of executing the program and using the return value (doesn't work for return values greater than 255), we simply inject `-oformat=wasm` onto the link command, and then we can use `strings` on the binary just like the upstream check. This is basically a single line patch against upstream now. This change also avoids a second issue which is that node failures (non-zero return codes) are indistinguishable from non-zero return codes from user code. Fixes: #18278 #18238 #17268 #18084 #17811
Please include the following in your bug report:
Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.24 (68a9f99)
clang version 16.0.0 (https://github.com/llvm/llvm-project 277c382760bf9575cfa2eac73d5ad1db91466d3f)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/rreverser/emsdk/upstream/bin
Failing command line in full:
I've noticed this due to CMake detecting size of
size_t
as... 7:Input
check_type_size("size_t" SIZE_T)
Output
That, in turn, caused all sorts of weird problems.
This is the C file CMake generated for the check:
When building it with the following reduced set of flags, and then running with the Node.js v14.18.2 included in
latest
emsdk, this is what I'm getting:There are couple of interesting things going on:
emcc
flags fixes the issue, so there's some weird combo issue going on. (replacing-fexceptions
with-fwasm-exceptions
works too, but not something I can do here)4
as expected, so this might be due to old Node.js having old SIMD opcodes. In that case, I'd argue it's time to upgrade Node.js on the emsdk side.The text was updated successfully, but these errors were encountered: