Skip to content

Commit

Permalink
Try fix macOS build with picojson (mlc-ai#1206)
Browse files Browse the repository at this point in the history
The error message below

```
/usr/share/miniconda/envs/mlc-llm-build/conda-bld/mlc-chat-cli-nightly-package_1699286394016/work/3rdparty/tvm/3rdparty/picojson/picojson.h: In member function 'std::string picojson::value::to_str() const':
/usr/share/miniconda/envs/mlc-llm-build/conda-bld/mlc-chat-cli-nightly-package_1699286394016/work/3rdparty/tvm/3rdparty/picojson/picojson.h:494:37: error: expected ')' before 'PRId64'
  494 |       SNPRINTF(buf, sizeof(buf), "%" PRId64, u_.int64_);
      |               ~                     ^~~~~~~
      |                                     )
/usr/share/miniconda/envs/mlc-llm-build/conda-bld/mlc-chat-cli-nightly-package_1699286394016/work/3rdparty/tvm/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>

```

indicates that the `__STDC_FORMAT_MACROS` flag is not turned on for some
reason.
  • Loading branch information
junrushao authored Nov 6, 2023
1 parent 65478c8 commit 01d4339
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions cpp/json_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
#define MLC_LLM_CPP_JSON_PARSER_H_

#define PICOJSON_USE_INT64
#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif

#include <picojson.h>
#include <tvm/runtime/container/shape_tuple.h>
Expand Down

0 comments on commit 01d4339

Please sign in to comment.