Search code examples
c++clangllvmemscripten

ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it - exit code 139


in my case I am trying to build a library (open cascade) using emscripten.

I have to use a specific version of Emscripten (3.1.39) so clang version is 13.

I am using Ubuntu 22

LOGS:

[  0%] Building CXX object src/TKernel/CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o
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: /usr/bin/clang++-13 -target wasm32-unknown-emscripten -DEMSCRIPTEN -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=1 -D__EMSCRIPTEN_tiny__=5 -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D_LIBCPP_ABI_VERSION=2 -fno-threadsafe-statics -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/usr/share/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -DOCC_CONVERT_SIGNALS -I/home/bm/Downloads/freetype-2.7.1/include -I/home/bm/opencascade/include/opencascade -std=c++0x -fexceptions -fPIC -Wall -Wextra -O3 -DNDEBUG -DNo_Exception -DOCCT_NO_PLUGINS -MD -MT src/TKernel/CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o -MF CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o.d -c /home/bm/opencascade/src/Resource/Resource_Manager.cxx -o CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o
1.  <eof> parser at end of file
2.  Code generation
3.  Running pass 'Function Pass Manager' on module '/home/bm/opencascade/src/Resource/Resource_Manager.cxx'.
4.  Running pass 'WebAssembly Instruction Selection' on function '@_ZNK16Resource_Manager5ValueEPKc'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamEi+0x31)[0x7ca51d1e5491]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7ca51d1e3640]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0xfb)[0x7ca51d1e4b1b]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(+0xd29195)[0x7ca51d129195]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7ca51bc42520]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm19SelectionDAGBuilder31HandlePHINodesInSuccessorBlocksEPKNS_10BasicBlockE+0x298)[0x7ca51d8ab6b8]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm19SelectionDAGBuilder5visitERKNS_11InstructionE+0x24)[0x7ca51d8ab2d4]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm16SelectionDAGISel16SelectBasicBlockENS_14ilist_iteratorINS_12ilist_detail12node_optionsINS_11InstructionELb0ELb0EvEELb0ELb1EEES6_Rb+0x149)[0x7ca51d932089]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x1865)[0x7ca51d931af5]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE+0x7cc)[0x7ca51d92f64c]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0xfe)[0x7ca51d52d9de]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x390)[0x7ca51d31a660]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x33)[0x7ca51d3201d3]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x3a8)[0x7ca51d31ac68]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(+0x19856a1)[0x7ca523d856a1]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0x1291)[0x7ca523d7ffd1]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(+0x1c4371e)[0x7ca52404371e]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang8ParseASTERNS_4SemaEbb+0x244)[0x7ca52301e3f4]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang13CodeGenAction13ExecuteActionEv+0xa1)[0x7ca52403fee1]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang14FrontendAction7ExecuteEv+0x56)[0x7ca524884d96]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x2c6)[0x7ca5247ff2f6]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x664)[0x7ca5248f8464]
/usr/bin/clang++-13(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x944)[0x413e54]
/usr/bin/clang++-13[0x411e46]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(+0x20fd382)[0x7ca5244fd382]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xdd)[0x7ca51d128eed]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x140)[0x7ca5244fcc60]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x190)[0x7ca5244d0760]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x8a)[0x7ca5244d0b4a]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xfe)[0x7ca5244e5d1e]
/usr/bin/clang++-13(main+0x2473)[0x411683]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7ca51bc29d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7ca51bc29e40]
/usr/bin/clang++-13(_start+0x25)[0x40eed5]
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
Ubuntu clang version 13.0.1-2ubuntu2.2
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /usr/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: /tmp/Resource_Manager-12193b.cpp
clang: note: diagnostic msg: /tmp/Resource_Manager-12193b.sh
clang: note: diagnostic msg: 

********************
em++: error: '/usr/bin/clang++-13 -target wasm32-unknown-emscripten -DEMSCRIPTEN -D__EMSCRIPTEN_major__=3 -D__EMSCRIPTEN_minor__=1 -D__EMSCRIPTEN_tiny__=5 -fvisibility=default -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr -D_LIBCPP_ABI_VERSION=2 -fno-threadsafe-statics -Dunix -D__unix -D__unix__ -Werror=implicit-function-declaration -Xclang -iwithsysroot/include/SDL --sysroot=/usr/share/emscripten/cache/sysroot -Xclang -iwithsysroot/include/compat -DOCC_CONVERT_SIGNALS -I/home/bm/Downloads/freetype-2.7.1/include -I/home/bm/opencascade/include/opencascade -std=c++0x -fexceptions -fPIC -Wall -Wextra -O3 -DNDEBUG -DNo_Exception -DOCCT_NO_PLUGINS -MD -MT src/TKernel/CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o -MF CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o.d -c /home/bm/opencascade/src/Resource/Resource_Manager.cxx -o CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o' failed (returned 139)
make[2]: *** [src/TKernel/CMakeFiles/TKernel.dir/build.make:647: src/TKernel/CMakeFiles/TKernel.dir/__/Resource/Resource_Manager.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:962: src/TKernel/CMakeFiles/TKernel.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
emmake: error: 'make CFLAGS=-g' failed (returned 2)

I noticed that Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it)

so I tried a couple of potential solutions found in the web but nothing change. tried the same looking for exit code 139, but still the same.

Here my preprocessed source and run script: https://github.com/SoftwareMechanic/open-cascade-building-debug

I was wondering if the reason of this issue is because that preprocessed source file is very large (almost a million of lines of code),in that case, how can I avoid to face that error?

What could be the cause of such issue? Do you have some hints, tips or workaround for this? Thank you.

any tip would be MUCH appreciated.


Solution

  • if you pay attention, the version of clang used by the version of Emscripten you specified is not 13. Emscripten 3.1.39 is supposed to run with clang/LLVM version c672c3f which is not 13.

    your system is probably running the distro version or by the way a version of emscripten installed somewhere else.

    I suggest you to uninstall everything related to emscripten/emsdk and reinstall it as shown in their documentation. (not using sudo apt-get) then do a clean build of your project.