Newbie running error

After I downloaded the P4 environment using P4util, I ran the basic_tunnel project on GitHub, but an error appeared as shown in the figure below. How should I solve it?

When you say “using P4util”, do you mean you are using this repository? GitHub - nsg-ethz/p4-utils: Extension to Mininet that makes P4 networks easier to build

In any case, this repository GitHub - p4lang/tutorials: P4 language tutorials, which you appear to be using, was updated on 2024-Oct-15 to use the file name suffix .txtpb for P4Info files generated by p4c, as this was changed in p4c around 2023-Oct. Versions of p4c that are older than that give the error you show if you attempt to ask them to create P4Info files with that suffix. Versions of p4c newer than that will work correctly with either .txtpb or .txt suffixes for P4Info files, but will give a warning message if you use the older .txt suffix.

You have two alternatives that I can see. The first is probably a smaller quicker change from what you have now, but I am not certain of that.

(1) Revert to use an older version of the tutorials repo. If you change to the directory where your copy of the tutorials repository is, and you have not yet made any local changes to it, you can use this command to go back to the latest version of tutorials before it used the .txtpb suffix:

git checkout 50a65602686ec7f69a40dcf80b77534723d8c0ca

(2) You can try using the latest versions of the tutorials repo with a more recent version of p4c, and probably thus also more recent versinos of other open source P4 development tools. I suspect there might be other things in the P4util you are using that might need updating from 2 or so years ago, but I do not have a list of such things to give you that I have tested will work.

Thank you for your reply. I am a newbie learning P4 language. I found that I can run other projects except this one. I would like to ask if you have any suggestions for learning P4?

Well, one suggestion for learning P4 is just to try out existing exercises, as you appear to be doing, using a version of the open source P4 development tools that they have been tested with.

If you want to use the latest version of the tutorials repository GitHub - p4lang/tutorials: P4 language tutorials, then you should use a version of the open source P4 development tools they have been tested with, which you can install via the instructions in its top level README. I test this every month or so, so I know from personal experience that recent versions of both should be compatible.

If you want to use the GitHub - nsg-ethz/p4-utils: Extension to Mininet that makes P4 networks easier to build repository, which appears not to have been updated much in the last 2 years, it might be important to use a 2-year-old version of the open source P4 development tools (I have not tried the exercises in that repository myself, so cannot comment what versions it works with from my own personal experience).

One perhaps-nice first introduction to running a simple P4 program, annotated with lots of comments, and only using a single P4-programmable software switch rather than several, is to start with this demo program: p4-guide/demo1/README-p4runtime.md at master · jafingerhut/p4-guide · GitHub and read the version of the demo1 P4 program with lots of comments here: p4-guide/demo1/demo1-heavily-commented.p4_16.p4 at master · jafingerhut/p4-guide · GitHub

Another is to go through the exercises in the tutorials repository. These use the same open source behavioral-model software switch that the p4-guide demo1 example does, but they run more than one such switch at the same time, interconnected with virtual Ethernet links, so there is a bit more to the environment there than running a single P4-programmable switch. For example, debugging problems can require discovering which of several P4-programmable switches is the one that is behaving differently than you wish.

If you want to write P4 programs to run on a hardware target like an FPGA, or P4-programmable Ethernet switch or NIC, then my best advice is first to find a way to gain access to their development tools and documentation, and perhaps get training from someone knowledgeable about that particular hardware and development tools, as they can vary significantly from one device to another.