P4 前端编译器p4c-bm、后端编译器bmv2命令安装 make error问题

参考:Github

安装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 thisdirectory. Directory must exist.--pd-from-json        Generate PD from a JSON file, not a P4 file--p4-prefix P4_PREFIXP4 name use for API function prefix--field-aliases FIELD_ALIASESPath 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 PRIMITIVESA JSON file which contains additional primitivedeclarations--plugin PLUGIN_LIST  list of plugins to generate templates--openflow-mapping-dir OPENFLOW_MAPPING_DIRDirectory of openflow mapping files--openflow-mapping-mod OPENFLOW_MAPPING_MODOpenflow 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:automakecmakelibjudy-devlibgmp-devlibpcap-devlibboost-devlibboost-test-devlibboost-program-options-devlibboost-system-devlibboost-filesystem-devlibboost-thread-devlibevent-devlibtoolflexbisonpkg-configg++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 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.SerializeState2
Traceback (most recent call last):File "../tools/runtime_CLI.py", line 30, in <module>import bmpy_utils as utilsFile "/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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/291914.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

机器学习模型 知乎_机器学习-模型选择与评价

交叉验证首先选择模型最简单的方法就是&#xff0c;利用每一种机器学习算法(逻辑回归、SVM、线性回归等)计算训练集的损失值&#xff0c;然后选择其中损失值最小的模型&#xff0c;但是这样是不合理的&#xff0c;因为当训练集不够、特征过多时容易过拟合&#xff0c;那么训练集…

三种查看SqlServer中数据物理pge页的方法

1.根据数据记录查看当前记录所在的文件编号、page页、以及在页中的插槽。 示例如下&#xff1a; SELECT top 10 %%physloc%%, sys.fn_physlocFormatter (%%physloc%%) AS RID FROM tableName --注意&#xff1b;在64位系统中sys.fn_physlocFormatter 整理出来的格式有时候不…

C#10 和 .NET6 代码跨平台开发

零、前言有数千页长的编程书籍&#xff0c;旨在成为 C# 语言、.NET 库、网站、服务、桌面和移动应用等应用模型的综合参考。这本书不一样。它简洁明了&#xff0c;旨在成为一本轻快有趣的书&#xff0c;每一个主题都有实用的实践演练。总体叙述的广度是以某种深度为代价的&…

文件权限

用户类型&#xff1a;管理员&#xff1a;0一般用户&#xff1a;1-65535系统用户1-499普通用户&#xff1a;500权限管理&#xff1a;owner&#xff0c;group属主&#xff1a;属组&#xff1a;其他&#xff1a;权限&#xff1a;read&#xff08;读&#xff09;&#xff0c;write&…

linux之tar命令使用总结

1、使用原因 刚才在linux平台需要安装Clion的时候,下载得到CLion-2016.3.2.tar.gz 这个gz的压缩文件,所以需要解压到当前文件夹 2、简单解压到当前文件 解压当前文件夹命令 tar -zxvf CLion-2016.3.2.tar.gz 效果如下 3、tar命令介绍 -c: 建立压缩档案 -x:解压 -t:…

jq取第一个子元素为select_【转】jquery如何获取第一个或最后一个子元素?

【转自】https://www.cnblogs.com/MUMO/p/5938483.html通过children方法&#xff0c;children("input:first-child")$(this).children("input:first-child").val();$(this).children("input:last-child").val();通过>选择器&#xff0c;$(&qu…

基于ASP.NET Core SignalR的流式传输

基于ASP.NET Core SignalR的流式传输SignalR概述SignalR是ASP.NET Core下非常流行的实现Web实时功能的库。微软再文档中列出了适合的应用场景&#xff1a;适合 SignalR 的候选项&#xff1a;需要从服务器进行高频率更新的应用。示例包括游戏、社交网络、投票、拍卖、地图和 GPS…

Leetcode: Palindrome Partition I II

题目一, 题目二 思路 1. 第一遍做时就参考别人的, 现在又忘记了 做的时候使用的是二维动态规划, 超时加超内存 2. 只当 string 左部分是回文的时候才有可能减少 cut 3. 一维动规. 令 cuts[i] 表示string[i, string.size()] 所需的切割数, 那么 状态转移方程为 cuts[i] min(cut…

FatMouse

时间限制&#xff1a;1 秒 内存限制&#xff1a;128 兆 特殊判题&#xff1a;否 提交&#xff1a;1431 解决&#xff1a;641 题目描述&#xff1a;FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food…

linux之安装Clion和运行使用总结

前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到教程 1、Clion的简单介绍 CLion是以IntelliJ为基础,专为开发C及C++所设计的跨平台IDE,可以在Windows、Linux及MacOS使用,这里我是在ubuntu 16.0.4基础上安装。 2、linux平台…

Tips

1.Unity\Editor\Data\Resources\ScriptTemplates 里的文件是Unity 生成文件的模板. 2.提示文件尾不一致.用VS打开Unity\Editor\Data\Resources\ScriptTemplates里的模板文件.文件->高级保存选项->Windows(CRLF) 3.Scene视图里选择Transform工具,按V可以通过Pivot对齐 4.N…

体验 正式发布 的OSM v1.0.0 版本

2021年10月份发布了OSM 1.0 RC[1]&#xff0c;在过去的几个月里&#xff0c;OSM 的贡献者一直在努力为 v1.0.0 版本的发布做准备。2022年2月1日&#xff0c;OSM 团队正式发布 1.0.0 版本[2]。OSM 从最初的发布到现在已经走了很长的路&#xff0c;团队继续专注于社区需要的关键和…

linux c之用命名管道实现进程通信

1、命名管道相关信息介绍 不是很了解命名管道先看这个篇博客 http://blog.csdn.net/u011068702/article/details/55102379 linux c之命名管道简单使用 博客介绍了创建管道的方法,这里还需要介绍 open函数和调用阻塞 FIFO文件也可以使用open调用来打开,mkfifo函数只是创建…

vue表格刷新数据_Vue.js+Layer表格数据绑定与实现更新的实例

一&#xff1a;先使用Vue.js绑定好数据与更新事件使用v-on绑定好事件,在事件里边直接把该行数据传递进去&#xff0c;在更新方法里边就可以直接取出需要更新的数据选择用户名学号班级操作{{item.UserName}}{{item.Number}}{{item.Class}}删除更新//实例化vue.js(用来给表格提供…

数据流图的画法

数据流图的画法 数据流图也称为数据流程图date flow diagram , DFD&#xff0c;是一种便于用户理解和分析系统数据流程的图形工具&#xff0c;他摆脱了系统和详细内容&#xff0c;精确的在逻辑上描写叙述系统的功能、输入、输出和数据存储等&#xff0c;是系统逻辑模型的重要组…

linux之自己总结学习linux的资源推荐

1、学习linux前辈的网站 安卓和linux网络编程 http://www.cnblogs.com/hnrainll/ IBM学习linux技术地址: https://www.ibm.com/developerworks/cn/views/linux/libraryview.jsp 2、学习linux的途径,或者说过程 1、APUE再深读 – 尤其是进程,线程,IPC,套接字 2、 多…

01-算法简介

数据结构和算法 基于《算法图解》—Aditya Bhargava和《数据结构》—严蔚敏 ** 算法图解&#xff1a;(基于Python)* 第1章—算法简介 1.1 引言 算法是一组完成任务的指令。 1.2 二分查找&#xff08;binary_search&#xff09; 二分查找是一种算法&#xff0c;其输入是一个…

浏览器渲染机制面试_【前端面试必考题】页面渲染机制(一)

页面渲染机制这部分内容会分成两篇来进行讲解&#xff0c;这两篇里我们准备聊一下页面的渲染的过程&#xff0c;包括页面的加载、DOM 树的构建、CSSOM 树的构建、渲染树的构建和最后的渲染过程等。浏览器的渲染机制和网页的优化息息相关&#xff0c;只有知道了页面是怎么渲染出…

OpenJudge/Poj 1226 Substrings

1.链接地址&#xff1a; http://bailian.openjudge.cn/practice/1226/ http://poj.org/problem?id1226 2.题目&#xff1a; 总时间限制:1000ms内存限制:65536kB描述You are given a number of case-sensitive strings of alphabetic characters, find the largest string X, s…

MFC继承表

转载于:https://www.cnblogs.com/Lthis/p/4264967.html