bcc 安装

最近在学习bpf,记录下安装bcc流程

环境

Redhat8
kernel-5.4.83

1. 编译llvm

编译 LLVM 和 Clang 开发库

git clone https://github.91chifun.workers.dev//https://github.com/llvm-mirror/llvm.git
cd llvm/tools; git clone https://github.91chifun.workers.dev//https://github.com/llvm-mirror/clang.git
cd ..; mkdir -p build/install; cd build
cmake -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install ..
make
make install
export PATH=$PWD/install/bin:$PATH

2. bcc 编译要求

sudo yum  install -y bison cmake ethtool flex git iperf libstdc++-static \
  python-netaddr python-pip gcc gcc-c++ make zlib-devel \
  elfutils-libelf-devel
sudo yum install -y luajit luajit-devel  # for Lua support
sudo yum install -y \
  http://repo.iovisor.org/yum/extra/mageia/cauldron/x86_64/netperf-2.7.0-1.mga6.x86_64.rpm
sudo pip install pyroute2

3. build bcc

cd bcc
mkdir build 
cd build 

#cmake ..
make -j
make install

测试:

[root@localhost tools]# pwd
/usr/local/share/bcc/tools
[root@localhost tools]#  ./filetop
04:26:28 loadavg: 0.12 0.10 1.47 1/395 54510

TID    COMM             READS  WRITES R_Kb    W_Kb    T FILE
54510  clear            2      0      60      0       R xterm
54496  filetop          2      0      15      0       R loadavg
54510  clear            3      0      0       0       R libtinfo.so.6.1
54510  filetop          3      0      0       0       R clear
54510  clear            1      0      0       0       R libc-2.28.so
54510  filetop          2      0      0       0       R ld-2.28.so
Detaching...
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山羊哥-老宋

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值