Closed JakeChampion closed 1 month ago
@llvm/issue-subscribers-backend-webassembly
Author: Jake Champion (JakeChampion)
Even if it does not always fail, we'd appreciate a reproducer. Can you provide one?
I've now landed enough of the patches to make the reproduction hopefully simpler to do.
This happens when compiling Mozilla's SpiderMonkey to WASI in debug mode and with Intl included
A full log output can be found at https://treeherder.mozilla.org/logviewer?job_id=468809046&repo=try&lineNumber=5901
Gecko-Dev, which contains SpiderMonkey is a rather large codebase though, the steps to get it building are quite a bit -- https://firefox-source-docs.mozilla.org/setup/macos_build.html
Once that is done you can create a mozconfig file named 'mozconfig-intl-debug' containing:
ac_add_options --enable-project=js
ac_add_options --enable-application=js
ac_add_options --target=wasm32-unknown-wasi
ac_add_options --without-system-zlib
ac_add_options --disable-jit
ac_add_options --disable-shared-js
ac_add_options --disable-shared-memory
ac_add_options --disable-tests
ac_add_options --disable-clang-plugin
ac_add_options --enable-jitspew
ac_add_options --enable-optimize=-O3
ac_add_options --enable-portable-baseline-interp
mk_add_options AUTOCLOBBER=1
ac_add_options --host=aarch64-apple-darwin
ac_add_options --enable-debug
And building the project with MOZCONFIG=./mozconfig-intl-debug ./mach build
Can you possibly generate a reproducer using wasm-ld --reproduce
?
Thanks, I've generated that file, it's 574M in size, not too sure where I could upload that
You can upload it to a Google drive or Dropbox or something and paste the link here.
@aheejin here it is https://mega.nz/file/VlNnRTSK#2kj3qBJFjlgQjl_vOT2MRfZQAG849r1sC9iXvF4qkRs
I'll be picking up from @JakeChampion on this Fastly / BytecodeAlliance error report. If there is any more info that can be provided please just let me know.
Sorry for the long delay. I tried to build the reproducer but I don't seem to have the right WASI environment set..?
$ wasm-ld @response.txt
wasm-ld: warning: unknown -z value: noexecstack
wasm-ld: warning: unknown -z value: text
wasm-ld: warning: unknown -z value: relro
wasm-ld: warning: unknown -z value: now
wasm-ld: warning: unknown -z value: nocopyreloc
wasm-ld: error: unable to find library -lm
wasm-ld: error: unable to find library -lwasi-emulated-process-clocks
wasm-ld: error: unable to find library -lwasi-emulated-getpid
wasm-ld: error: unable to find library -lc++
wasm-ld: error: unable to find library -lc++abi
wasm-ld: error: unable to find library -lc
How am I supposed to set up the libraries?
Do you have WASI SDK installed? https://github.com/WebAssembly/wasi-sdk
Thanks I installed WASI SDK using the prebuilt binarires.
By the way, what's your LLVM version (release version or git commit)?
Sorry for the long delay. I tried to build the reproducer but I don't seem to have the right WASI environment set..?
$ wasm-ld @response.txt wasm-ld: warning: unknown -z value: noexecstack wasm-ld: warning: unknown -z value: text wasm-ld: warning: unknown -z value: relro wasm-ld: warning: unknown -z value: now wasm-ld: warning: unknown -z value: nocopyreloc wasm-ld: error: unable to find library -lm wasm-ld: error: unable to find library -lwasi-emulated-process-clocks wasm-ld: error: unable to find library -lwasi-emulated-getpid wasm-ld: error: unable to find library -lc++ wasm-ld: error: unable to find library -lc++abi wasm-ld: error: unable to find library -lc
How am I supposed to set up the libraries?
Looks like there could be an absolute path in the response file that you would need to update?
@sbc100 Yeah I installed WASI SDK and updated the -L
path in response.txt
.
@sbc100 While you're here, do you have any idea what the problem could be?
@llvm/issue-subscribers-lld-wasm
Author: Jake Champion (JakeChampion)
Looks like a crash in wasm-ld but I can't see much more from the backtrace. Do you have a backtrace from a LLVM build that includes asserts?
Feel free to assign to me, although I'm not sure when I'll be able to get to it.
What's your LLVM version? Actually I think this bug might have been already fixed in #96134.
When I tried to reproduce the bug, the tip-of-tree LLVM didn't error out but the last release (LLVM 18) errored out for me. So I bisected this on the LLVM repo and #96134 was the first ~bad~good commit.
If you use LLVM from the source repo, I guess you can simply update the LLVM to the tip of the tree (or any revision equal to or later than #96134). If you use an official LLVM release, LLVM 19 should contain this.
Will close this issue as completed. Feel free to reopen the issue if #96134 does not fix your problem.
The project sometimes builds and sometimes fails to build with the below backtrace
I'm not sure what other information to give here, other than the backtrace - please let me know what (if any) other information would be useful to include and I will try my best to return with that information 🙇