首页 > 编程语言 >VPP 2110版本源码编译安装

VPP 2110版本源码编译安装

时间:2023-02-20 17:01:36浏览次数:52  
标签:VPP -- make 源码 build install 2110 vpp

原文地址:https://www.cnblogs.com/liqinglucky/p/vpp.html

一 介绍

官方文档:VPP/What is VPP? - fd.io

VPP平台是一个提供了交换机/路由器(switch/router)开箱即用(out-of-the-box)产品功能的可拓展框架。由思科 Vector Packet Processing (VPP)技术开源而来。VPP是一个高性能(high performance)数据包处理栈,可以运行在商用(commodity)CPU上。

使用VPP好处是高性能(high performance),实践检验的成熟技术(proven technology),模块化(modularity)和易于扩展(flexibility),以及丰富的功能集(rich feature set)。

VPP技术经过实践检验,已经用于超过数十亿的思科产品上。产品模块化设计,框架允许通过以插件形式新增图节点(graph nodes)作扩展而不需要去改变VPP的核心(core/kernel)代码。

VPP在裸机/虚拟机/容器中的应用:

flowchart TD subgraph Bare-Metal/VM/Container a1[Data Plane Management Agent] a2[Vector Packet Processing] a3[Network IO] a1<-->a2 a2<-->a3 end

二 编译

编译环境

Ubuntu 20.04.4 LTS

编译VPP

官方文档:VPP/Pulling, Building, Running, Hacking and Pushing VPP Code - fd.io

1 下载源码

建议通过clone方式下载。我通过源码包的方式编译过,容易出问题。

git clone https://gerrit.fd.io/r/vpp

切到VPP通过版本的分支

vpp# git checkout -b stable/2110 --track origin/stable/2110

vpp# ls
build       build-root  docs     extras     LICENSE      Makefile   RELEASE.md  test
build-data  configure   doxygen  INFO.yaml  MAINTAINERS  README.md  src

编译源码

按照官方给的编译命令编译

# vpp 18.10+ (cmake)
make install-dep
make install-ext-deps
make build        # or `make build-release`

2 安装依赖包

vpp# make install-dep
vpp# make install-ext-deps
Removing deb/debian/vpp-ext-deps.substvars
Removing deb/debian/vpp-ext-deps/
make[2]: Leaving directory '/vpp/build/external'
Selecting previously unselected package vpp-ext-deps.
(Reading database ... 196110 files and directories currently installed.)
Preparing to unpack vpp-ext-deps_21.10-8_amd64.deb ...
Unpacking vpp-ext-deps (21.10-8) ...
Setting up vpp-ext-deps (21.10-8) ...
make[1]: Leaving directory '/vpp/build/external'

这一步需要下载dpdk等包会比较久。也可以事先拷贝已下载好的dpdk包放至build/external/downloads目录。

vpp/build/external/downloads# ls
dpdk-21.08.tar.xz    pyelftools-0.29-py2.py3-none-any.whl  setuptools-67.3.2-py3-none-any.whl  wheel-0.38.4-py3-none-any.whl
meson-0.55.0.tar.gz  quicly_0.1.3-vpp.tar.gz               v0.2.tar.gz
nasm-2.14.02.tar.xz  rdma-core-35.0.tar.gz                 v1.0.tar.gz

3 编译

编译参数可以研究vpp/makefile

vpp# make build
-- Configuration:
VPP version         : 21.10.1-3~g08ff7a985
VPP library version : 21.10.1
GIT toplevel dir    : /vpp
Build type          : debug
C flags             :
Linker flags (apps) :
Linker flags (libs) :
Host processor      : x86_64
Target processor    : x86_64
Prefix path         : /opt/vpp/external/x86_64 /vpp/build-root/install-vpp_debug-native/external
Install prefix      : /vpp/build-root/install-vpp_debug-native/vpp
-- Configuring done
-- Generating done
-- Build files have been written to: /vpp/build-root/build-vpp_debug-native/vpp
@@@@ Building vpp in /vpp/build-root/build-vpp_debug-native/vpp @@@@
[2549/2549] Linking C shared library lib/vat2_plugins/wireguard_test_plugin_wireguard_plugin.so
@@@@ Installing vpp @@@@
[0/1] Install the project...
-- Install configuration: "debug"
make[1]: Leaving directory '/vpp/build-root'

生成的bin文件build-root/install-vpp_debug-native/vpp/bin/vpp

4 清除编译文件

vpp# make wipe
make[1]: Entering directory '/vpp/test'
make[1]: Leaving directory '/vpp/test'
make[1]: Entering directory '/vpp/build-root'
@@@@ Wiping build/install external @@@@
@@@@ Wiping build/install vpp @@@@
make[1]: Leaving directory '/vpp/build-root'

遇到的问题

官方的代码编译还是会遇到一些代码本身的问题,需要做些修改。

依赖包下载失败

下载失败
Downloading https://github.com/vpp-quic/quicly/releases/download/v0.1.3-vpp/quicly_0.1.3-vpp.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:02:00 --:--:--     0
curl: (52) Empty reply from server
make[3]: *** [packages/quicly.mk:47: downloads/quicly_0.1.3-vpp.tar.gz] Error 52
make[3]: Leaving directory '/vpp/build/external'
make[2]: *** [Makefile:160: ebuild-build] Error 2
make[2]: Leaving directory '/vpp/build/external'
make[1]: *** [Makefile:732: external-install] Error 2
make[1]: Leaving directory '/vpp/build-root'
make: *** [Makefile:355: build] Error 2

解决:再次执行make install-ext-deps重新下载或者从其他地方拷贝已经下载好的依赖包到对应目录。

dpkg-buildpackage: error: version number does not start with digit

vpp# make install-ext-deps

dpkg-buildpackage: warning:     debian/changelog(l1): version '-0' is invalid: upstream version cannot be empty
LINE: vpp-ext-deps (-0) unstable; urgency=low
dpkg-buildpackage: info: source package vpp-ext-deps
dpkg-buildpackage: info: source version unknown
dpkg-buildpackage: error: version number does not start with digit
make[2]: *** [Makefile:75: vpp-ext-deps_-0_amd64.deb] Error 255
make[2]: Leaving directory '/vpp/build/external'
make[1]: *** [Makefile:82: install-deb] Error 2
make[1]: Leaving directory '/vpp/build/external'
make: *** [Makefile:596: install-ext-deps] Error 2

解决:用源码包解压编译的时候遇到的,改成clone方式下载源码就没出现了。

ambiguous argument 'v-rc0..': unknown revision

vpp# make build

//原因是v-rc0的宏定义找不到,可以自己去设置宏但比较麻烦。
fatal: ambiguous argument 'v-rc0..': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: No names found, cannot describe anything.
fatal: ambiguous argument 'v-rc0..': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: No names found, cannot describe anything.

-- Looking for ccache - found
fatal: No names found, cannot describe anything.
CMake Error at CMakeLists.txt:52 (string):
  string sub-command REPLACE requires at least four arguments.

Prefix path         : /opt/vpp/external/x86_64 /vpp/build-root/install-vpp_debug-native/external
Install prefix      : /vpp/build-root/install-vpp_debug-native/vpp
-- Configuring incomplete, errors occurred!
See also "/vpp/build-root/build-vpp_debug-native/vpp/CMakeFiles/CMakeOutput.log".
See also "/vpp/build-root/build-vpp_debug-native/vpp/CMakeFiles/CMakeError.log".
make[1]: *** [Makefile:644: vpp-configure] Error 1
make[1]: Leaving directory '/vpp/build-root'
make: *** [Makefile:355: build] Error 2

解决:用源码包解压编译的时候遇到的,改成clone方式下载源码就没出现了。

三 运行测试

编译完成后可以运行测试脚本检验

vpp# make test

==============================================================================
DHCPv6 Proxy                                                         14.90 OK
DHCP Client                                                          7.76 OK
DHCP Client w/ VLAN                                                  0.40 OK
DHCPv4 Proxy                                                         23.36 OK

==============================================================================
TEST RESULTS:
                      Scheduled tests: 1482
                       Executed tests: 1482
                         Passed tests: 1288
                        Skipped tests: 141
    Tests skipped due to lack of CPUS: 53

     SOME TESTS WERE SKIPPED BECAUSE THERE ARE NOT ENOUGH CPUS AVAILABLE
==============================================================================

Test run was successful
Killing possible remaining process IDs:  875082 875084
make[1]: Leaving directory '/vpp/test'

标签:VPP,--,make,源码,build,install,2110,vpp
From: https://www.cnblogs.com/liqinglucky/p/vpp.html

相关文章

  • 集群机制:注册表同步以及高可用源码剖析
    1在完成服务注册之后,会将注册信息同步给群里中的其他节点,以实现高可用,续约,服务更新,下线都是一样的操作2拿到集群中其他节点的url信息,同步数据3执行批处理任务,ba......
  • 多级缓存机制(包括缓存的主动过期、定时过期、被动过期)源码剖析
    1多级缓存入口2初始化缓存3二级缓存(读写缓存)readWriteCacheMap,每隔180s就会主动过期4一级缓存(只读缓存)readOnlyCacheMap,每隔30s自动刷新一次(定时过期)5......
  • java基础 -- 反射深入浅出与CLass源码解析
    java反射在运行状态中,对于任意的一个类,都能够知道这个类的所有属性和方法,对任意一个对象都能够通过反射机制调用一个类的任意方法,这种动态获取类信息及动态调用类对象方法的......
  • 框架源码 -- spring aware
    框架源码–springawarebean实现了Aware系列接口可以访问Spring容器,其中涉及到bean的创建过程,其中包括BeanNameAware,BeanFactoryAware,ApplicationContextAware都有参与b......
  • 自动故障感知以及服务实例自动摘除源码剖析
    1每隔1min调度一次EvictionTask这个任务,感知是否有实例故障,并摘除eureka-server初始化完成,进入下面这个方法registry.openForTraffic(applicationInfoManager,regist......
  • 2-1-4.spring源码--AbstractApplicationContext
    Spring源码–AbstractApplicationContext概述江湖上流传这样一个传说,只要把spring的refresh()搞明白,spring就学的七七八八了。今天来盘一下refresh方法,这个这是一个困难点了......
  • 服务下线源码剖析
    1client正常下线之前,会调用这个关闭的方法2释放线程池等资源3将实例状态设置为down,发送http请求调用server的cancel()方法4释放网络等资源......
  • 如何在eclipse上查看源码,如果在idea查看源码【待完善】
    如何查看源码目录文章目录​​如何查看源码目录​​​​如何在eclipse上查看String的源码目录​​​​如何在idea上查看String的源码目录【待完善】​​如何在eclipse上查看......
  • client启动过程源码剖析
    1实例化EurekaInstanceConfig对象instanceConfig2先初始化InstanceInfo对象,再基于构建好的instanceConfig和instanceInfo构建applicationInfoManager对象3......
  • 【Spring AOP】【四】Spring AOP源码解析-AOP切入时机
    1 前言我们分析了AOP不管是XML配置还是注解方式的解析过程,这篇我们简单来说下AOP在Spring中对bean对象代理的一个切入时机,其实我们在讲解IOC的时候,已经点了一下这篇我们......