p4lang / p4c-bm

Generates the JSON configuration for the behavioral-model (bmv2), as well as the C/C++ PD code
Apache License 2.0
24 stars 29 forks source link

python setup.py install error #96

Closed shahzad46 closed 6 years ago

shahzad46 commented 6 years ago

Hello guys, i am new to python and git bash as well. trying to run this command "python setup.py install" on git bash but getting the following error image HELP!!!

antoninbas commented 6 years ago

I cannot provide help with this issue as it is likely to be connected to the fact that you are using a Windows environment, about which I am completely ignorant. If you plan on using P4.org software I strongly recommend that you use at the very least a Unix system, and preferably Ubuntu 16.04. Otherwise, even if you figure out this issue, you are likely to run into many others down the line.

shahzad46 commented 6 years ago

Thanx for the reply. Just started working on Ubuntu as a VM.... All looks good. I may contact back if got stuck again...

shahzad46 commented 6 years ago

Hello antoninbas, I have install ubuntu as you suggested. now the thing is i am totally new to ubuntu. can you please guide me how to set up the environment for P4. I only need to run a sample program using P4 compiler. there are many readme files here. its very confusing where to start, what to install 1st.

jafingerhut commented 6 years ago

Note: The steps below will not install p4c-bm at all, instead installing a more recently developed P4 compiler called p4c. Not sure if that necessarily will meet your needs, but wanted to point out the instructions in case they are helpful for you.

If you have ubuntu 16.04 or later, try these commands:

sudo apt install git
git clone https://github.com/jafingerhut/p4-guide
./p4-guide/bin/install-p4dev.sh

The first command will ask you for your password, because it needs admin privileges to install software in system-wide directories. The last command is a bash shell script that will use git to clone several p4lang repositories from Github, and run the commands necessary to build them. It only installs the behavioral-model repository (i.e. the simple_switch executable), and the P4 compiler. You can look at the commands in that script, which is a plain text file, if you want to know what it is doing, and even copy those commands one at a time into a command window if you prefer.

It will take about an hour, if you have a reasonable speed Internet connection, to download the code and compile them. You will need about 4 Gbytes of free disk space in your Ubuntu virtual machine's disk space, but more is useful to have space left over after the installation. It may also ask you for your password multiple times, also because some of the steps install software in system-wide directories.

The home page of that p4-guide repository has links to some small demo P4_14 and P4_16 programs, and steps you can follow to compile and run them, use a simple CLI program to install table entries, use Scapy to send packets to the simulated switch, and tcpdump or other utilities to see any packets that come out

https://github.com/jafingerhut/p4-guide

shahzad46 commented 6 years ago

thank you Andy, this helps a lot.