This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch unity
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/unity by this push:
     new e0e6c1d9c3 [Relax][VM] Add additional flags for picojson (#15737)
e0e6c1d9c3 is described below

commit e0e6c1d9c312cbb4df1f7837de284f5a41a8d924
Author: Junru Shao <[email protected]>
AuthorDate: Wed Sep 13 22:12:49 2023 -0700

    [Relax][VM] Add additional flags for picojson (#15737)
    
    This commits adds `__STDC_FORMAT_MACROS` when including picojson in C++.
    This should fix a recent build issue as below:
    
    ```
    In file included from src/runtime/relax_vm/ndarray_cache_support.cc:40:
    3rdparty/picojson/picojson.h: In member function 'std::string 
picojson::value::to_str() const':
    3rdparty/picojson/picojson.h:494:37: error: expected ')' before 'PRId64'
      494 |       SNPRINTF(buf, sizeof(buf), "%" PRId64, u_.int64_);
          |               ~                     ^~~~~~~
          |                                     )
    3rdparty/picojson/picojson.h:81:1: note: 'PRId64' is defined in header 
'<cinttypes>'; did you forget to '#include <cinttypes>'?
       80 | #include <errno.h>
      +++ |+#include <cinttypes>
       81 | #include <inttypes.h>
    ```
---
 src/runtime/relax_vm/ndarray_cache_support.cc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/runtime/relax_vm/ndarray_cache_support.cc 
b/src/runtime/relax_vm/ndarray_cache_support.cc
index da24a1392d..3a5e961fe1 100644
--- a/src/runtime/relax_vm/ndarray_cache_support.cc
+++ b/src/runtime/relax_vm/ndarray_cache_support.cc
@@ -35,6 +35,9 @@
  * runtime builtin provide as in this file.
  */
 #define PICOJSON_USE_INT64
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
 #include "./ndarray_cache_support.h"
 
 #include <picojson.h>

Reply via email to