p4lang / p4c

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

Error trying to compile 2024-sep-14 p4c source on Ubuntu Linux #4912

Closed jafingerhut closed 2 months ago

jafingerhut commented 2 months ago

So far I have only seen this error with Ubuntu 24.04 Linux for aarch64 processor architecture, on an Apple Silicon M2 system running within VirtualBox. I am starting a build within Ubuntu 20.04 Linux for x86_64 processor arch on an Intel Apple system soon, and will add results from that when they are ready.

The error I see is:

In file included from /home/andy/p4c/test/gtest/flat_map.cpp:17:
/home/andy/p4c/lib/flat_map.h: In member function ‘P4::flat_map<K, V, Compare, Container>::mapped_type& P4::flat_map<K, V, Compare, Container>::at(const Key&)’:
/home/andy/p4c/lib/flat_map.h:103:40: error: ‘out_of_range’ is not a member of ‘std’
  103 |         if (found == end()) throw std::out_of_range("key is out of range");
      |                                        ^~~~~~~~~~~~
/home/andy/p4c/lib/flat_map.h:19:1: note: ‘std::out_of_range’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
   18 | #include <functional>
  +++ |+#include <stdexcept>
   19 | #include <vector>
/home/andy/p4c/lib/flat_map.h: In member function ‘const P4::flat_map<K, V, Compare, Container>::mapped_type& P4::flat_map<K, V, Compare, Container>::at(const Key&) const’:
/home/andy/p4c/lib/flat_map.h:109:40: error: ‘out_of_range’ is not a member of ‘std’
  109 |         if (found == end()) throw std::out_of_range("key is out of range");
      |                                        ^~~~~~~~~~~~
/home/andy/p4c/lib/flat_map.h:109:40: note: ‘std::out_of_range’ is defined in header ‘<stdexcept>’; did you forget to ‘#include <stdexcept>’?
make[2]: *** [test/CMakeFiles/gtestp4c.dir/build.make:300: test/CMakeFiles/gtestp4c.dir/gtest/flat_map.cpp.o] Error 1

I am using this version of the p4c source:

$ git log -n 1 | head -n 3
commit 9e77cde6203fb32f734826b17fee3f5034749aaa
Author: Kyle Cripps <60898032+kfcripps@users.noreply.github.com>
Date:   Thu Sep 12 05:41:14 2024 -0700

Summary of results:

I have attached a log file for the Ubuntu 24.04 aarch64 attempted build of p4c, including output from the cmake command, in case that contains any useful details about versions of other things that are installed. Let me know if you want the output of any other commands executed on that system. log-p4c-ubuntu24.04-aarch64-v8.txt

ChrisDodd commented 2 months ago

There's a missing #include <stdexcept> needed in lib/flat_map.h

asl commented 2 months ago

Yeah, will submit a fix shortly