[P4-dev] Switch.p4 compilation

hemant at mnkcg.com hemant at mnkcg.com
Fri Feb 1 10:53:50 EST 2019

I would just use p4c and its p4c-bm2-ss  which works to compile any code for the bmv2 backend.   Just use P4-16 P4 programs unless you have a specific P4-14 program to use.  


If you don’t mind, just purge all download and installs below and use Andy Fingerhut’s script to install p4c and the behavioral-model.  Both suffice to work with P4.




The script has been tested on Ubuntu 16.04 and 18.04.




From: P4-dev <p4-dev-bounces at lists.p4.org> On Behalf Of Frédéric LOUI
Sent: Friday, February 01, 2019 5:13 AM
To: p4-dev at lists.p4.org
Subject: [P4-dev] Switch.p4 compilation


Hi !


I’m fairly new to p4 language so sorry if I could not find the complete answer using my Google-fu skills …


I studied various tutorial and manage to have the examples working.

As an exercise, I would like to study switch.p4 reference program.


As a first step I’d like to compile and run switch.p4 reference here: https://github.com/p4lang/switch


The problem is that in my environment I installed:


* p4c able to compile p4_14 and p4_16

* p4c-bm2-ss for simple_switch target


In switch.p4 it is referenced that I should use:p4c-bmv2 that can be found here: https://github.com/p4lang/p4c-bm

In some thread I saw that p4-bmv2 is the official.  Compiler for p4_14.


So my question: can I use the more versatile p4c instead of p4-bmv2 in order to compile switch.p4 ?

Or should I try to user p4c-bm-ss ? (Not sure if simple_switch target can be use the full fledge switch.p4 reference though :-) ) 


In that case, I’ll consider to install also p4c-bmv2 via https://github.com/p4lang/p4c-bm


Last question:


Is p4c-bm (for p4_14 program) can coexist in the same machine as p4c or should I take some precaution while installing both on the same machine ?


Again sorry if these are « simple » question. If the issue has been discussed many times before I’d like to get a referent link or doc.



Thanks for your help !


All the best

--  Frederic




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20190201/22dbbfa2/attachment.html>

More information about the P4-dev mailing list