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

Unable to update emscripten version from 3.1.56 to 3.1.57 #22646

Open
ravisumit33 opened this issue Sep 27, 2024 · 6 comments
Open

Unable to update emscripten version from 3.1.56 to 3.1.57 #22646

ravisumit33 opened this issue Sep 27, 2024 · 6 comments

Comments

@ravisumit33
Copy link
Contributor

ravisumit33 commented Sep 27, 2024

Please include the following in your bug report:

Version of emscripten/emsdk:

emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.57 (1df9c1977b49926c1efca672c31414da45c0c7bb)
clang version 19.0.0git (https:/github.com/llvm/llvm-project ccdebbae4d77d3efc236af92c22941de5d437e01)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /emsdk/upstream/bin

While updating emscripten version from 3.1.56 to 3.1.57, emscripten fails to compile one of the files with below logs:


FAILED: render/jpegImageStream.cpp.o
/emsdk/upstream/emscripten/em++ -DNDEBUG -std=gnu++17 -Wno-parentheses-equality -Wno-dangling-else -Wno-deprecated-declarations -fwasm-exceptions -sSUPPORT_LONGJMP=\"wasm\" -O3 -pthread -sMAIN_MODULE=2 -MD -MT render/jpegImageStream.cpp.o -MF render/jpegImageStream.cpp.o.d -o render/jpegImageStream.cpp.o -c render/jpegImageStream.cpp

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /emsdk/upstream/bin/clang++ -target wasm32-unknown-emscripten -fPIC -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -wasm-enable-sjlj -mllvm -disable-lsr --sysroot=/emsdk/upstream/emscripten/cache/sysroot -D__EMSCRIPTEN_SHARED_MEMORY__=1 -DEMSCRIPTEN -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -std=gnu++17 -Wno-parentheses-equality -Wno-dangling-else -Wno-deprecated-declarations -fwasm-exceptions -O3 -pthread -MD -MT render/jpegImageStream.cpp.o -MF render/jpegImageStream.cpp.o.d -c -matomics -mbulk-memory render/jpegImageStream.cpp -o render/jpegImageStream.cpp.o
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module 'render/jpegImageStream.cpp'.
4.	Running pass 'WebAssembly Instruction Selection' on function '@_ZN2t37data_io14IJGDecompStateC2Ev'
 #0 0x0000000105f4b490 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/emsdk/upstream/bin/clang-19+0x10112f490)
 #1 0x0000000105f492e8 llvm::sys::RunSignalHandlers() (/emsdk/upstream/bin/clang-19+0x10112d2e8)
 #2 0x0000000105f4a9ec llvm::sys::CleanupOnSignal(unsigned long) (/emsdk/upstream/bin/clang-19+0x10112e9ec)
 #3 0x0000000105eb2f74 CrashRecoverySignalHandler(int) (.llvm.2251919438987092993) (/emsdk/upstream/bin/clang-19+0x101096f74)
 #4 0x0000000198046584 (/usr/lib/system/libsystem_platform.dylib+0x18047a584)
 #5 0x0000000106e50c10 llvm::SelectionDAGBuilder::HandlePHINodesInSuccessorBlocks(llvm::BasicBlock const*) (/emsdk/upstream/bin/clang-19+0x102034c10)
 #6 0x0000000106e50418 llvm::SelectionDAGBuilder::visit(llvm::Instruction const&) (/emsdk/upstream/bin/clang-19+0x102034418)
 #7 0x0000000106f812f8 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, false, false, void, true>, false, true>, bool&) (/emsdk/upstream/bin/clang-19+0x1021652f8)
 #8 0x0000000106f80ac8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/emsdk/upstream/bin/clang-19+0x102164ac8)
 #9 0x0000000106f7e140 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/emsdk/upstream/bin/clang-19+0x102162140)
#10 0x00000001055d9e30 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/emsdk/upstream/bin/clang-19+0x1007bde30)
#11 0x0000000105aa4720 llvm::FPPassManager::runOnFunction(llvm::Function&) (/emsdk/upstream/bin/clang-19+0x100c88720)
#12 0x0000000105aad154 llvm::FPPassManager::runOnModule(llvm::Module&) (/emsdk/upstream/bin/clang-19+0x100c91154)
#13 0x0000000105aa514c llvm::legacy::PassManagerImpl::run(llvm::Module&) (/emsdk/upstream/bin/clang-19+0x100c8914c)
#14 0x00000001066ebe48 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__2::unique_ptr<llvm::raw_pwrite_stream, std::__2::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/emsdk/upstream/bin/clang-19+0x1018cfe48)
#15 0x00000001065974a0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/emsdk/upstream/bin/clang-19+0x10177b4a0)
#16 0x0000000107704334 clang::ParseAST(clang::Sema&, bool, bool) (/emsdk/upstream/bin/clang-19+0x1028e8334)
#17 0x00000001069ef4bc clang::FrontendAction::Execute() (/emsdk/upstream/bin/clang-19+0x101bd34bc)
#18 0x0000000106966918 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/emsdk/upstream/bin/clang-19+0x101b4a918)
#19 0x0000000106ad25c4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/emsdk/upstream/bin/clang-19+0x101cb65c4)
#20 0x0000000104ea5e54 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/emsdk/upstream/bin/clang-19+0x100089e54)
#21 0x0000000104ea3adc ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) (/emsdk/upstream/bin/clang-19+0x100087adc)
#22 0x000000010680bb40 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__2::optional<llvm::StringRef>>, std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>*, bool*) const::$_0>(long) (/emsdk/upstream/bin/clang-19+0x1019efb40)
#23 0x0000000105eb2c78 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/emsdk/upstream/bin/clang-19+0x101096c78)
#24 0x000000010680b56c clang::driver::CC1Command::Execute(llvm::ArrayRef<std::__2::optional<llvm::StringRef>>, std::__2::basic_string<char, std::__2::char_traits<char>, std::__2::allocator<char>>*, bool*) const (/emsdk/upstream/bin/clang-19+0x1019ef56c)
#25 0x00000001067d1820 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/emsdk/upstream/bin/clang-19+0x1019b5820)
#26 0x00000001067d1a88 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::__2::pair<int, clang::driver::Command const*>>&, bool) const (/emsdk/upstream/bin/clang-19+0x1019b5a88)
#27 0x00000001067ee190 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::__2::pair<int, clang::driver::Command const*>>&) (/emsdk/upstream/bin/clang-19+0x1019d2190)
#28 0x0000000104ea2b28 clang_main(int, char**, llvm::ToolContext const&) (/emsdk/upstream/bin/clang-19+0x100086b28)
#29 0x0000000104eb025c main (/emsdk/upstream/bin/clang-19+0x10009425c)
#30 0x0000000197c8b154
clang++: error: clang frontend command failed with exit code 139 (use -v to see invocation)
clang version 19.0.0git (https:/github.com/llvm/llvm-project ccdebbae4d77d3efc236af92c22941de5d437e01)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir:/emsdk/upstream/bin
clang++: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /var/folders/yk/kk2lnbw17jg1gdq22swwqs000000gn/T/jpegImageStream-a7a7ef.cpp
clang++: note: diagnostic msg: /var/folders/yk/kk2lnbw17jg1gdq22swwqs000000gn/T/jpegImageStream-a7a7ef.sh
clang++: note: diagnostic msg: Crash backtrace is located in
clang++: note: diagnostic msg: ~/Library/Logs/DiagnosticReports/clang-19_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang++: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang++: note: diagnostic msg:

********************

I am unable to attach the cpp file asked to attach as it contains sensitive business logic. With emscripten version 3.1.56 the same file is getting compiled fine.

@sbc100
Copy link
Collaborator

sbc100 commented Sep 27, 2024

@aheejin @dschuff does this look familiar to you?

@ravisumit33 it would be really useful if you could try to narrow down which emsdk version causes this failure. If you are able to run a bitsect that would be really useful: https://emscripten.org/docs/contributing/developers_guide.html#bisecting

@dschuff
Copy link
Member

dschuff commented Sep 27, 2024

Bisecting would be really helpful if you can do it. It will also mean that you'd be testing with LLVM builds that enable assertions, which might also help diagnose.
If you can't bisect, can you try with the tot EMSDK version? This will both check a newer version of LLVM (in case the regression has been fixed upstream) and also test an asserts build. (You can also try the 3.1.57-asserts version to get a build that's exactly the same as 3.1.57 except that assertions are enabled.

@aheejin
Copy link
Member

aheejin commented Sep 27, 2024

3.1.57 is rather old. Can you check if updating to the newest version fix the problem, in case the bug has been fixed in the meantime?

@aheejin
Copy link
Member

aheejin commented Sep 27, 2024

Looking the stack trace, it looks similar to the ones in llvm/llvm-project#97496 and #22170, both of which reported the same bug. That bug was fixed in llvm/llvm-project#99730. They said the bug started appearing in 3.1.54, but that bug was there for years at that point and I don't have a very good idea on why that bug started showing at that point.

llvm/llvm-project#99730 landed on Jul 23, So Emscripten release 3.1.65 and above contain it. Can you update Emscripten and see if it is fixed?

@ravisumit33
Copy link
Contributor Author

I am getting some errors in one of my dependent repos with newer clang. I will keep posting updates here once we are able to check the issue on 3.1.65 or later.

@aheejin
Copy link
Member

aheejin commented Sep 28, 2024

Not sure if your problem is this, but I remember this upstream Clang change (llvm/llvm-project#90152) in April caused compilation failures in application code that had compiled before. They had real bugs but that Clang change happened to reveal it.

Just in case your problem is also this, the ideal solution is to fix bugs in the application code, but some people reported -fdelayed-template-parsing in the compilation commands made them work around the issue.

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

No branches or pull requests

4 participants