搭建P4编译环境
现有的一些教程基本都是在Ubuntu16等旧版本上的,照着原有的教程在Ubuntu20及以后的版本中会有较多的错误,本文记录一下艰苦的搭环境过程,笔者使用的系统为Ubuntu20.04,强烈建议多参考GitHub中提供的官方文档。
https://github.com/p4lang
本文也参考了
https://github.com/10249421/p4_code_learn/blob/main/p4-user-bootstrap.sh
更新:建议看这个,吗的比我自己写的好用多了
https://gitee.com/poohdang/p4-env
P4C安装
. /etc/os-release
echo "deb http://download.opensuse.org/repositories/home:/p4lang/xUbuntu_${VERSION_ID}/ /" | sudo tee /etc/apt/sources.list.d/home:p4lang.list
sudo apt install curl
curl -L "http://download.opensuse.org/repositories/home:/p4lang/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add -
sudo apt-get update
sudo apt install p4lang-p4c
bmv2安装
sudo apt-get install -y automake cmake libgmp-dev \
libpcap-dev libboost-dev libboost-test-dev libboost-program-options-dev