osinstom / P4-OvS

Bringing the power of P4 to OvS!
Apache License 2.0
73 stars 15 forks source link

Error when compiling #4

Open vetletm opened 3 years ago

vetletm commented 3 years ago

When running sudo make (without sudo it fails due to permissions) after boot.sh and configure, it throws the following error:

p4rt/.libs/libp4rt.a(p4rt_libp4rt_la-p4rt.o): In function `p4rt_initialize_datapath':
/home/vetletm/P4-OvS/p4rt/p4rt.c:611: undefined reference to `PIGrpcServerPipelineConfigSet'
collect2: error: ld returned 1 exit status
Makefile:3841: recipe for target 'vswitchd/ovs-vswitchd' failed
make[2]: *** [vswitchd/ovs-vswitchd] Error 1
make[2]: Leaving directory '/home/vetletm/P4-OvS'
Makefile:5238: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/vetletm/P4-OvS'
Makefile:2887: recipe for target 'all' failed
make: *** [all] Error 2

The system is a fresh virtual machine in VirtualBox with Ubuntu 18.04.5 with linux kernel 4.15.0-126-generic.

P4, PI, gRPC, Protobuf were all installed using the installation script install-p4dev-v2.sh from jafingerhut/p4-guide as explained in its installation guide.

I get the same error with and without OpenVSwitch installed on the system.

osinstom commented 3 years ago

Hi! You need to install my fork of the PI library: https://github.com/osinstom/PI/tree/p4-ovs. I've added PIGrpcServerPipelineConfigSet there, which is required for P4-OvS.

osinstom commented 3 years ago

BTW, you should be able to run make without sudo

vetletm commented 3 years ago

I started with a new, fresh machine and installed your fork of PI, still I get the same error.

gRPC is installed with version tags/v1.17.2, protobuf is at v3.6.1 as suggested in the PI documentation.

osinstom commented 3 years ago

@vetletm Did you use p4-ovs branch of my PI fork?

vetletm commented 3 years ago

I've included what we had to do on a fresh Ubuntu 20.10 to make it build without any major issues:

apt-get update

sudo apt-get install -y automake cmake libjudy-dev libgmp-dev libpcap-dev libboost-all-dev libevent-dev libtool flex bison pkg-config g++ libssl-dev libnanomsg-dev libjudy-dev libreadline-dev valgrind libtool-bin libboost-dev libboost-system-dev libboost-thread-dev

sudo apt-get install -y python3-pip python3-dev
sudo pip3 install nnpy

# == Thrift ==
cd "$BASE_DIR"
git clone https://github.com/apache/thrift
cd thrift
git checkout v0.13.0
./bootstrap.sh
./configure --prefix=/usr
make
sudo make install

# == PI ==
sudo apt install -y libnanomsg-dev \
   libprotobuf-dev protobuf-compiler protobuf-compiler-grpc \
   libgrpc++-dev libgrpc-dev libgc-dev

cd "$BASE_DIR"
git clone https://github.com/osinstom/PI   # *NOT* upstream: https://github.com/p4lang/PI
cd PI
git checkout p4-ovs
git submodule update --init
./autogen.sh
./configure --prefix=/usr --with-proto --with-fe-cpp --with-cli --with-internal-rpc --with-gnu-ld
make
sudo make install

# == P4-OvS ==
cd "$BASE_DIR"
git clone https://github.com/simula/P4-OvS
cd P4-OvS
git remote add upstream https://github.com/osinstom/P4-OvS.git
git checkout dreibh/build-fix-16Dec2020
./boot.sh
./configure
make

Apparently there were some missing pieces in the automake for ovs-vswitchd, you can see exactly what here: https://github.com/simula/P4-OvS/commit/fab148783180706944b6ca7e09f4bca59070e8fa

osinstom commented 3 years ago

I'm happy that you succeeded to install P4-OVS! Would you mind to create PR with the above modifications to vswitchd/automake.mk ?

vetletm commented 3 years ago

Hi, sorry for the late response.

I've been waiting for a response from the person who did the actual legwork, but since I've yet to hear anything I'll create a PR by the end of this week.

fatihusta commented 3 years ago

Hi, First of all Thank you for your effort for this project. I'm testing p4-ovs on my lab. I'm using ubuntu20.04 vm in proxmox.

I saw the same problem above and fixed it like here. After; I compiled many dependencies. (that was so painful :) ) I started the ovs-vswitchd, but that waiting something,

2021-01-27T11:31:28Z|00001|vlog|INFO|opened log file /var/log/openvswitch/ovs-vswitchd.log
2021-01-27T11:31:28Z|00002|ovs_numa|INFO|Discovered 3 CPU cores on NUMA node 0
2021-01-27T11:31:28Z|00003|ovs_numa|INFO|Discovered 3 CPU cores on NUMA node 1
2021-01-27T11:31:28Z|00004|ovs_numa|INFO|Discovered 2 NUMA nodes and 6 CPU cores
2021-01-27T11:31:28Z|00005|reconnect|INFO|unix:/usr/local/var/run/openvswitch/db.sock: connecting...
2021-01-27T11:31:28Z|00006|reconnect|INFO|unix:/usr/local/var/run/openvswitch/db.sock: connected

CTRL + C

^CServer listening on 0.0.0.0:50051
2021-01-27T11:31:45Z|00007|bridge|INFO|Setting P4 support for bridge br0
2021-01-27T11:31:45Z|00001|fatal_signal(ipf_clean1)|WARN|terminating with signal 2 (Interrupt)

I restarted the OVS with strace. And I saw this trace line.

connect(16, {sa_family=AF_UNIX, sun_path="/tmp/pi_rpc.ipc"}, 110) = -1 ENOENT (No such file or directory)

How can I pass this step?