mlc-ai / mlc-llm

Universal LLM Deployment Engine with ML Compilation
https://llm.mlc.ai/
Apache License 2.0
18.8k stars 1.54k forks source link

[Bug] error: no template named 'is_base_of_v' in namespace 'std'; did you mean 'is_base_of'? #2620

Closed haohenggang closed 2 months ago

haohenggang commented 3 months ago

šŸ› Bug

mlc_llm package [100%] Building CXX object CMakeFiles/tvm4j_runtime_packed.dir/home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc.o In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25: In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9: In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27: In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:28: In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/ndarray.h:28: In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/optional.h:29: In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/./base.h:29: In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/memory.h:26: /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:574:67: error: no template named 'is_base_of_v' in namespace 'std'; did you mean 'is_base_of'? template <typename ObjectType, typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>>


                                                                  is_base_of
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:1725:29: note: 'is_base_of' declared here
struct _LIBCPP_TEMPLATE_VIS is_base_of
                            ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/ndarray.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/optional.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/./base.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/memory.h:26:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:574:62: error: template argument for non-type template parameter must be an expression
  template <typename ObjectType, typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>>
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:542:16: note: template parameter is declared here
template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
               ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/ndarray.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/optional.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/./base.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/memory.h:26:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:595:46: error: no template named 'is_base_of_v' in namespace 'std'; did you mean 'is_base_of'?
            typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>>
                                        ~~~~~^~~~~~~~~~~~
                                             is_base_of
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:1725:29: note: 'is_base_of' declared here
struct _LIBCPP_TEMPLATE_VIS is_base_of
                            ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/ndarray.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/optional.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/./base.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/memory.h:26:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:595:41: error: template argument for non-type template parameter must be an expression
            typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>>
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:542:16: note: template parameter is declared here
template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
               ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/ndarray.h:30:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/string.h:511:27: error: no matching member function for call to 'as'
  if (const auto* str = a.as<StringObj>()) {
                        ~~^~~~~~~~~~~~~
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:906:37: note: candidate template ignored: couldn't infer template argument ''
inline const ObjectType* ObjectRef::as() const {
                                    ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/optional.h:157:43: note: candidate template ignored: couldn't infer template argument ''
inline Optional<ObjectRefType> ObjectRef::as() const {
                                          ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/ndarray.h:30:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/string.h:521:29: error: no matching member function for call to 'as'
  if (const auto* str_a = a.as<StringObj>()) {
                          ~~^~~~~~~~~~~~~
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:906:37: note: candidate template ignored: couldn't infer template argument ''
inline const ObjectType* ObjectRef::as() const {
                                    ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/optional.h:157:43: note: candidate template ignored: couldn't infer template argument ''
inline Optional<ObjectRefType> ObjectRef::as() const {
                                          ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:28:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/ndarray.h:30:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/string.h:522:31: error: no matching member function for call to 'as'
    if (const auto* str_b = b.as<StringObj>()) {
                            ~~^~~~~~~~~~~~~
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:906:37: note: candidate template ignored: couldn't infer template argument ''
inline const ObjectType* ObjectRef::as() const {
                                    ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/optional.h:157:43: note: candidate template ignored: couldn't infer template argument ''
inline Optional<ObjectRefType> ObjectRef::as() const {
                                          ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/packed_func.h:28:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:261:12: error: no template named 'bool_constant' in namespace 'std'; did you mean '_BoolConstant'?
    : std::bool_constant<std::is_base_of_v<
      ~~~~~^~~~~~~~~~~~~
           _BoolConstant
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:459:1: note: '_BoolConstant' declared here
using _BoolConstant _LIBCPP_NODEBUG_TYPE = integral_constant<bool, _Val>;
^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/packed_func.h:28:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:261:31: error: no template named 'is_base_of_v' in namespace 'std'; did you mean 'is_base_of'?
    : std::bool_constant<std::is_base_of_v<
                         ~~~~~^~~~~~~~~~~~
                              is_base_of
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:1725:29: note: 'is_base_of' declared here
struct _LIBCPP_TEMPLATE_VIS is_base_of
                            ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/packed_func.h:28:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:261:26: error: template argument for non-type template parameter must be an expression
    : std::bool_constant<std::is_base_of_v<
                         ^~~~~~~~~~~~~~~~~~
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:458:16: note: template parameter is declared here
template <bool _Val>
               ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/packed_func.h:28:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:268:1: warning: inline variables are a C++17 extension [-Wc++17-extensions]
inline constexpr bool is_valid_iterator_v = is_valid_iterator<T, IterType>::value;
^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:650:43: error: no template named 'invoke_result_t' in namespace 'std'
  template <typename F, typename U = std::invoke_result_t<F, T>>
                                     ~~~~~^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:661:58: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
  template <typename F, typename = std::enable_if_t<std::is_same_v<T, std::invoke_result_t<F, T>>>>
                                                    ~~~~~^~~~~~~~~
                                                         is_same
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:550:29: note: 'is_same' declared here
struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
                            ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/packed_func.h:28:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:661:76: error: no member named 'invoke_result_t' in namespace 'std'
  template <typename F, typename = std::enable_if_t<std::is_same_v<T, std::invoke_result_t<F, T>>>>
                                                                      ~~~~~^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:661:92: error: 'F' does not refer to a value
  template <typename F, typename = std::enable_if_t<std::is_same_v<T, std::invoke_result_t<F, T>>>>
                                                                                           ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:661:22: note: declared here
  template <typename F, typename = std::enable_if_t<std::is_same_v<T, std::invoke_result_t<F, T>>>>
                     ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:661:99: error: expected member name or ';' after declaration specifiers
  template <typename F, typename = std::enable_if_t<std::is_same_v<T, std::invoke_result_t<F, T>>>>
                                                                                                  ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:784:43: error: no template named 'invoke_result_t' in namespace 'std'
  template <typename F, typename U = std::invoke_result_t<F, T>>
                                     ~~~~~^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:792:47: error: no template named 'is_same_v' in namespace 'std'; did you mean 'is_same'?
    constexpr bool is_same_output_type = std::is_same_v<T, U>;
                                         ~~~~~^~~~~~~~~
                                              is_same
/home/hhg/android-sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/type_traits:550:29: note: 'is_same' declared here
struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { };
                            ^
In file included from /home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc:25:
In file included from /home/hhg/mlc-llm/android/mlc4j/src/cpp/tvm_runtime.h:9:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/src/runtime/c_runtime_api.cc:27:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/device_api.h:29:
In file included from /home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/packed_func.h:28:
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:792:62: error: expected '(' for function-style cast or type construction
    constexpr bool is_same_output_type = std::is_same_v<T, U>;
                                         ~~~~~~~~~~~~~~~~~~~~^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:794:8: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
    if constexpr (is_same_output_type) {
       ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:794:19: error: constexpr if condition is not a constant expression
    if constexpr (is_same_output_type) {
                  ^~~~~~~~~~~~~~~~~~~
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:794:19: note: initializer of 'is_same_output_type' is unknown
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:792:20: note: declared here
    constexpr bool is_same_output_type = std::is_same_v<T, U>;
                   ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:814:8: warning: constexpr if is a C++17 extension [-Wc++17-extensions]
    if constexpr (compatible_types) {
       ^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:876:1: warning: inline variables are a C++17 extension [-Wc++17-extensions]
inline constexpr bool is_tvm_array = false;
^
/home/hhg/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:879:1: warning: inline variables are a C++17 extension [-Wc++17-extensions]
inline constexpr bool is_tvm_array<Array<T>> = true;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
5 warnings and 20 errors generated.
make[3]: *** [CMakeFiles/tvm4j_runtime_packed.dir/build.make:76: CMakeFiles/tvm4j_runtime_packed.dir/home/hhg/mlc-llm/3rdparty/tvm/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:263: CMakeFiles/tvm4j_runtime_packed.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:270: CMakeFiles/tvm4j_runtime_packed.dir/rule] Error 2
make: *** [Makefile:203: tvm4j_runtime_packed] Error 2
Traceback (most recent call last):
  File "/home/hhg/mlc-llm/android/mlc4j/prepare_libs.py", line 120, in <module>
    main(parsed.mlc_llm_source_dir)
  File "/home/hhg/mlc-llm/android/mlc4j/prepare_libs.py", line 103, in main
    run_cmake_build()
  File "/home/hhg/mlc-llm/android/mlc4j/prepare_libs.py", line 66, in run_cmake_build
    subprocess.run(cmd, check=True, env=os.environ)
  File "/home/pwb/miniforge3/envs/mlc-chat-venv/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--target', 'tvm4j_runtime_packed', '--config', 'release', '-j8']' returned non-zero exit status 2.
Traceback (most recent call last):
  File "/home/pwb/miniforge3/envs/mlc-chat-venv/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/home/pwb/miniforge3/envs/mlc-chat-venv/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/hhg/mlc-llm/python/mlc_llm/__main__.py", line 64, in <module>
    main()
  File "/home/hhg/mlc-llm/python/mlc_llm/__main__.py", line 53, in main
    cli.main(sys.argv[2:])
  File "/home/hhg/mlc-llm/python/mlc_llm/cli/package.py", line 64, in main
    package(
  File "/home/hhg/mlc-llm/python/mlc_llm/interface/package.py", line 361, in package
    build_android_binding(mlc_llm_source_dir, output)
  File "/home/hhg/mlc-llm/python/mlc_llm/interface/package.py", line 275, in build_android_binding
    subprocess.run([sys.executable, mlc4j_path / "prepare_libs.py"], check=True, env=os.environ)
  File "/home/pwb/miniforge3/envs/mlc-chat-venv/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/pwb/miniforge3/envs/mlc-chat-venv/bin/python', PosixPath('/home/hhg/mlc-llm/android/mlc4j/prepare_libs.py')]' returned non-zero exit status 1.

## To Reproduce

Steps to reproduce the behavior:

1.
1.
1.

<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->

## Expected behavior

<!-- A clear and concise description of what you expected to happen. -->

## Environment

 - Platform (e.g. WebGPU/Vulkan/IOS/Android/CUDA):
 - Operating system (e.g. Ubuntu/Windows/MacOS/...):
 - Device (e.g. iPhone 12 Pro, PC+RTX 3090, ...)
 - How you installed MLC-LLM (`conda`, source):
 - How you installed TVM-Unity (`pip`, source):
 - Python version (e.g. 3.10):
 - GPU driver version (if applicable):
 - CUDA/cuDNN version (if applicable):
 - TVM Unity Hash Tag (`python -c "import tvm; print('\n'.join(f'{k}: {v}' for k, v in tvm.support.libinfo().items()))"`, applicable if you compile models):
 - Any other relevant information:

## Additional context
gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.3) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

<!-- Add any other context about the problem here. -->
MasterJH5574 commented 3 months ago

@haohenggang is_base_of_v is a feature available since C++17. Given we use the clang in Android NDK to compile the source files, could you check if the clang in your android ndk supports C++17?

For example, assuming you have set the environment variables TVM_NDK_CC as described in our documentation, than you can run

$TVM_NDK_CC -v

to check the clang version.

mrbrantofgithub commented 2 months ago

use ndk 27

tombang commented 2 months ago

Hello,

I have the same problem with you, have you fixed this problem?

mZos commented 2 months ago

@tombang I had the same problem, updating ndk to 27 worked for me

tqchen commented 2 months ago

Please use the latest ndk

tqchen commented 2 months ago

Please use the latest ndk, see related issue https://github.com/mlc-ai/mlc-llm/issues/2696

devojony commented 3 weeks ago

I had the same problem, after using the latest version of the NDK and then deleting the path/to/android/MLCChat/build and path/to/android/MLCChat/dist directories, and then re-running the commands, it worked!