Segmentation Fault Issue

I was trying to build tvm from the source but I am stuck with an issue related to Segmentation Fault. The issue seems very similar to the one described here:

Build with segfault(latest commit)(gcc error..)

Running cmake gave me the following log, everything seems fine here:

(venv3) ubuntu@INSISCSDT-2367:~/ashwin/tvm/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Forbidding undefined symbols in shared library, using -Wl,--no-undefined on platform Linux
-- Build with RPC support...
-- Build with Graph Executor support...
-- Build with profiler...
-- Build with AOT Executor support...
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- VTA build with VTA_HW_PATH=/home/ubuntu/ashwin/tvm/3rdparty/vta-hw
-- Build VTA runtime with target: sim
-- Link with dynamic LLVM library
-- Found LLVM_INCLUDE_DIRS=/usr/lib/llvm-6.0/include
-- Found LLVM_DEFINITIONS=-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-- Found LLVM_LIBS=LLVM
-- Found TVM_LLVM_VERSION=60
-- Build with LLVM 6.0.0
-- Set TVM_LLVM_VERSION=60
-- Build with contrib.random
-- Build with contrib.sort
-- Build with contrib.hybriddump
-- Git found: /usr/bin/git
-- Found TVM_GIT_COMMIT_HASH=45f3d4a521ec476cd9960e3d2de4f66bde61bf23
-- Found TVM_GIT_COMMIT_TIME=2022-04-11 11:49:13 +0900
-- Performing Test SUPPORT_CXX14
-- Performing Test SUPPORT_CXX14 - Success
-- Autoset: USE_LIBBACKTRACE=ON in Linux
-- Building with libbacktrace...
-- Building with TVM Map...
-- Build with thread support...
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Didn't find the path to CCACHE, disabling ccache
-- Configuring done
-- Generating done
-- Build files have been written to: /home/ubuntu/ashwin/tvm/build

Then after typing build, I get the following error message: > [ 32%] Building CXX object CMakeFiles/tvm_objs.dir/src/te/schedule/schedule_dataflow_rewrite.cc.o

    /home/ubuntu/ashwin/tvm/src/te/schedule/message_passing.cc: In lambda function:
    /home/ubuntu/ashwin/tvm/src/te/schedule/message_passing.cc:111:3: internal compiler error: Segmentation fault
       };
       ^
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
    CMakeFiles/tvm_objs.dir/build.make:2846: recipe for target 'CMakeFiles/tvm_objs.dir/src/te/schedule/message_passing.cc.o' failed
    make[2]: *** [CMakeFiles/tvm_objs.dir/src/te/schedule/message_passing.cc.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    In file included from /usr/include/c++/7/functional:58:0,
                     from /home/ubuntu/ashwin/tvm/include/tvm/runtime/ndarray.h:36,
                     from /home/ubuntu/ashwin/tvm/include/tvm/node/structural_hash.h:28,
                     from /home/ubuntu/ashwin/tvm/include/tvm/node/reflection.h:27,
                     from /home/ubuntu/ashwin/tvm/include/tvm/node/node.h:37,
                     from /home/ubuntu/ashwin/tvm/include/tvm/ir/span.h:27,
                     from /home/ubuntu/ashwin/tvm/include/tvm/ir/expr.h:27,
                     from /home/ubuntu/ashwin/tvm/include/tvm/arith/int_set.h:27,
                     from /home/ubuntu/ashwin/tvm/include/tvm/arith/analyzer.h:27,
                     from /home/ubuntu/ashwin/tvm/include/tvm/te/operation.h:27,
                     from /home/ubuntu/ashwin/tvm/src/te/schedule/schedule_dataflow_rewrite.cc:23:
    /usr/include/c++/7/bits/std_function.h: In instantiation of ‘std::function<_Res(_ArgTypes ...)>::function(std::function<_Res(_ArgTypes ...)>&&) [with _Res = tvm::PrimExpr; _ArgTypes = {tvm::tir::Var, tvm::tir::Var, tvm::tir::Var, tvm::tir::Var}]’:
    /home/ubuntu/ashwin/tvm/include/tvm/te/operation.h:635:19:   required from here
    /usr/include/c++/7/bits/std_function.h:443:6: internal compiler error: Segmentation fault
      __x.swap(*this);
      ~~~~^~~~
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
    CMakeFiles/tvm_objs.dir/build.make:2894: recipe for target 'CMakeFiles/tvm_objs.dir/src/te/schedule/schedule_dataflow_rewrite.cc.o' failed
    make[2]: *** [CMakeFiles/tvm_objs.dir/src/te/schedule/schedule_dataflow_rewrite.cc.o] Error 1
    CMakeFiles/Makefile2:99: recipe for target 'CMakeFiles/tvm_objs.dir/all' failed
    make[1]: *** [CMakeFiles/tvm_objs.dir/all] Error 2
    Makefile:129: recipe for target 'all' failed
    make: *** [all] Error 2

Kindly advice on how to fix the issue, the log mentions that I could report it

@ashwinjoseph could you let us know which platform and compiler you’re using? also, TVM does require a bit of memory to build the sources