当前位置: 首页 > news >正文

Ubuntu20.04,编译安装BCC

https://github.com/iovisor/bcc/blob/master/INSTALL.md

一、内核配置

In general, to use these features, a Linux kernel version 4.1 or newer is required. 
In addition, the kernel should have been compiled with the following flags set:

CONFIG_BPF=y
CONFIG_BPF_SYSCALL=y
# [optional, for tc filters]
CONFIG_NET_CLS_BPF=m
# [optional, for tc actions]
CONFIG_NET_ACT_BPF=m
CONFIG_BPF_JIT=y
# [for Linux kernel versions 4.1 through 4.6]
CONFIG_HAVE_BPF_JIT=y
# [for Linux kernel versions 4.7 and later]
CONFIG_HAVE_EBPF_JIT=y
# [optional, for kprobes]
CONFIG_BPF_EVENTS=y
# Need kernel headers through /sys/kernel/kheaders.tar.xz
CONFIG_IKHEADERS=y

There are a few optional kernel flags needed for running bcc networking examples on vanilla kernel:

CONFIG_NET_SCH_SFQ=m
CONFIG_NET_ACT_POLICE=m
CONFIG_NET_ACT_GACT=m
CONFIG_DUMMY=m
CONFIG_VXLAN=m

Kernel compile flags can usually be checked by looking at /proc/config.gz or /boot/config-<kernel-version>.

二、源码方式编译安装BCC

- LLVM 3.7.1 or newer, compiled with BPF support (default=on)
- Clang, built from the same tree as LLVM
- cmake (>=3.1), gcc (>=4.7), flex, bison
- LuaJIT, if you want Lua support
- Optional tools used in some examples: arping, netperf, and iperf

1、安装依赖
 For Focal (20.04.1 LTS)

# apt install -y zip bison build-essential cmake flex git libedit-dev libllvm12 llvm-12-dev ibclang-12-dev python zlib1g-dev libelf-dev libfl-dev python3-setuptools liblzma-dev arping netperf iperf

 2、编译安装BCC

# git clone https://github.com/iovisor/bcc.git
# mkdir bcc/build; cd bcc/build
# cmake ..
-- Latest recognized Git tag is v0.31.0
-- Git HEAD is cb1ba20f4800f556dc940682ba7016c50bd0a3ac
-- Revision is 0.31.0+cb1ba20f (major 0, minor 31, patch 0)
-- Kernel release: 5.4.0-196-generic
-- Kernel headers: /usr/src/linux-headers-5.4.0-196-generic
-- Found LLVM: /usr/lib/llvm-12/include 12.0.0 (Use LLVM_ROOT envronment variable for another version of LLVM)
-- Could NOT find LibDebuginfod (missing: LIBDEBUGINFOD_LIBRARIES LIBDEBUGINFOD_INCLUDE_DIRS)  # https://github.com/iovisor/bcc/issues/3601 注释CMakeLists.txt的行find_package(LibDebuginfod),可以消除这个告警
-- Using static-libstdc++
-- Configuring done
-- Generating done
-- Build files have been written to: /root/bcc/build
# make
[ 10%] Built target bpf-static
[ 12%] Built target clang_frontend-objects
[ 14%] Built target bcc-loader-static
[ 15%] Built target api-objects
[ 16%] Built target usdt-static
[ 16%] Built target clang_frontend
[ 21%] Built target bcc-static
[ 30%] Built target bpf-shared
[ 31%] Built target api-static
[ 37%] Built target bcc-shared
[ 38%] Built target bcc_py_python3
[ 39%] Built target bcc-lua
[ 39%] Built target bps
[ 39%] Built target CGroupTest
[ 39%] Built target UseExternalMap
[ 39%] Built target FollyRequestContextSwitch
[ 40%] Built target SkLocalStorageIterator
[ 41%] Built target HelloWorld
[ 42%] Built target RecordMySQLQuery
[ 43%] Built target CPUDistribution
[ 44%] Built target TaskIterator
[ 45%] Built target KFuncExample
[ 45%] Built target TCPSendStack
[ 45%] Built target KModRetExample
[ 46%] Built target LLCStat
[ 46%] Built target RandomRead
[ 48%] Built target PyPerf
[ 90%] Built target man
[ 91%] Built target test_static
[ 92%] Built target usdt_test_lib
[ 93%] Built target debuginfo_test_lib
[ 94%] Built target zip_archive
[ 94%] Built target debuginfo
[ 94%] Built target with_gnu_debuglink
[ 94%] Built target debuginfo_xz
[ 94%] Built target with_gnu_debugdata
[ 94%] Linking CXX executable test_libbcc
[100%] Built target test_libbcc# make install# cmake -DPYTHON_CMD=python3 .. # build python3 binding
-- Latest recognized Git tag is v0.31.0
-- Git HEAD is cb1ba20f4800f556dc940682ba7016c50bd0a3ac
-- Revision is 0.31.0+cb1ba20f (major 0, minor 31, patch 0)
-- Kernel release: 5.4.0-196-generic
-- Kernel headers: /usr/src/linux-headers-5.4.0-196-generic
-- Found LLVM: /usr/lib/llvm-12/include 12.0.0 (Use LLVM_ROOT envronment variable for another version of LLVM)
-- Using static-libstdc++
-- Configuring done
-- Generating done
-- Build files have been written to: /root/bcc/build# pushd src/python/
~/bcc/build/src/python ~/bcc/build# make
[100%] Built target bcc_py_python3# make install
# popd
~/bcc/build


 

http://www.lryc.cn/news/457221.html

相关文章:

  • # 显卡算力参数对比
  • 掌握RocketMQ4.X消息中间件(一)-RocketMQ基本概念与系统架构
  • 实际开发中,java开发的准备工作
  • SQL进阶技巧:Order by 中 NULLS LAST特性使用?
  • Redis:cpp.redis++类型操作
  • 感冒用药记录
  • JMeter性能测试时,如何做CSV参数化
  • 爬虫获取不同数据类型(如JSON,HTML)的处理方法以及图片相对URL地址的转换
  • Elasticsearch 实战应用
  • 前端数据加载慢的解决方法
  • 探索MultiApp:一款强大的多应用管理工具
  • qt QGraphicsItem详解
  • LVS搭建负载均衡
  • Unity MVC框架演示 1-1 理论分析
  • 基于springboot+vue人脸识别的考勤管理系统(源码+定制+开发)
  • 【api连接ChatGPT的最简单方式】
  • 技术成神之路:设计模式(二十)装饰模式
  • 利用特征点采样一致性改进icp算法点云配准方法
  • LabVIEW惯性导航系统仿真平台
  • es简单实现文章检索功能
  • 太速科技-607-基于FMC的12收和12发的光纤子卡
  • UEFI学习笔记(十):系统表与ACPI表的遍历
  • 【深度学习基础模型】液态状态机(Liquid State Machines, LSM)详细理解并附实现代码。
  • 深入理解链表(SList)操作
  • 03. prometheus 监控 Linux 主机
  • AI占据2024诺贝尔两大奖项,是否预示着未来AI即一切?
  • [已解决] Install PyTorch 报错 —— OpenOccupancy 配环境
  • 6. PH47 代码框架硬件开发环境搭建
  • package.json配置
  • 视频怎么转gif动图?5个简单转换方法快来学(详细教程)