系统要求
Ubuntu 14.04, 64bit
依赖安装
sudo apt-get install g++ git automake libtool libgc-dev bison flex libfl-dev libgmp-dev libboost-dev libboost-iostreams-dev pkg-config python python-scapy python-ipaddr tcpdump
Documentation building:
sudo apt-get install -y doxygen graphviz texlive-full
Ubuntu 14.04下安装Protocol Buffers
依赖安装
$ sudo apt-get install autoconf automake libtool curl make g++ unzip
Install Protobuf
$ ./autogen.sh
$ ./configure
$ make
$ make check
Testsuite summary for Protocol Buffers 3.3.0
# TOTAL: 7
# PASS: 7
# SKIP: 0
# XFAIL: 0
# FAIL: 0
# XPASS: 0
# ERROR: 0
$ sudo make install
$ sudo ldconfig
# refresh shared library cache.
# refresh shared library cache.
p4c
$ git clone --recursive https://github.com/p4lang/p4c.git
$ ./bootstrap.sh
$ cd build
$ make -j4
$ make check -j4
HINT:
1.在执行./bootstrap.sh时遇到gcc版本过低问题:
checking if compiler is new enough... no
configure: error: compiler is too old; GCC 4.9 or later and Clang 3.3 or later are supported
解决方法:Ubuntu 14.04 更新gcc版本至4.9.2(http://www.linuxdiyf.com/linux/20175.html)
2.在执行make -j4的时候遇到gcc编译器内联错误("make -j4" failed in the dir p4c/build)
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
make[1]: *** [unified-sources-p4c_bm2_ss-0.o] Error 4
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/wasdns/p4c/build'
make: *** [all] Error 2
原因:内存不足。
解决方法:将命令替换为
$ make -j2
3.执行make check的时候,会有大量的test failed,大多数是P4 14的test,目前尚未解决这个问题: