FS#71531 - Emscripten crashes when compiling C++ code
Attached to Project:
Community Packages
Opened by Al Gebra (cpuheater) - Saturday, 17 July 2021, 12:35 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Wednesday, 09 February 2022, 19:00 GMT
Opened by Al Gebra (cpuheater) - Saturday, 17 July 2021, 12:35 GMT
Last edited by Sven-Hendrik Haase (Svenstaro) - Wednesday, 09 February 2022, 19:00 GMT
|
Details
Description:
Emscripten crashes when compiling any C++ code while trying to precompile the system library `~/.emscripten_cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a`. It seems that this was already reported upstream: https://bugs.llvm.org/show_bug.cgi?id=50611 And actually it's not a clang bug but a bug in GCC that was used to compile clang. The suggested solution is to recompile clang/emscripten with a newer GCC. Additional info: emscripten package version: 2.0.24-1 Emscripten's internal clang version: ``` $ /opt/emscripten-llvm/bin/clang++ --version clang version 13.0.0 (/startdir/llvm-project 91f147792e815d401ae408989992f3c1530cc18a) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/emscripten-llvm/bin ``` Crash output: ``` cache:INFO: generating system library: sysroot/lib/wasm32-emscripten/libc++-noexcept.a... (this will be cached in "/home/username/.emscripten_cache/sysroot/lib/wasm32-emscripten/libc++-noexcept.a" for subsequent builds) PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script. Stack dump: 0. Program arguments: /opt/emscripten-llvm/bin/clang++ -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -fno-inline-functions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=24 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/home/username/.emscripten_cache/sysroot -Xclang -iwithsysroot/include/compat -Werror -fno-unroll-loops -DLIBCXX_BUILDING_LIBCXXABI=1 -D_LIBCPP_BUILDING_LIBRARY -Oz -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -g -fno-exceptions -c /usr/lib/emscripten/system/lib/libcxx/src/locale.cpp -o /home/username/.emscripten_cache/build/libc++-noexcept/locale.o 1. <eof> parser at end of file 2. Code generation #0 0x00005587d3509361 (/opt/emscripten-llvm/bin/clang+++0x1f77361) #1 0x00005587d3506f34 llvm::sys::CleanupOnSignal(unsigned long) (/opt/emscripten-llvm/bin/clang+++0x1f74f34) #2 0x00005587d3461008 (/opt/emscripten-llvm/bin/clang+++0x1ecf008) #3 0x00007fa675be0870 __restore_rt sigaction.c:0:0 #4 0x00005587d413a5b0 llvm::DIE::getUnitDie() const (/opt/emscripten-llvm/bin/clang+++0x2ba85b0) #5 0x00005587d414839c llvm::DwarfDebug::finishEntityDefinitions() (/opt/emscripten-llvm/bin/clang+++0x2bb639c) #6 0x00005587d415adc5 llvm::DwarfDebug::finalizeModuleInfo() (/opt/emscripten-llvm/bin/clang+++0x2bc8dc5) #7 0x00005587d4161240 llvm::DwarfDebug::endModule() (/opt/emscripten-llvm/bin/clang+++0x2bcf240) #8 0x00005587d4131d2b llvm::AsmPrinter::doFinalization(llvm::Module&) (/opt/emscripten-llvm/bin/clang+++0x2b9fd2b) #9 0x00005587d2e045dd llvm::FPPassManager::doFinalization(llvm::Module&) (/opt/emscripten-llvm/bin/clang+++0x18725dd) #10 0x00005587d2e11140 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/emscripten-llvm/bin/clang+++0x187f140) #11 0x00005587d37e0e31 (/opt/emscripten-llvm/bin/clang+++0x224ee31) #12 0x00005587d37e5179 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream> >) (/opt/emscripten-llvm/bin/clang+++0x2253179) #13 0x00005587d44f83f2 (/opt/emscripten-llvm/bin/clang+++0x2f663f2) #14 0x00005587d5081ad9 clang::ParseAST(clang::Sema&, bool, bool) (/opt/emscripten-llvm/bin/clang+++0x3aefad9) #15 0x00005587d3e7ebb9 clang::FrontendAction::Execute() (/opt/emscripten-llvm/bin/clang+++0x28ecbb9) #16 0x00005587d3e13aa9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/emscripten-llvm/bin/clang+++0x2881aa9) #17 0x00005587d3f37458 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/emscripten-llvm/bin/clang+++0x29a5458) #18 0x00005587d2217440 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/emscripten-llvm/bin/clang+++0xc85440) #19 0x00005587d2214bc5 (/opt/emscripten-llvm/bin/clang+++0xc82bc5) #20 0x00005587d3ca7555 (/opt/emscripten-llvm/bin/clang+++0x2715555) #21 0x00005587d3461113 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/emscripten-llvm/bin/clang+++0x1ecf113) #22 0x00005587d3ca78ec (/opt/emscripten-llvm/bin/clang+++0x27158ec) #23 0x00005587d3c7c828 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&) const (/opt/emscripten-llvm/bin/clang+++0x26ea828) #24 0x00005587d3c7d299 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const (/opt/emscripten-llvm/bin/clang+++0x26eb299) #25 0x00005587d3c8b7e9 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) (/opt/emscripten-llvm/bin/clang+++0x26f97e9) #26 0x00005587d21911f1 main (/opt/emscripten-llvm/bin/clang+++0xbff1f1) #27 0x00007fa675620b25 __libc_start_main (/usr/lib/libc.so.6+0x27b25) #28 0x00005587d221454e _start (/opt/emscripten-llvm/bin/clang+++0xc8254e) clang-13: error: clang frontend command failed with exit code 139 (use -v to see invocation) clang version 13.0.0 (/startdir/llvm-project 91f147792e815d401ae408989992f3c1530cc18a) Target: wasm32-unknown-emscripten Thread model: posix InstalledDir: /opt/emscripten-llvm/bin clang-13: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-13: note: diagnostic msg: /tmp/locale-260dce.cpp clang-13: note: diagnostic msg: /tmp/locale-260dce.sh clang-13: note: diagnostic msg: ******************** em++: error: '/opt/emscripten-llvm/bin/clang++ -target wasm32-unknown-emscripten -DEMSCRIPTEN -fignore-exceptions -fno-inline-functions -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D__EMSCRIPTEN_major__=2 -D__EMSCRIPTEN_minor__=0 -D__EMSCRIPTEN_tiny__=24 -D_LIBCPP_ABI_VERSION=2 -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/home/username/.emscripten_cache/sysroot -Xclang -iwithsysroot/include/compat -Werror -fno-unroll-loops -DLIBCXX_BUILDING_LIBCXXABI=1 -D_LIBCPP_BUILDING_LIBRARY -Oz -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -g -fno-exceptions -c /usr/lib/emscripten/system/lib/libcxx/src/locale.cpp -o /home/username/.emscripten_cache/build/libc++-noexcept/locale.o' failed (returned 139) Traceback (most recent call last): File "/usr/lib/emscripten/em++.py", line 14, in <module> sys.exit(emcc.run(sys.argv)) File "/usr/lib/emscripten/emcc.py", line 1089, in run phase_calculate_system_libraries(state, linker_arguments, linker_inputs, newargs) File "/usr/lib/python3.9/contextlib.py", line 79, in inner return func(*args, **kwds) File "/usr/lib/emscripten/emcc.py", line 2423, in phase_calculate_system_libraries extra_files_to_link += system_libs.calculate([f for _, f in sorted(linker_inputs)] + extra_files_to_link, forced=state.forced_stdlibs) File "/usr/lib/emscripten/tools/system_libs.py", line 1547, in calculate add_library('libc++') File "/usr/lib/emscripten/tools/system_libs.py", line 1505, in add_library libs_to_link.append((lib.get_link_flag(), need_whole_archive)) File "/usr/lib/emscripten/tools/system_libs.py", line 309, in get_link_flag fullpath = self.get_path() File "/usr/lib/emscripten/tools/system_libs.py", line 301, in get_path return shared.Cache.get_lib(self.get_filename(), self.build) File "/usr/lib/emscripten/tools/cache.py", line 134, in get_lib return self.get(name, *args, **kwargs) File "/usr/lib/emscripten/tools/cache.py", line 162, in get creator(cachename) File "/usr/lib/emscripten/tools/system_libs.py", line 369, in build create_lib(out_filename, self.build_objects(build_dir)) File "/usr/lib/emscripten/tools/system_libs.py", line 362, in build_objects run_build_commands(commands) File "/usr/lib/emscripten/tools/system_libs.py", line 89, in run_build_commands shared.run_multiple_processes(commands, env=clean_env()) File "/usr/lib/emscripten/tools/shared.py", line 202, in run_multiple_processes raise Exception('Subprocess %d/%d failed (%s)! (cmdline: %s)' % (idx + 1, len(commands), returncode_to_str(finished_process.returncode), shlex_join(commands[idx]))) Exception: Subprocess 33/41 failed (returned 1)! (cmdline: /usr/lib/emscripten/em++ -Werror -fno-unroll-loops -DLIBCXX_BUILDING_LIBCXXABI=1 -D_LIBCPP_BUILDING_LIBRARY -Oz -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -g -fno-exceptions -c /usr/lib/emscripten/system/lib/libcxx/src/locale.cpp -o /home/username/.emscripten_cache/build/libc++-noexcept/locale.o) ``` Steps to reproduce: ``` touch test.cpp /usr/lib/emscripten/em++ test.cpp ``` |
This task depends upon
Closed by Sven-Hendrik Haase (Svenstaro)
Wednesday, 09 February 2022, 19:00 GMT
Reason for closing: Fixed
Wednesday, 09 February 2022, 19:00 GMT
Reason for closing: Fixed
Comment by
Sven-Hendrik Haase (Svenstaro) -
Monday, 16 August 2021, 23:32 GMT
Comment by
Ryan Roden-Corrent (rcorre) -
Tuesday, 17 August 2021, 10:56 GMT
Comment by angelsl (angelsl) -
Thursday, 14 October 2021, 21:39 GMT
Comment by
Sven-Hendrik Haase (Svenstaro) -
Thursday, 14 October 2021, 21:40 GMT
Comment by
Sven-Hendrik Haase (Svenstaro) -
Monday, 07 February 2022, 06:54 GMT
Comment by Al Gebra (cpuheater) -
Wednesday, 09 February 2022, 18:38 GMT
Can't reproduce. Is this fixed for you as well?
I'm not the OP, but it seems fixed for me on 2.0.27-1. Thanks!
- Field changed: Percent Complete (100% → 0%)
Same crash is happening for me on 2.0.27-1
Makes sense, see
https://bugs.llvm.org/show_bug.cgi?id=50611#c9
Is this still happening for you guys? I can't reproduce it
anymore.
For me it appears to be fixed now. Tested on emscripten 3.0.0-1.