博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
P4 前端编译器p4c-bm、后端编译器bmv2命令安装 make error问题
阅读量:5952 次
发布时间:2019-06-19

本文共 8159 字,大约阅读时间需要 27 分钟。

参考:

安装p4c-bm:

sudo pip install -r requirements.txtsudo pip install -r requirements_v1_1.txt //if you are interested in compiling P4 v1.1 programssudo python setup.py install

测试:

p4c-bmv2 -h

弹出相关信息:

usage: p4c-bmv2 [-h] [--json JSON] [--pd PD] [--pd-from-json]                [--p4-prefix P4_PREFIX] [--field-aliases FIELD_ALIASES]                [--p4-v1.1] [--version] [--primitives PRIMITIVES]                [--plugin PLUGIN_LIST]                [--openflow-mapping-dir OPENFLOW_MAPPING_DIR]                [--openflow-mapping-mod OPENFLOW_MAPPING_MOD] [--keep-pragmas]                sourcep4c-bm argumentspositional arguments:  source                A source file to include in the P4 program.optional arguments:  -h, --help            show this help message and exit  --json JSON           Dump the JSON representation to this file.  --pd PD               Generate PD C/C++ code for this P4 program in this                        directory. Directory must exist.  --pd-from-json        Generate PD from a JSON file, not a P4 file  --p4-prefix P4_PREFIX                        P4 name use for API function prefix  --field-aliases FIELD_ALIASES                        Path to file containing field aliases. In this file,                        each line contains a mapping with this format:                        "
" --p4-v1.1 Run the compiler on a p4 v1.1 program --version, -v show program's version number and exit --primitives PRIMITIVES A JSON file which contains additional primitive declarations --plugin PLUGIN_LIST list of plugins to generate templates --openflow-mapping-dir OPENFLOW_MAPPING_DIR Directory of openflow mapping files --openflow-mapping-mod OPENFLOW_MAPPING_MOD Openflow mapping module name -- not a file name --keep-pragmas Propagate pragmas to JSON file when applicable

安装bmv2:

要求:

On Ubuntu 14.04, the following packages are required:    automake    cmake    libjudy-dev    libgmp-dev    libpcap-dev    libboost-dev    libboost-test-dev    libboost-program-options-dev    libboost-system-dev    libboost-filesystem-dev    libboost-thread-dev    libevent-dev    libtool    flex    bison    pkg-config    g++    libssl-dev

以及中的一些工具,如thrift等,说的很详细了。

下载bmv2:

git clone https://github.com/p4lang/behavioral-model.git bmv2

安装依赖:

sh install_deps.sh

测试:

1. ./autogen.sh2. ./configure3. make4. [sudo] make install  # if you need to install bmv2

make成功是这样子的:

Making all in testsmake[5]: Entering directory `/home/wasdns/bmv2/targets/simple_switch/tests'Making all in .make[6]: Entering directory `/home/wasdns/bmv2/targets/simple_switch/tests'make[6]: Nothing to be done for `all-am'.make[6]: Leaving directory `/home/wasdns/bmv2/targets/simple_switch/tests'Making all in CLI_testsmake[6]: Entering directory `/home/wasdns/bmv2/targets/simple_switch/tests/CLI_tests'make[6]: Nothing to be done for `all'.make[6]: Leaving directory `/home/wasdns/bmv2/targets/simple_switch/tests/CLI_tests'make[5]: Leaving directory `/home/wasdns/bmv2/targets/simple_switch/tests'make[4]: Leaving directory `/home/wasdns/bmv2/targets/simple_switch'make[3]: Leaving directory `/home/wasdns/bmv2/targets/simple_switch'make[3]: Entering directory `/home/wasdns/bmv2/targets'make[3]: Nothing to be done for `all-am'.make[3]: Leaving directory `/home/wasdns/bmv2/targets'make[2]: Leaving directory `/home/wasdns/bmv2/targets'Making all in toolsmake[2]: Entering directory `/home/wasdns/bmv2/tools'rm -f bm_p4dbg bm_p4dbg.tmpsed -e 's|@pythondir[@]|/usr/local/lib/python2.7/dist-packages|g' ./bm_p4dbg.in >bm_p4dbg.tmpchmod +x bm_p4dbg.tmpchmod a-w bm_p4dbg.tmpmv bm_p4dbg.tmp bm_p4dbgrm -f bm_CLI bm_CLI.tmpsed -e 's|@pythondir[@]|/usr/local/lib/python2.7/dist-packages|g' ./bm_CLI.in >bm_CLI.tmpchmod +x bm_CLI.tmpchmod a-w bm_CLI.tmpmv bm_CLI.tmp bm_CLIrm -f bm_nanomsg_events bm_nanomsg_events.tmpsed -e 's|@pythondir[@]|/usr/local/lib/python2.7/dist-packages|g' ./bm_nanomsg_events.in >bm_nanomsg_events.tmpchmod +x bm_nanomsg_events.tmpchmod a-w bm_nanomsg_events.tmpmv bm_nanomsg_events.tmp bm_nanomsg_eventsmake[2]: Leaving directory `/home/wasdns/bmv2/tools'make[2]: Entering directory `/home/wasdns/bmv2'make[2]: Leaving directory `/home/wasdns/bmv2'make[1]: Leaving directory `/home/wasdns/bmv2'

当make不成功的时候,一般是报.lo的错误,比如:

g++: internal compiler error: Killed (program cc1plus)Please submit a full bug report,with preprocessed source if appropriate.See 
for instructions.make[3]: *** [packet.lo] Error 1make[3]: Leaving directory `/home/wasdns/behavioral-model/src/bm_sim'make[2]: *** [all-recursive] Error 1make[2]: Leaving directory `/home/wasdns/behavioral-model/src'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/home/wasdns/behavioral-model'make: *** [all] Error 2

我的解决方法是,执行:

./configure 'CXXFLAGS=-O0 -g'

进入debug模式,github是这样描述的:

In 'debug mode', you probably want to disable compiler optimization and enable symbols in the binary

之后,跑样例:

make check

注意,如果出现有关nanomsg的问题,需要在命令前加上sudo。

我的结果:

make  check-TESTSmake[3]: Entering directory `/home/wasdns/bmv2/tests'make[4]: Entering directory `/home/wasdns/bmv2/tests'PASS: test_actionsPASS: test_checksumsPASS: test_expressionsPASS: test_conditionalsPASS: test_dataPASS: test_handle_mgrPASS: test_p4objectsPASS: test_parserPASS: test_phvPASS: test_queuePASS: test_queueingPASS: test_tablesPASS: test_learningPASS: test_prePASS: test_calculationsPASS: test_header_stacksPASS: test_metersPASS: test_ageingPASS: test_countersPASS: test_pcapPASS: test_fieldsPASS: test_devmgrPASS: test_packetPASS: test_extern../test-driver: line 107: 56596 Aborted                 (core dumped) "$@" > $log_file 2>&1FAIL: test_switchPASS: test_target_parserPASS: test_runtime_ifacePASS: test_bm_appsPASS: test_statefulmake[5]: Entering directory `/home/wasdns/bmv2/tests'Making all in .make[6]: Entering directory `/home/wasdns/bmv2/tests'make[6]: Nothing to be done for `all-am'.make[6]: Leaving directory `/home/wasdns/bmv2/tests'make[5]: Leaving directory `/home/wasdns/bmv2/tests'============================================================================Testsuite summary for bm 1.4.0-84ed92dd============================================================================# TOTAL: 29# PASS:  28# SKIP:  0# XFAIL: 0# FAIL:  1# XPASS: 0# ERROR: 0============================================================================See tests/test-suite.logPlease report to antonin@barefootnetworks.com============================================================================make[4]: *** [test-suite.log] Error 1make[4]: Leaving directory `/home/wasdns/bmv2/tests'make[3]: *** [check-TESTS] Error 2make[3]: Leaving directory `/home/wasdns/bmv2/tests'make[2]: *** [check-am] Error 2make[2]: Leaving directory `/home/wasdns/bmv2/tests'make[1]: *** [check-recursive] Error 1make[1]: Leaving directory `/home/wasdns/bmv2/tests'make: *** [check-recursive] Error 1

还是出现了一个Error,查看日志信息:

cd testsvim test-suite.log

日志如下:

=============================================   bm 1.4.0-84ed92dd: tests/test-suite.log=============================================# TOTAL: 29# PASS:  28# SKIP:  0# XFAIL: 0# FAIL:  1# XPASS: 0# ERROR: 0.. contents:: :depth: 2FAIL: test_switch=================[==========] Running 9 tests from 1 test case.[----------] Global test environment set-up.[----------] 9 tests from Switch[ RUN      ] Switch.GetConfig[       OK ] Switch.GetConfig (13 ms)[ RUN      ] Switch.ConfigOptions[       OK ] Switch.ConfigOptions (3 ms)[ RUN      ] Switch.GetP4Objects[       OK ] Switch.GetP4Objects (14 ms)[ RUN      ] Switch.SerializeState1[       OK ] Switch.SerializeState1 (7 ms)[ RUN      ] Switch.SerializeState2Traceback (most recent call last):  File "../tools/runtime_CLI.py", line 30, in 
import bmpy_utils as utils File "/home/wasdns/bmv2/tools/bmpy_utils.py", line 26, in
from thrift import ThriftImportError: No module named thriftlt-test_switch: utils.cpp:55: CLIWrapperImp::~CLIWrapperImp(): Assertion `pclose(CLI_f) == 0' failed.Thrift server was started

应该是thrift的问题,该问题还在解决中。

2016/12/17

转载地址:http://husxx.baihongyu.com/

你可能感兴趣的文章
clamav 完整查杀 linux 病毒实战
查看>>
我的友情链接
查看>>
EIGRP的Metric计算以及负载均衡
查看>>
org-capture 配置
查看>>
linux下lvs搭建负载均衡集群
查看>>
JMS 实例讲解
查看>>
求教:如何成为一个优秀的项目经理人
查看>>
shell 脚本--备份、还原mysql数据库
查看>>
JS脚本静态变量调用方法
查看>>
linux中cacti和nagios整合
查看>>
新调查结果表明:NoSQL采用呈上升趋势
查看>>
ASP.NET MVC测试方法与实战技巧
查看>>
Mysql慢查询
查看>>
传统线程机制之定时器的应用(TIMER,TIMERTASK)
查看>>
org.apache.hadoop.hive.contrib.serde2.RegexSerDe not found
查看>>
citrix客户端的配置和访问(六)
查看>>
Linux下搭建Ionic框架
查看>>
移动支付的基本要素
查看>>
云计算:大数据时代的系统工程(二)
查看>>
Hadoop、Spark、HBase与Redis的适用性讨论(二):HBase
查看>>