onnx / onnx-mlir

Representation and Reference Lowering of ONNX Models in MLIR Compiler Infrastructure
Apache License 2.0
713 stars 306 forks source link

compile error #2326

Open wm901115nwpu opened 1 year ago

wm901115nwpu commented 1 year ago

╰─ cmake --build . -j 1 ─╯ [1/696] Running gen_proto.py on onnx/onnx.in.proto Processing /Users/unicorn/workspace/onnx-mlir/third_party/onnx/onnx/onnx.in.proto Writing /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.proto Writing /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.proto3 generating /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx_pb.py [3/696] Running gen_proto.py on onnx/onnx-operators.in.proto Processing /Users/unicorn/workspace/onnx-mlir/third_party/onnx/onnx/onnx-operators.in.proto Writing /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-operators-ml.proto Writing /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-operators-ml.proto3 generating /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx_operators_pb.py [5/696] Running gen_proto.py on onnx/onnx-data.in.proto Processing /Users/unicorn/workspace/onnx-mlir/third_party/onnx/onnx/onnx-data.in.proto Writing /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-data.proto Writing /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-data.proto3 generating /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx_data_pb.py [7/696] Building CXX object third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.o FAILED: third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.o /usr/bin/c++ -DONNX_API="attribute((visibility(\"default\")))" -DONNX_ML=1 -DONNX_NAMESPACE=onnx -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/Users/unicorn/workspace/llvm-project/llvm/include -I/Users/unicorn/workspace/llvm-project/build/include -I/Users/unicorn/workspace/llvm-project/mlir/include -I/Users/unicorn/workspace/llvm-project/build/tools/mlir/include -I/Users/unicorn/workspace/onnx-mlir/build/third_party/onnx -isystem /opt/homebrew/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -w -Wnon-virtual-dtor -g -O0 -std=gnu++11 -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_ASSERTIONS -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -MD -MT third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.o -MF third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.o.d -o third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-ml.pb.cc.o -c /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:11: /opt/homebrew/include/google/protobuf/port_def.inc:205:1: error: static_assert failed due to requirement '201103L >= 201402L' "Protobuf only supports C++14 and newer." static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer."); ^ ~~~~~~~ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:130: In file included from /opt/homebrew/include/google/protobuf/stubs/common.h:44: In file included from /opt/homebrew/include/absl/strings/string_view.h:39: In file included from /opt/homebrew/include/absl/base/attributes.h:37: In file included from /opt/homebrew/include/absl/base/config.h:86: /opt/homebrew/include/absl/base/policy_checks.h:79:2: error: "C++ versions less than C++14 are not supported."

error "C++ versions less than C++14 are not supported."

^ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:130: In file included from /opt/homebrew/include/google/protobuf/stubs/common.h:46: In file included from /opt/homebrew/include/google/protobuf/stubs/port.h:45: /opt/homebrew/include/google/protobuf/port_def.inc:205:1: error: static_assert failed due to requirement '201103L >= 201402L' "Protobuf only supports C++14 and newer." static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer."); ^ ~~~~~~~ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:130: In file included from /opt/homebrew/include/google/protobuf/stubs/common.h:56: /opt/homebrew/include/google/protobuf/port_def.inc:205:1: error: static_assert failed due to requirement '201103L >= 201402L' "Protobuf only supports C++14 and newer." static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer."); ^ ~~~~~~~ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:132: In file included from /opt/homebrew/include/absl/log/absl_check.h:38: In file included from /opt/homebrew/include/absl/log/internal/check_impl.h:19: In file included from /opt/homebrew/include/absl/log/internal/check_op.h:37: In file included from /opt/homebrew/include/absl/log/internal/strip.h:24: In file included from /opt/homebrew/include/absl/log/internal/log_message.h:41: In file included from /opt/homebrew/include/absl/log/log_entry.h:36: In file included from /opt/homebrew/include/absl/types/span.h:69: /opt/homebrew/include/absl/types/internal/span.h:119:21: error: no template named 'remove_const_t' in namespace 'std'; did you mean simply 'remove_const_t'? using Container = std::remove_const_t; ^~~~~ /opt/homebrew/include/absl/meta/type_traits.h:592:1: note: 'remove_const_t' declared here using remove_const_t = typename std::remove_const::type; ^ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:132: In file included from /opt/homebrew/include/absl/log/absl_check.h:38: In file included from /opt/homebrew/include/absl/log/internal/check_impl.h:19: In file included from /opt/homebrew/include/absl/log/internal/check_op.h:37: In file included from /opt/homebrew/include/absl/log/internal/strip.h:24: In file included from /opt/homebrew/include/absl/log/internal/log_message.h:41: In file included from /opt/homebrew/include/absl/log/log_entry.h:36: In file included from /opt/homebrew/include/absl/types/span.h:69: /opt/homebrew/include/absl/types/internal/span.h:130:24: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'? using EnableIfIsView = std::enable_if_t<IsView::value, int>; ^~~~~ /opt/homebrew/include/absl/meta/type_traits.h:656:1: note: 'enable_if_t' declared here using enable_if_t = typename std::enable_if<B, T>::type; ^ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:132: In file included from /opt/homebrew/include/absl/log/absl_check.h:38: In file included from /opt/homebrew/include/absl/log/internal/check_impl.h:19: In file included from /opt/homebrew/include/absl/log/internal/check_op.h:37: In file included from /opt/homebrew/include/absl/log/internal/strip.h:24: In file included from /opt/homebrew/include/absl/log/internal/log_message.h:41: In file included from /opt/homebrew/include/absl/log/log_entry.h:36: In file included from /opt/homebrew/include/absl/types/span.h:69: /opt/homebrew/include/absl/types/internal/span.h:133:27: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'? using EnableIfNotIsView = std::enable_if_t<!IsView::value, int>; ^~~~~ /opt/homebrew/include/absl/meta/type_traits.h:656:1: note: 'enable_if_t' declared here using enable_if_t = typename std::enable_if<B, T>::type; ^ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:132: In file included from /opt/homebrew/include/absl/log/absl_check.h:38: In file included from /opt/homebrew/include/absl/log/internal/check_impl.h:19: In file included from /opt/homebrew/include/absl/log/internal/check_op.h:37: In file included from /opt/homebrew/include/absl/log/internal/strip.h:24: In file included from /opt/homebrew/include/absl/log/internal/log_message.h:43: /opt/homebrew/include/absl/strings/internal/has_absl_stringify.h:46:8: error: no template named 'enable_if_t' in namespace 'std'; did you mean simply 'enable_if_t'? T, std::enable_if_t<std::is_void<decltype(AbslStringify( ^~~~~ /opt/homebrew/include/absl/meta/type_traits.h:656:1: note: 'enable_if_t' declared here using enable_if_t = typename std::enable_if<B, T>::type; ^ In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4: In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24: In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134: In file included from /opt/homebrew/include/absl/strings/cord.h:78: In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53: In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30: In file included from /opt/homebrew/include/absl/container/internal/compressed_tuple.h:40: /opt/homebrew/include/absl/utility/utility.h:164:12: error: no member named 'in_place_t' in namespace 'std' using std::in_place_t;


/opt/homebrew/include/absl/utility/utility.h:165:12: error: no member named 'in_place' in namespace 'std'
using std::in_place;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:181:12: error: no member named 'in_place_type' in namespace 'std'
using std::in_place_type;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:182:12: error: no member named 'in_place_type_t' in namespace 'std'
using std::in_place_type_t;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:198:12: error: no member named 'in_place_index' in namespace 'std'
using std::in_place_index;
      ~~~~~^
/opt/homebrew/include/absl/utility/utility.h:199:12: error: no member named 'in_place_index_t' in namespace 'std'
using std::in_place_index_t;
      ~~~~~^
In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4:
In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:78:
In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53:
In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30:
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:107:36: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr Storage(absl::in_place_t, V&& v)
                             ~~~~~~^
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:120:36: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr Storage(absl::in_place_t, V&& v)
                             ~~~~~~^
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:143:48: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
                                         ~~~~~~^
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:144:24: error: no member named 'in_place' in namespace 'absl'; did you mean 'isspace'?
      : Storage<Ts, I>(absl::in_place, absl::forward<Vs>(args))... {}
                       ^~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/_ctype.h:267:1: note: 'isspace' declared here
isspace(int _c)
^
In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.cc:4:
In file included from /Users/unicorn/workspace/onnx-mlir/build/third_party/onnx/onnx/onnx-ml.pb.h:24:
In file included from /opt/homebrew/include/google/protobuf/io/coded_stream.h:134:
In file included from /opt/homebrew/include/absl/strings/cord.h:78:
In file included from /opt/homebrew/include/absl/container/inlined_vector.h:53:
In file included from /opt/homebrew/include/absl/container/internal/inlined_vector.h:30:
/opt/homebrew/include/absl/container/internal/compressed_tuple.h:155:48: error: no type named 'in_place_t' in namespace 'absl'
  explicit constexpr CompressedTupleImpl(absl::in_place_t, Vs&&... args)
                                         ~~~~~~^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
ninja: build stopped: subcommand failed.
chentong319 commented 1 year ago

static_assert(PROTOBUF_CPLUSPLUS_MIN(201402L), "Protobuf only supports C++14 and newer.");

It seems that your c++ version is too old. onnx-mlir has set(CMAKE_CXX_STANDARD 17)

sorenlassen commented 1 year ago

I believe the problem is that you're using too new protobuf. We compile protobuf with c++11 so we cannot compile the newest protobuf. We build with the old protobuf 3.20.3, see: https://github.com/onnx/onnx-mlir/blob/main/docker/Dockerfile.llvm-project#L66

If you can't move to a lower version of protobuf on your system you can try to build protobuf from source, like it's done in that docker file. (If you're on MacOS you need to do a few things different. And if you have a Mac with M1 or M2 chip, then you need to apply a this patch to 3.20.3.)

AlexandreEichenberger commented 1 year ago

@wm901115nwpu let us know the suggestions above worked for you, tx

wm901115nwpu commented 1 year ago

it works thank you; I forget to reply