p4lang / p4c

P4_16 reference compiler
https://p4.org/
Apache License 2.0
680 stars 444 forks source link

Running Make command for p4c following error comes #4085

Closed sanjayjuneja closed 1 year ago

sanjayjuneja commented 1 year ago

grpc@ubuntu:~/p4c/build$ make [ 53%] Built target update_includes [ 53%] Built target linkgraphs [ 53%] Built target linkbmv2 [ 53%] Built target linkp4cebpf [ 53%] Built target linkp4test [ 53%] Built target p4c_driver [ 53%] Built target p4ctoolkit [ 53%] Built target irgenerator [ 53%] Built target genIR [ 53%] Built target ir [ 53%] Built target mkp4dirs [ 53%] Built target mkv1dirs [ 53%] Built target frontend [ 53%] Built target midend [ 53%] Built target mkP4configdir [ 53%] Building CXX object control-plane/CMakeFiles/controlplane.dir/google/rpc/status.pb.cc.o clang: warning: argument unused during compilation: '-fuse-ld=gold' [-Wunused-command-line-argument] In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4: In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:11: /usr/local/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 /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4: In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24: In file included from /usr/local/include/google/protobuf/io/coded_stream.h:130: In file included from /usr/local/include/google/protobuf/stubs/common.h:44: In file included from /usr/local/include/absl/strings/string_view.h:39: In file included from /usr/local/include/absl/base/attributes.h:37: In file included from /usr/local/include/absl/base/config.h:86: /usr/local/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 /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4: In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24: In file included from /usr/local/include/google/protobuf/io/coded_stream.h:130: In file included from /usr/local/include/google/protobuf/stubs/common.h:44: /usr/local/include/absl/strings/string_view.h:340:10: error: cannot assign to non-static data member within const member function 'removeprefix' ptr += n;


/usr/local/include/absl/strings/string_view.h:338:18: note: member function 'absl::lts_20230125::string_view::remove_prefix' is declared const here
  constexpr void remove_prefix(size_type n) {
  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/absl/strings/string_view.h:341:13: error: cannot assign to non-static data member within const member function 'remove_prefix'
    length_ -= n;
    ~~~~~~~ ^
/usr/local/include/absl/strings/string_view.h:338:18: note: member function 'absl::lts_20230125::string_view::remove_prefix' is declared const here
  constexpr void remove_prefix(size_type n) {
  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/absl/strings/string_view.h:338:18: error: constexpr function's return type 'void' is not a literal type
  constexpr void remove_prefix(size_type n) {
                 ^
/usr/local/include/absl/strings/string_view.h:350:13: error: cannot assign to non-static data member within const member function 'remove_suffix'
    length_ -= n;
    ~~~~~~~ ^
/usr/local/include/absl/strings/string_view.h:348:18: note: member function 'absl::lts_20230125::string_view::remove_suffix' is declared const here
  constexpr void remove_suffix(size_type n) {
  ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/absl/strings/string_view.h:348:18: error: constexpr function's return type 'void' is not a literal type
  constexpr void remove_suffix(size_type n) {
                 ^
/usr/local/include/absl/strings/string_view.h:358:11: error: no viable overloaded '='
    *this = s;
    ~~~~~ ^ ~
/usr/local/include/absl/strings/string_view.h:161:7: note: candidate function (the implicit copy assignment operator) not viable: 'this' argument has type 'const absl::lts_20230125::string_view', but method is not marked const
class string_view {
      ^
/usr/local/include/absl/strings/string_view.h:161:7: note: candidate function (the implicit move assignment operator) not viable: 'this' argument has type 'const absl::lts_20230125::string_view', but method is not marked const
/usr/local/include/absl/strings/string_view.h:356:18: error: constexpr function's return type 'void' is not a literal type
  constexpr void swap(string_view& s) noexcept {
                 ^
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:130:
In file included from /usr/local/include/google/protobuf/stubs/common.h:46:
In file included from /usr/local/include/google/protobuf/stubs/port.h:45:
/usr/local/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 /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:130:
In file included from /usr/local/include/google/protobuf/stubs/common.h:56:
/usr/local/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 /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:132:
In file included from /usr/local/include/absl/log/absl_check.h:38:
In file included from /usr/local/include/absl/log/internal/check_impl.h:19:
In file included from /usr/local/include/absl/log/internal/check_op.h:37:
In file included from /usr/local/include/absl/log/internal/strip.h:24:
In file included from /usr/local/include/absl/log/internal/log_message.h:41:
In file included from /usr/local/include/absl/log/log_entry.h:36:
In file included from /usr/local/include/absl/types/span.h:69:
/usr/local/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<T>;
                    ^~~~~
/usr/local/include/absl/meta/type_traits.h:592:1: note: 'remove_const_t' declared here
using remove_const_t = typename std::remove_const<T>::type;
^
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:132:
In file included from /usr/local/include/absl/log/absl_check.h:38:
In file included from /usr/local/include/absl/log/internal/check_impl.h:19:
In file included from /usr/local/include/absl/log/internal/check_op.h:37:
In file included from /usr/local/include/absl/log/internal/strip.h:24:
In file included from /usr/local/include/absl/log/internal/log_message.h:41:
In file included from /usr/local/include/absl/log/log_entry.h:36:
In file included from /usr/local/include/absl/types/span.h:69:
/usr/local/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<T>::value, int>;
                       ^~~~~
/usr/local/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 /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:132:
In file included from /usr/local/include/absl/log/absl_check.h:38:
In file included from /usr/local/include/absl/log/internal/check_impl.h:19:
In file included from /usr/local/include/absl/log/internal/check_op.h:37:
In file included from /usr/local/include/absl/log/internal/strip.h:24:
In file included from /usr/local/include/absl/log/internal/log_message.h:41:
In file included from /usr/local/include/absl/log/log_entry.h:36:
In file included from /usr/local/include/absl/types/span.h:69:
/usr/local/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<T>::value, int>;
                          ^~~~~
/usr/local/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 /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:132:
In file included from /usr/local/include/absl/log/absl_check.h:38:
In file included from /usr/local/include/absl/log/internal/check_impl.h:19:
In file included from /usr/local/include/absl/log/internal/check_op.h:37:
In file included from /usr/local/include/absl/log/internal/strip.h:24:
In file included from /usr/local/include/absl/log/internal/log_message.h:43:
/usr/local/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(
       ^~~~~
/usr/local/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 /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:134:
In file included from /usr/local/include/absl/strings/cord.h:78:
In file included from /usr/local/include/absl/container/inlined_vector.h:53:
In file included from /usr/local/include/absl/container/internal/inlined_vector.h:31:
/usr/local/include/absl/memory/memory.h:97:12: error: no member named 'make_unique' in namespace 'std'
using std::make_unique;
      ~~~~~^
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.cc:4:
In file included from /home/grpc/p4c/build/control-plane/google/rpc/status.pb.h:24:
In file included from /usr/local/include/google/protobuf/io/coded_stream.h:134:
In file included from /usr/local/include/absl/strings/cord.h:82:
In file included from /usr/local/include/absl/strings/cord_analysis.h:22:
/usr/local/include/absl/strings/internal/cord_internal.h:717:20: error: an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers
    constexpr Rep& operator=(const Rep&) = default;
                   ^
/usr/local/include/absl/strings/internal/cord_internal.h:866:32: error: defaulting this copy assignment operator would delete it after its first declaration
inline InlineData& InlineData::operator=(const InlineData&) noexcept = default;
                               ^
/usr/local/include/absl/strings/internal/cord_internal.h:817:7: note: copy assignment operator of 'InlineData' is implicitly deleted because field 'rep_' has no copy assignment operator
  Rep rep_;
      ^
/usr/local/include/absl/strings/internal/cord_internal.h:868:28: error: constexpr function's return type 'void' is not a literal type
constexpr void InlineData::poison_this() {}
                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [control-plane/CMakeFiles/controlplane.dir/build.make:98: control-plane/CMakeFiles/controlplane.dir/google/rpc/status.pb.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1290: control-plane/CMakeFiles/controlplane.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Following  step from link

https://a-dying-pig.github.io/p4Installation.github.io/

git clone https://github.com/p4lang/p4c.git
cd p4c
git checkout 69e132d0d663e3408d740aaf8ed534ecefc88810
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make
make check
sudo make install
sudo ldconfig
cd ../..

GCC compiler updated.
Ubuntu 20.04

 I am new  to github kindly  help
fruffy commented 1 year ago

This install guide is quite out of date, I would recommend following the guides in this repository:

https://github.com/jafingerhut/p4-guide/blob/master/bin/README-install-troubleshooting.md

Instead of git checkout 69e132d0d663e3408d740aaf8ed534ecefc88810 try git checkout 6756816100b7c51e3bf717ec55114a8e8575ba1d