Building TVM in docker image at Jetson Nano

When I compiling TVM by the source code in a docker images at Jetson Nano, I met a problem:

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(261): error: namespace "std" has no member class "bool_constant"

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(261): error: not a class or struct name

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(261): error: class or struct definition is missing

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(615): error: expected a "," or ">"

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(615): error: namespace "std" has no member "invoke_result_t"

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(615): error: expected a "," or ">"

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(616): error: expected a declaration

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(616): error: expected a ";"

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(640): warning: parsing restarts here after previous syntax error

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(642): error: expected a declaration

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(651): warning: parsing restarts here after previous syntax error

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(652): error: expected a declaration

/root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h(655): warning: parsing restarts here after previous syntax error

I have add “CXX_STANDARD=17” in my cmakefile, so it realy confuses me.

Seems that the error message comes from NVCC, but I suppose TVM should be compiled with gcc/clang instead.

some older versions of NVCC don’t actually support CXX-17, but if does, how about adding

#include <type_traits>

in /root/litepose/apache-tvm-src-v0.10.0/include/tvm/runtime/container/array.h given it’s where both std::bool_constant and std::invoke_result_t are supposed to reside

Thanks for relay! I have check the array.h , and #include <type_traits> had already been added. So I guess maybe I need to try an older version of TVM

And this is my cmake log:

-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/local/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/local/bin/c++ - skipped
-- 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) 
-- Build Alloc alignment set to 64
-- Didn't find the path to CCACHE, disabling ccache
-- Performing Test SUPPORT_CXX17
-- Performing Test SUPPORT_CXX17 - Success
-- VTA build with VTA_HW_PATH=/root/litepose/tvm/3rdparty/vta-hw
-- Build VTA runtime with target: sim
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.2
-- Found CUDA_CUDA_LIBRARY=/usr/local/cuda-10.2/lib64/stubs/libcuda.so
-- Found CUDA_CUDART_LIBRARY=/usr/local/cuda-10.2/lib64/libcudart.so
-- Found CUDA_NVRTC_LIBRARY=/usr/local/cuda-10.2/lib64/stubs/libnvrtc.so
-- Found CUDA_CUDNN_INCLUDE_DIRS=
-- Found CUDA_CUDNN_LIBRARY=
-- Found CUDA_CUBLAS_LIBRARY=CUDA_CUBLAS_LIBRARY-NOTFOUND
-- Found CUDA_CURAND_LIBRARY=CUDA_CURAND_LIBRARY-NOTFOUND
-- Found CUDA_CUBLASLT_LIBRARY=CUDA_CUBLASLT_LIBRARY-NOTFOUND
-- Build with CUDA 10.2 support
-- Build with Thrust support
-- The CUDA compiler identification is NVIDIA 10.2.300
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda-10.2/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Build with Graph executor with CUDA Graph support...
-- 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=f4520c4f1550bf76e4e547e75ae3ed65d6f55a7b
-- Found TVM_GIT_COMMIT_TIME=2023-03-16 10:30:59 +0000
-- Could NOT find LIBBACKTRACE (missing: LIBBACKTRACE_STATIC_LIBRARY LIBBACKTRACE_INCLUDE_DIR) 
-- Building libbacktrace from 3rdparty/libbacktrace
-- Building with TVM Map...
-- Build with thread support...
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Configuring done
-- Generating done
-- Build files have been written to: /root/litepose/tvm/build

At last, I build TVM version 0.9.0 with “CXX_STANDARD=14”. I think maybe NVCC in JetPack Version r32.6.1 don’t actually support CXX-17. Anyway, CXX-14 successed.