B Programmer
B Programmer

Reputation: 51

clang frontend command failed with exit code 139

I know this seems an already asked question, but I can't find a solution to the error I am facing.

I am trying to build Open-Cascade version V7.5.3 on my ubuntu hyper-v VM, using EMSCRIPTEN. I run the command emcmake cmake and everything went as expected, but now, running the command emmake make I get the following error:

clang frontend command failed with exit code 139 (use -v to see in vocation)
Ubuntu clang version 13.0.1-2ubuntu2.2
Target: wasm32-unknown-emscripten
Thread model: posix
clang note diagnostic msg:
******************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
.......

considering the preprocessed source is very large (37 MB) I zipped it in a public git repo with associated run script , I must share only a link for you in order to access them, sorry for that.

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.

EDIT: here more info

EMSCRIPTEN Version: 3.1.39 (I need to use this version for my current project)

Ubuntu 22

    [  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)[0x7ae0579e5491]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm3sys17RunSignalHandlersEv+0x50)[0x7ae0579e3640]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm3sys15CleanupOnSignalEm+0xfb)[0x7ae0579e4b1b]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(+0xd29195)[0x7ae057929195]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7ae056442520]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm19SelectionDAGBuilder31HandlePHINodesInSuccessorBlocksEPKNS_10BasicBlockE+0x298)[0x7ae0580ab6b8]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm19SelectionDAGBuilder5visitERKNS_11InstructionE+0x24)[0x7ae0580ab2d4]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm16SelectionDAGISel16SelectBasicBlockENS_14ilist_iteratorINS_12ilist_detail12node_optionsINS_11InstructionELb0ELb0EvEELb0ELb1EEES6_Rb+0x149)[0x7ae058132089]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x1865)[0x7ae058131af5]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE+0x7cc)[0x7ae05812f64c]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm19MachineFunctionPass13runOnFunctionERNS_8FunctionE+0xfe)[0x7ae057d2d9de]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0x390)[0x7ae057b1a660]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x33)[0x7ae057b201d3]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x3a8)[0x7ae057b1ac68]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(+0x19856a1)[0x7ae05e5856a1]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang17EmitBackendOutputERNS_17DiagnosticsEngineERKNS_19HeaderSearchOptionsERKNS_14CodeGenOptionsERKNS_13TargetOptionsERKNS_11LangOptionsEN4llvm9StringRefEPNSE_6ModuleENS_13BackendActionESt10unique_ptrINSE_17raw_pwrite_streamESt14default_deleteISK_EE+0x1291)[0x7ae05e57ffd1]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(+0x1c4371e)[0x7ae05e84371e]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang8ParseASTERNS_4SemaEbb+0x244)[0x7ae05d81e3f4]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang13CodeGenAction13ExecuteActionEv+0xa1)[0x7ae05e83fee1]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang14FrontendAction7ExecuteEv+0x56)[0x7ae05f084d96]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x2c6)[0x7ae05efff2f6]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0x664)[0x7ae05f0f8464]
/usr/bin/clang++-13(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x944)[0x413e54]
/usr/bin/clang++-13[0x411e46]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(+0x20fd382)[0x7ae05ecfd382]
/lib/x86_64-linux-gnu/libLLVM-13.so.1(_ZN4llvm20CrashRecoveryContext9RunSafelyENS_12function_refIFvvEEE+0xdd)[0x7ae057928eed]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZNK5clang6driver10CC1Command7ExecuteEN4llvm8ArrayRefINS2_8OptionalINS2_9StringRefEEEEEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPb+0x140)[0x7ae05ecfcc60]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZNK5clang6driver11Compilation14ExecuteCommandERKNS0_7CommandERPS3_+0x190)[0x7ae05ecd0760]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZNK5clang6driver11Compilation11ExecuteJobsERKNS0_7JobListERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0x8a)[0x7ae05ecd0b4a]
/lib/x86_64-linux-gnu/libclang-cpp.so.13(_ZN5clang6driver6Driver18ExecuteCompilationERNS0_11CompilationERN4llvm15SmallVectorImplISt4pairIiPKNS0_7CommandEEEE+0xfe)[0x7ae05ece5d1e]
/usr/bin/clang++-13(main+0x2473)[0x411683]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7ae056429d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7ae056429e40]
/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-909270.cpp
clang: note: diagnostic msg: /tmp/Resource_Manager-909270.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)

Upvotes: 1

Views: 738

Answers (1)

KaHa6uc
KaHa6uc

Reputation: 495

I stumbled upon the same issue tonight, trying to build Chromium on my PC with Core i9-14900KF with 32 cores. It tried to span 34 parallel jobs and apparently it happened that at times two jobs would write to the same file. Every time it failed on a different file. I gradually lowered the jobs limit and at -j 28 the <eof> parser at end of file error stopped appearing.

So, if you have many cores and many threads, try lowering the parallel job limit.

Hope this helps.

Upvotes: 0

Related Questions