Build fails on TVM 0.6.0/0.6.1 with GCC10 and GCC7

Build fails on TVM 0.6.0/0.6.1 with GCC10 and GCC7, with the following errors:

[   15s] In file included from /usr/include/c++/10/string:40,
[   15s]                  from /usr/include/dmlc/base.h:230,
[   15s]                  from /usr/include/dmlc/endian.h:9,
[   15s]                  from /usr/include/sys/types.h:176,
[   15s]                  from /usr/include/stdlib.h:394,
[   15s]                  from /usr/include/c++/10/cstdlib:75,
[   15s]                  from /usr/include/dmlc/logging.h:11,
[   15s]                  from /home/abuild/rpmbuild/BUILD/incubator-tvm-0.6.1/src/runtime/threading_backend.cc:25:
[   15s] /usr/include/c++/10/bits/char_traits.h:220:3: error: template with C linkage
[   15s]   220 |   template<typename _CharT>
[   15s]       |   ^~~~~~~~
[   15s] In file included from /usr/include/features.h:465,
[   15s]                  from /usr/include/c++/10/aarch64-suse-linux/bits/os_defines.h:39,
[   15s]                  from /usr/include/c++/10/aarch64-suse-linux/bits/c++config.h:518,
[   15s]                  from /usr/include/c++/10/functional:48,
[   15s]                  from /home/abuild/rpmbuild/BUILD/incubator-tvm-0.6.1/include/tvm/runtime/threading_backend.h:27,
[   15s]                  from /home/abuild/rpmbuild/BUILD/incubator-tvm-0.6.1/src/runtime/threading_backend.cc:24:
[   15s] /usr/include/sys/types.h:27:1: note: 'extern "C"' linkage started here
[   15s]    27 | __BEGIN_DECLS
[   15s]       | ^~~~~~~~~~~~~

It would be great if you can dig deeper and look into what causes the problem. e.g. seems the problem was caused by certain file being included, and if we can narrow down the files, it will be helpful to understand what is going on.

This problem also might have something to do with the suse sys/types.h file, since we cannot reproduce on other system(e.g. ubuntu)

The error msg seems to suggest that we shouldn’t use template inside extern “C”.

Which dmlc version is used/recommended to build TVM?

The problem seems to be that in sys/types.h the line # include <endian.h> includes /usr/include/dmlc/endian.h instead of /usr/include/endian.h