日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > HTML >内容正文

HTML

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

發布時間:2023/12/4 HTML 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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

總結

以上是生活随笔為你收集整理的P4 前端编译器p4c-bm、后端编译器bmv2命令安装 make error问题的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。