P4 前端编译器p4c-bm、后端编译器bmv2命令安装 make error问题
参考:Github
安装p4c-bm:
sudo pip install -r requirements.txt
sudo pip install -r requirements_v1_1.txt //if you are interested in compiling P4 v1.1 programs
sudo 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]
source
p4c-bm arguments
positional 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:
"<alias> <full name of field>"
--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
以及Github中的一些工具,如thrift等,说的很详细了。
下载bmv2:
git clone https://github.com/p4lang/behavioral-model.git bmv2
安装依赖:
sh install_deps.sh
测试:
1. ./autogen.sh
2. ./configure
3. make
4. [sudo] make install # if you need to install bmv2
make成功是这样子的:
Making all in tests
make[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_tests
make[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 tools
make[2]: Entering directory `/home/wasdns/bmv2/tools'
rm -f bm_p4dbg bm_p4dbg.tmp
sed -e 's|@pythondir[@]|/usr/local/lib/python2.7/dist-packages|g' ./bm_p4dbg.in >bm_p4dbg.tmp
chmod +x bm_p4dbg.tmp
chmod a-w bm_p4dbg.tmp
mv bm_p4dbg.tmp bm_p4dbg
rm -f bm_CLI bm_CLI.tmp
sed -e 's|@pythondir[@]|/usr/local/lib/python2.7/dist-packages|g' ./bm_CLI.in >bm_CLI.tmp
chmod +x bm_CLI.tmp
chmod a-w bm_CLI.tmp
mv bm_CLI.tmp bm_CLI
rm -f bm_nanomsg_events bm_nanomsg_events.tmp
sed -e 's|@pythondir[@]|/usr/local/lib/python2.7/dist-packages|g' ./bm_nanomsg_events.in >bm_nanomsg_events.tmp
chmod +x bm_nanomsg_events.tmp
chmod a-w bm_nanomsg_events.tmp
mv bm_nanomsg_events.tmp bm_nanomsg_events
make[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 <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
make[3]: *** [packet.lo] Error 1
make[3]: Leaving directory `/home/wasdns/behavioral-model/src/bm_sim'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/wasdns/behavioral-model/src'
make[1]: *** [all-recursive] Error 1
make[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-TESTS
make[3]: Entering directory `/home/wasdns/bmv2/tests'
make[4]: Entering directory `/home/wasdns/bmv2/tests'
PASS: test_actions
PASS: test_checksums
PASS: test_expressions
PASS: test_conditionals
PASS: test_data
PASS: test_handle_mgr
PASS: test_p4objects
PASS: test_parser
PASS: test_phv
PASS: test_queue
PASS: test_queueing
PASS: test_tables
PASS: test_learning
PASS: test_pre
PASS: test_calculations
PASS: test_header_stacks
PASS: test_meters
PASS: test_ageing
PASS: test_counters
PASS: test_pcap
PASS: test_fields
PASS: test_devmgr
PASS: test_packet
PASS: test_extern
../test-driver: line 107: 56596 Aborted (core dumped) "$@" > $log_file 2>&1
FAIL: test_switch
PASS: test_target_parser
PASS: test_runtime_iface
PASS: test_bm_apps
PASS: test_stateful
make[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.log
Please report to antonin@barefootnetworks.com
============================================================================
make[4]: *** [test-suite.log] Error 1
make[4]: Leaving directory `/home/wasdns/bmv2/tests'
make[3]: *** [check-TESTS] Error 2
make[3]: Leaving directory `/home/wasdns/bmv2/tests'
make[2]: *** [check-am] Error 2
make[2]: Leaving directory `/home/wasdns/bmv2/tests'
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory `/home/wasdns/bmv2/tests'
make: *** [check-recursive] Error 1
还是出现了一个Error,查看日志信息:
cd tests
vim 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: 2
FAIL: 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.SerializeState2
Traceback (most recent call last):
File "../tools/runtime_CLI.py", line 30, in <module>
import bmpy_utils as utils
File "/home/wasdns/bmv2/tools/bmpy_utils.py", line 26, in <module>
from thrift import Thrift
ImportError: No module named thrift
lt-test_switch: utils.cpp:55: CLIWrapperImp::~CLIWrapperImp(): Assertion `pclose(CLI_f) == 0' failed.
Thrift server was started
应该是thrift的问题,该问题还在解决中。
2016/12/17
P4 前端编译器p4c-bm、后端编译器bmv2命令安装 make error问题的更多相关文章
- P4语言环境安装(一)前端编译器p4c、后端编译器p4c-bm2-ss
这个P4安装环境是在2020-2-8安装的,安装环境卡了我好几天,把遇到的问题记录下来,有需要的同学可以参考一下,要是说错了或者有问题的话,评论或mail:guidoahead@163.com联系我都 ...
- 【旧版本】Ubuntu 14.04 下 P416编译器 p4c的安装
注:此为2017年5月份的安装方法,最新的p4c安装方法见: Ubuntu14.04下 安装p4c 参考: p4c README Ubuntu 14.04 下 P4v16编译器 p4c的安装 系统要求 ...
- GCC编译器原理(一)------交叉编译器制作和GCC组件及命令
1.1 交叉编译器制作 默认安装的 GCC 编译系统所产生的代码适用于本机,即运行 GCC 的机器,但也可将 GCC 安装成能够生成其他的机器代码.安装一些必须的模块,就可产生多种目标机器代码,而且可 ...
- RSA加密前端JS加密,后端asp.net解密,报异常
RSA加密前端JS加密,后端asp.net解密,报异常 参考引用:http://www.ohdave.com/rsa/的JS加密库 前端JS加密代码: function GetChangeStr() ...
- 购物车Demo,前端使用AngularJS,后端使用ASP.NET Web API(2)--前端,以及前后端Session
原文:购物车Demo,前端使用AngularJS,后端使用ASP.NET Web API(2)--前端,以及前后端Session chsakell分享了前端使用AngularJS,后端使用ASP.NE ...
- 前端angularjs+requirejs+dhtmlx 后端asp.net webapi
享一个前后端分离方案源码-前端angularjs+requirejs+dhtmlx 后端asp.net webapi 一.前言 半年前左右折腾了一个前后端分离的架子,这几天才想起来翻出来分享给大家 ...
- windows系统安装gcc编译器----c/c++语言编译器
1.安装MinGW编译管理安装软件 官方下载:https://osdn.net/projects/mingw/releases/ 作者百度云备份下载:https://pan.baidu.com/s/1 ...
- 转发:RSA实现JS前端加密,PHP后端解密
web前端,用户注册与登录,不能直接以明文形式提交用户密码,容易被截获,这时就引入RSA. 前端加密 需引入4个JS扩展文件,jsbn.js.prng4.js.rng.js和rsa.js. <h ...
- RSA实现JS前端加密,PHP后端解密
web前端,用户注册与登录,不能直接以明文形式提交用户密码,容易被截获,这时就引入RSA. 前端加密 需引入4个JS扩展文件,jsbn.js.prng4.js.rng.js和rsa.js. <h ...
随机推荐
- 移动端网页 -- 安卓与IOS兼容
1.在a链接长按时,ios系统会识别并复制a链接中的href值,而安卓不会,只会选择复制文字 关于长按复制其他区域内容:pc端可以实现,在移动端目前还没有找到解决方案,很多都是基于flash的 2.i ...
- http://blog.csdn.net/z69183787/article/details/37819831
http://blog.csdn.net/z69183787/article/details/37819831
- 一个简单的dos脚本, svn 获取代码 - Tomcat 备份 - Maven 编译 - 停止/启动Tomcat - Tomcat站点 发布
获取最新代码 svn update --username %SVN_USER% --password %SVN_PASSWORD% >> "../%LOG_FILE%" ...
- 三进制状压 HDOJ 3001 Travelling
题目传送门 题意:从某个点出发,所有点都走过且最多走两次,问最小花费 分析:数据量这么小应该是状压题,旅行商TSP的变形.dp[st][i]表示状态st,在i点时的最小花费,用三进制状压.以后任意进制 ...
- JS原型对象通俗"唱法"
书上对于原型对象的说法给我整的眼花缭乱,完全不知道它在说什么,查了好多资料,终于有了些理解,下面我以通俗的大白话说说我对原型对象的理解. 1.关于原型对象的重要知识点 首先要知道一个很重要的知识点,一 ...
- Mvc网站发布到IIS
网站发布步骤: 这部分是转载文章 在此标明出处,以前有文章是转的没标明的请谅解,因为有些已经无法找到出处,或者与其它原因. 如有冒犯请联系本人,或删除,或标明出处. 因为好的文章,以前只想收藏,但连接 ...
- 【原】iOS学习之ARC和非ARC文件混编
在编程过程中,我们会用到很多各种各样的他人封装的第三方代码,但是有很多第三方都是在非ARC情况下运行的,当你使用第三方编译时出现和下图类似的错误,就说明该第三方是非ARC的,需要进行一些配置.
- gulp下静态资源的合并、压缩、MD5后缀
var gulp = require('gulp'); var RevAll = require('gulp-rev-all'); var uglify = require('gulp-uglify' ...
- HDU 2586 (LCA模板题)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2586 题目大意:在一个无向树上,求一条链权和. 解题思路: 0 | 1 / \ 2 3 ...
- Android annotations REST
使用前: public class BookmarksToClipboardActivity extends Activity { BookmarkAdapter adapter; ListView ...