• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Installing BCC
2
3* [Kernel Configuration](#kernel-configuration)
4* [Packages](#packages)
5  - [Debian](#debian---binary)
6  - [Ubuntu](#ubuntu---binary)
7  - [Fedora](#fedora---binary)
8  - [Arch](#arch---binary)
9  - [Gentoo](#gentoo---portage)
10  - [openSUSE](#opensuse---binary)
11  - [RHEL](#rhel---binary)
12  - [Amazon Linux 1](#amazon-linux-1---binary)
13  - [Amazon Linux 2](#amazon-linux-2---binary)
14  - [Alpine](#alpine---binary)
15* [Source](#source)
16  - [libbpf Submodule](#libbpf-submodule)
17  - [Debian](#debian---source)
18  - [Ubuntu](#ubuntu---source)
19  - [Fedora](#fedora---source)
20  - [openSUSE](#opensuse---source)
21  - [Centos](#centos---source)
22  - [Amazon Linux 1](#amazon-linux-1---source)
23  - [Amazon Linux 2](#amazon-linux-2---source)
24  - [Alpine](#alpine---source)
25  - [Arch](#arch---source)
26* [Older Instructions](#older-instructions)
27
28## Kernel Configuration
29
30In general, to use these features, a Linux kernel version 4.1 or newer is
31required. In addition, the kernel should have been compiled with the following
32flags set:
33
34```
35CONFIG_BPF=y
36CONFIG_BPF_SYSCALL=y
37# [optional, for tc filters]
38CONFIG_NET_CLS_BPF=m
39# [optional, for tc actions]
40CONFIG_NET_ACT_BPF=m
41CONFIG_BPF_JIT=y
42# [for Linux kernel versions 4.1 through 4.6]
43CONFIG_HAVE_BPF_JIT=y
44# [for Linux kernel versions 4.7 and later]
45CONFIG_HAVE_EBPF_JIT=y
46# [optional, for kprobes]
47CONFIG_BPF_EVENTS=y
48# Need kernel headers through /sys/kernel/kheaders.tar.xz
49CONFIG_IKHEADERS=y
50```
51
52There are a few optional kernel flags needed for running bcc networking examples on vanilla kernel:
53
54```
55CONFIG_NET_SCH_SFQ=m
56CONFIG_NET_ACT_POLICE=m
57CONFIG_NET_ACT_GACT=m
58CONFIG_DUMMY=m
59CONFIG_VXLAN=m
60```
61
62Kernel compile flags can usually be checked by looking at `/proc/config.gz` or
63`/boot/config-<kernel-version>`.
64
65# Packages
66
67## Debian - Binary
68
69`bcc` and its tools are available in the standard Debian main repository, from the source package [bpfcc](https://packages.debian.org/source/sid/bpfcc) under the names `bpfcc-tools`, `python-bpfcc`, `libbpfcc` and `libbpfcc-dev`.
70
71## Ubuntu - Binary
72
73Versions of bcc are available in the standard Ubuntu
74Universe repository, as well in iovisor's PPA. The Ubuntu packages have slightly different names: where iovisor
75packages use `bcc` in the name (e.g. `bcc-tools`), Ubuntu packages use `bpfcc` (e.g.
76`bpfcc-tools`).
77
78Currently, BCC packages for both the Ubuntu Universe, and the iovisor builds are outdated. This is a known and tracked in:
79- [Universe - Ubuntu Launchpad](https://bugs.launchpad.net/ubuntu/+source/bpfcc/+bug/1848137)
80- [iovisor - BCC GitHub Issues](https://github.com/iovisor/bcc/issues/2678)
81Currently, [building from source](#ubuntu---source) is currently the only way to get up to date packaged version of bcc.
82
83**Ubuntu Packages**
84Source packages and the binary packages produced from them can be
85found at [packages.ubuntu.com](https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=bpfcc&searchon=sourcenames).
86
87```bash
88sudo apt-get install bpfcc-tools linux-headers-$(uname -r)
89```
90
91The tools are installed in `/sbin` (`/usr/sbin` in Ubuntu 18.04) with a `-bpfcc` extension. Try running `sudo opensnoop-bpfcc`.
92
93**_Note_**: the Ubuntu packages have different names but the package contents, in most cases, conflict
94and as such _cannot_ be installed alongside upstream packages. Should one choose to use
95Ubuntu's packages instead of the upstream iovisor packages (or vice-versa), the
96conflicting packages will need to be removed.
97
98The iovisor packages _do_ declare they provide the Ubuntu packages and as such may be
99used to satisfy dependencies. For example, should one attempt to install package `foo`
100which declares a dependency on `libbpfcc` while the upstream `libbcc` package is installed,
101`foo` should install without trouble as `libbcc` declares that it provides `libbpfcc`.
102That said, one should always test such a configuration in case of version incompatibilities.
103
104**iovisor packages (Upstream Stable and Signed Packages)**
105
106```bash
107sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
108echo "deb https://repo.iovisor.org/apt/$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/iovisor.list
109sudo apt-get update
110sudo apt-get install bcc-tools libbcc-examples linux-headers-$(uname -r)
111```
112(replace `xenial` with `artful` or `bionic` as appropriate). Tools will be installed under /usr/share/bcc/tools.
113
114**Upstream Nightly Packages**
115
116```bash
117echo "deb [trusted=yes] https://repo.iovisor.org/apt/xenial xenial-nightly main" | sudo tee /etc/apt/sources.list.d/iovisor.list
118sudo apt-get update
119sudo apt-get install bcc-tools libbcc-examples linux-headers-$(uname -r)
120```
121(replace `xenial` with `artful` or `bionic` as appropriate)
122
123## Fedora - Binary
124
125### Fedora 30 and newer
126
127As of Fedora 30, bcc binaries are available in the standard repository.
128You can install them via
129
130```bash
131sudo dnf install bcc
132```
133
134**Note**: if you keep getting `Failed to load program: Operation not permitted` when
135trying to run the `hello_world.py` example as root then you might need to lift
136the so-called kernel lockdown (cf.
137[FAQ](https://github.com/iovisor/bcc/blob/c00d10d4552f647491395e326d2e4400f3a0b6c5/FAQ.txt#L24),
138[background article](https://gehrcke.de/2019/09/running-an-ebpf-program-may-require-lifting-the-kernel-lockdown)).
139
140
141### Fedora 29 and older
142
143Ensure that you are running a 4.2+ kernel with `uname -r`. If not, install a 4.2+ kernel from
144http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug, for example:
145
146```bash
147sudo dnf config-manager --add-repo=http://alt.fedoraproject.org/pub/alt/rawhide-kernel-nodebug/fedora-rawhide-kernel-nodebug.repo
148sudo dnf update
149# reboot
150```
151
152**Nightly Packages**
153
154Nightly bcc binary packages for Fedora 25, 26, 27, and 28 are hosted at
155`https://repo.iovisor.org/yum/nightly/f{25,26,27}`.
156
157To install:
158```bash
159echo -e '[iovisor]\nbaseurl=https://repo.iovisor.org/yum/nightly/f27/$basearch\nenabled=1\ngpgcheck=0' | sudo tee /etc/yum.repos.d/iovisor.repo
160sudo dnf install bcc-tools kernel-headers kernel-devel
161```
162
163**Stable and Signed Packages**
164
165Stable bcc binary packages for Fedora 25, 26, 27, and 28 are hosted at
166`https://repo.iovisor.org/yum/main/f{25,26,27}`.
167
168```bash
169echo -e '[iovisor]\nbaseurl=https://repo.iovisor.org/yum/main/f27/$basearch\nenabled=1' | sudo tee /etc/yum.repos.d/iovisor.repo
170sudo dnf install bcc-tools kernel-devel-$(uname -r) kernel-headers-$(uname -r)
171```
172
173## Arch - Binary
174
175bcc is available in the standard Arch repos, so it can be installed with the `pacman` command:
176```
177# pacman -S bcc bcc-tools python-bcc
178```
179
180## Gentoo - Portage
181
182First of all, upgrade the kernel of your choice to a recent version. For example:
183```
184emerge sys-kernel/gentoo-sources
185```
186Then, configure the kernel enabling the features you need. Please consider the following as a starting point:
187```
188CONFIG_BPF=y
189CONFIG_BPF_SYSCALL=y
190CONFIG_NET_CLS_BPF=m
191CONFIG_NET_ACT_BPF=m
192CONFIG_BPF_JIT=y
193CONFIG_BPF_EVENTS=y
194```
195Finally, you can install bcc with:
196```
197emerge dev-util/bcc
198```
199The appropriate dependencies (e.g., ```clang```, ```llvm``` with BPF backend) will be pulled automatically.
200
201## openSUSE - Binary
202
203For openSUSE Leap 42.2 (and later) and Tumbleweed, bcc is already included in the official repo. Just install
204the packages with zypper.
205
206```bash
207sudo zypper ref
208sudo zypper in bcc-tools bcc-examples
209```
210
211## RHEL - Binary
212
213For RHEL 7.6, bcc is already included in the official yum repository as bcc-tools. As part of the install, the following dependencies are installed: bcc.x86_64 0:0.6.1-2.el7 ,llvm-private.x86_64 0:6.0.1-2.el7 ,python-bcc.x86_64 0:0.6.1-2.el7,python-netaddr.noarch 0:0.7.5-9.el7
214
215```
216yum install bcc-tools
217```
218
219## Amazon Linux 1 - Binary
220Use case 1. Install BCC for latest kernel available in repo:
221   Tested on Amazon Linux AMI release 2018.03 (kernel 4.14.88-72.73.amzn1.x86_64)
222```
223sudo yum update kernel
224sudo yum install bcc
225sudo reboot
226```
227
228Use case 2. Install BCC for your AMI's default kernel (no reboot required):
229   Tested on Amazon Linux AMI release 2018.03 (kernel 4.14.77-70.59.amzn1.x86_64)
230```
231sudo yum install kernel-headers-$(uname -r | cut -d'.' -f1-5)
232sudo yum install kernel-devel-$(uname -r | cut -d'.' -f1-5)
233sudo yum install bcc
234```
235
236## Amazon Linux 2 - Binary
237Use case 1. Install BCC for your AMI's default kernel (no reboot required):
238   Tested on Amazon Linux AMI release 2021.11 (kernel 5.10.75-79.358.amzn2.x86_64)
239```
240sudo amazon-linux-extras install BCC
241```
242
243## Alpine - Binary
244
245As of Alpine 3.11, bcc binaries are available in the community repository:
246
247```
248sudo apk add bcc-tools bcc-doc
249```
250
251The tools are installed in `/usr/share/bcc/tools`.
252
253**Python Compatibility**
254
255The binary packages include bindings for Python 3 only. The Python-based tools assume that a `python` binary is available at `/usr/bin/python`, but that may not be true on recent versions of Alpine. If you encounter errors like `<tool-name>: not found`, you can try creating a symlink to the Python 3.x binary like so:
256
257```
258sudo ln -s $(which python3) /usr/bin/python
259```
260
261**Containers**
262
263Alpine Linux is often used as a base system for containers. `bcc` can be used in such an environment by launching the container in privileged mode with kernel modules available through bind mounts:
264
265```
266sudo docker run --rm -it --privileged \
267  -v /lib/modules:/lib/modules:ro \
268  -v /sys:/sys:ro \
269  -v /usr/src:/usr/src:ro \
270  alpine:3.12
271```
272
273# Source
274
275## libbpf Submodule
276
277Since release v0.10.0, bcc starts to leverage libbpf repo (https://github.com/libbpf/libbpf)
278to provide wrapper functions to the kernel for bpf syscalls, uapi headers bpf.h/btf.h etc.
279Unfortunately, the default github release source code does not contain libbpf submodule
280source code and this will cause build issues.
281
282To alleviate this problem, starting at release v0.11.0, source code with corresponding
283libbpf submodule codes will be released as well. See https://github.com/iovisor/bcc/releases.
284
285## Debian - Source
286### sid
287#### Repositories
288
289`/etc/apt/sources.list` should include the `non-free` repository and look something like this:
290
291```
292deb http://deb.debian.org/debian sid main contrib non-free
293deb-src http://deb.debian.org/debian sid main contrib non-free
294```
295
296#### Install Build Dependencies
297```
298# Before you begin
299apt-get update
300# According to https://packages.debian.org/source/sid/bpfcc,
301# BCC build dependencies:
302sudo apt-get install arping bison clang-format cmake dh-python \
303  dpkg-dev pkg-kde-tools ethtool flex inetutils-ping iperf \
304  libbpf-dev libclang-dev libclang-cpp-dev libedit-dev libelf-dev \
305  libfl-dev libzip-dev linux-libc-dev llvm-dev libluajit-5.1-dev \
306  luajit python3-netaddr python3-pyroute2 python3-distutils python3
307```
308
309#### Install and compile BCC
310```
311git clone https://github.com/iovisor/bcc.git
312mkdir bcc/build; cd bcc/build
313cmake ..
314make
315sudo make install
316```
317
318## Ubuntu - Source
319
320To build the toolchain from source, one needs:
321* LLVM 3.7.1 or newer, compiled with BPF support (default=on)
322* Clang, built from the same tree as LLVM
323* cmake (>=3.1), gcc (>=4.7), flex, bison
324* LuaJIT, if you want Lua support
325
326### Install build dependencies
327```
328# Trusty (14.04 LTS) and older
329VER=trusty
330echo "deb http://llvm.org/apt/$VER/ llvm-toolchain-$VER-3.7 main
331deb-src http://llvm.org/apt/$VER/ llvm-toolchain-$VER-3.7 main" | \
332  sudo tee /etc/apt/sources.list.d/llvm.list
333wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
334sudo apt-get update
335
336# For Bionic (18.04 LTS)
337sudo apt-get -y install bison build-essential cmake flex git libedit-dev \
338  libllvm6.0 llvm-6.0-dev libclang-6.0-dev python zlib1g-dev libelf-dev libfl-dev python3-distutils
339
340# For Eoan (19.10) or Focal (20.04.1 LTS)
341sudo apt install -y bison build-essential cmake flex git libedit-dev \
342  libllvm7 llvm-7-dev libclang-7-dev python zlib1g-dev libelf-dev libfl-dev python3-distutils
343
344# For Hirsute (21.04)  or Impish (21.10)
345sudo apt install -y bison build-essential cmake flex git libedit-dev   libllvm11 llvm-11-dev libclang-11-dev python zlib1g-dev libelf-dev libfl-dev python3-distutils
346
347# For other versions
348sudo apt-get -y install bison build-essential cmake flex git libedit-dev \
349  libllvm3.7 llvm-3.7-dev libclang-3.7-dev python zlib1g-dev libelf-dev python3-distutils
350
351# For Lua support
352sudo apt-get -y install luajit luajit-5.1-dev
353```
354
355### Install and compile BCC
356
357```
358git clone https://github.com/iovisor/bcc.git
359mkdir bcc/build; cd bcc/build
360cmake ..
361make
362sudo make install
363cmake -DPYTHON_CMD=python3 .. # build python3 binding
364pushd src/python/
365make
366sudo make install
367popd
368```
369
370## CentOS-8.5 - Source
371suppose you're running with root or add sudo first
372
373### Install build dependencies
374```
375dnf install -y bison cmake ethtool flex git iperf3 libstdc++-devel python3-netaddr python3-pip gcc gcc-c++ make zlib-devel elfutils-libelf-devel
376# dnf install -y luajit luajit-devel ## if use luajit, will report some lua function(which in lua5.3) undefined problem
377dnf install -y clang clang-devel llvm llvm-devel llvm-static ncurses-devel
378dnf -y install netperf
379pip3 install pyroute2
380ln -s /usr/bin/python3 /usr/bin/python
381```
382### Install and Compile bcc
383```
384git clone https://github.com/iovisor/bcc.git
385
386mkdir bcc-build
387cd bcc-build/
388
389## here llvm should always link shared library
390cmake ../bcc -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_LLVM_SHARED=1
391make -j10
392make install
393
394```
395after install, you may add bcc directory to your $PATH, which you can add to ~/.bashrc
396```
397bcctools=/usr/share/bcc/tools
398bccexamples=/usr/share/bcc/examples
399export PATH=$bcctools:$bccexamples:$PATH
400```
401### let path take effect
402```
403source ~/.bashrc
404```
405then run
406```
407hello_world.py
408```
409Or
410```
411cd /usr/share/bcc/examples
412./hello_world.py
413./tracing/bitehist.py
414
415cd /usr/share/bcc/tools
416./bitesize
417
418```
419
420## Fedora - Source
421
422### Install build dependencies
423
424```
425sudo dnf install -y bison cmake ethtool flex git iperf libstdc++-static \
426  python-netaddr python-pip gcc gcc-c++ make zlib-devel \
427  elfutils-libelf-devel python-cachetools
428sudo dnf install -y luajit luajit-devel  # for Lua support
429sudo dnf install -y \
430  http://repo.iovisor.org/yum/extra/mageia/cauldron/x86_64/netperf-2.7.0-1.mga6.x86_64.rpm
431sudo pip install pyroute2
432```
433
434### Install binary clang
435
436```
437# FC22
438wget http://llvm.org/releases/3.7.1/clang+llvm-3.7.1-x86_64-fedora22.tar.xz
439sudo tar xf clang+llvm-3.7.1-x86_64-fedora22.tar.xz -C /usr/local --strip 1
440
441# FC23
442wget http://llvm.org/releases/3.9.0/clang+llvm-3.9.0-x86_64-fedora23.tar.xz
443sudo tar xf clang+llvm-3.9.0-x86_64-fedora23.tar.xz -C /usr/local --strip 1
444
445# FC24 and FC25
446sudo dnf install -y clang clang-devel llvm llvm-devel llvm-static ncurses-devel
447```
448
449### Install and compile BCC
450```
451git clone https://github.com/iovisor/bcc.git
452mkdir bcc/build; cd bcc/build
453cmake ..
454make
455sudo make install
456```
457
458## openSUSE - Source
459
460### Install build dependencies
461
462```
463sudo zypper in bison cmake flex gcc gcc-c++ git libelf-devel libstdc++-devel \
464  llvm-devel clang-devel pkg-config python-devel python-setuptools python3-devel \
465  python3-setuptools
466sudo zypper in luajit-devel       # for lua support in openSUSE Leap 42.2 or later
467sudo zypper in lua51-luajit-devel # for lua support in openSUSE Tumbleweed
468```
469
470### Install and compile BCC
471```
472git clone https://github.com/iovisor/bcc.git
473mkdir bcc/build; cd bcc/build
474cmake -DLUAJIT_INCLUDE_DIR=`pkg-config --variable=includedir luajit` \ # for lua support
475      ..
476make
477sudo make install
478cmake -DPYTHON_CMD=python3 .. # build python3 binding
479pushd src/python/
480make
481sudo make install
482popd
483```
484
485## Centos - Source
486
487For Centos 7.6 only
488
489### Install build dependencies
490
491```
492sudo yum install -y epel-release
493sudo yum update -y
494sudo yum groupinstall -y "Development tools"
495sudo yum install -y elfutils-libelf-devel cmake3 git bison flex ncurses-devel
496sudo yum install -y luajit luajit-devel  # for Lua support
497```
498
499### Install and compile LLVM
500
501You could compile LLVM from source code
502
503```
504curl  -LO  http://releases.llvm.org/7.0.1/llvm-7.0.1.src.tar.xz
505curl  -LO  http://releases.llvm.org/7.0.1/cfe-7.0.1.src.tar.xz
506tar -xf cfe-7.0.1.src.tar.xz
507tar -xf llvm-7.0.1.src.tar.xz
508
509mkdir clang-build
510mkdir llvm-build
511
512cd llvm-build
513cmake3 -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
514  -DCMAKE_BUILD_TYPE=Release ../llvm-7.0.1.src
515make
516sudo make install
517
518cd ../clang-build
519cmake3 -G "Unix Makefiles" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
520  -DCMAKE_BUILD_TYPE=Release ../cfe-7.0.1.src
521make
522sudo make install
523cd ..
524```
525
526or install from centos-release-scl
527
528```
529yum install -y centos-release-scl
530yum-config-manager --enable rhel-server-rhscl-7-rpms
531yum install -y devtoolset-7 llvm-toolset-7 llvm-toolset-7-llvm-devel llvm-toolset-7-llvm-static llvm-toolset-7-clang-devel
532source scl_source enable devtoolset-7 llvm-toolset-7
533```
534
535For permanently enable scl environment, please check https://access.redhat.com/solutions/527703.
536
537### Install and compile BCC
538
539```
540git clone https://github.com/iovisor/bcc.git
541mkdir bcc/build; cd bcc/build
542cmake3 ..
543make
544sudo make install
545```
546
547## Amazon Linux 1 - Source
548
549Tested on Amazon Linux AMI release 2018.03 (kernel 4.14.47-56.37.amzn1.x86_64)
550
551### Install packages required for building
552```
553# enable epel to get iperf, luajit, luajit-devel, cmake3 (cmake3 is required to support c++11)
554sudo yum-config-manager --enable epel
555
556sudo yum install -y bison cmake3 ethtool flex git iperf libstdc++-static python-netaddr python-cachetools gcc gcc-c++ make zlib-devel elfutils-libelf-devel
557sudo yum install -y luajit luajit-devel
558sudo yum install -y http://repo.iovisor.org/yum/extra/mageia/cauldron/x86_64/netperf-2.7.0-1.mga6.x86_64.rpm
559sudo pip install pyroute2
560sudo yum install -y ncurses-devel
561```
562
563### Install clang 3.7.1 pre-built binaries
564```
565wget http://releases.llvm.org/3.7.1/clang+llvm-3.7.1-x86_64-fedora22.tar.xz
566tar xf clang*
567(cd clang* && sudo cp -R * /usr/local/)
568```
569
570### Build bcc
571```
572git clone https://github.com/iovisor/bcc.git
573pushd .
574mkdir bcc/build; cd bcc/build
575cmake3 ..
576time make
577sudo make install
578popd
579```
580
581### Setup required to run the tools
582```
583sudo yum -y install kernel-devel-$(uname -r)
584sudo mount -t debugfs debugfs /sys/kernel/debug
585```
586
587### Test
588```
589sudo /usr/share/bcc/tools/execsnoop
590```
591
592## Amazon Linux 2 - Source
593
594```
595# enable epel to get iperf, luajit, luajit-devel, cmake3 (cmake3 is required to support c++11)
596sudo yum-config-manager --enable epel
597
598sudo yum install -y bison cmake3 ethtool flex git iperf libstdc++-static python-netaddr python-cachetools gcc gcc-c++ make zlib-devel elfutils-libelf-devel
599sudo yum install -y luajit luajit-devel
600sudo yum install -y http://repo.iovisor.org/yum/extra/mageia/cauldron/x86_64/netperf-2.7.0-1.mga6.x86_64.rpm
601sudo pip install pyroute2
602sudo yum install -y ncurses-devel
603```
604
605### Install clang
606```
607yum install -y clang llvm llvm-devel llvm-static clang-devel clang-libs
608```
609
610### Build bcc
611```
612git clone https://github.com/iovisor/bcc.git
613pushd .
614mkdir bcc/build; cd bcc/build
615cmake3 ..
616time make
617sudo make install
618popd
619```
620
621### Setup required to run the tools
622```
623sudo yum -y install kernel-devel-$(uname -r)
624sudo mount -t debugfs debugfs /sys/kernel/debug
625```
626
627### Test
628```
629sudo /usr/share/bcc/tools/execsnoop
630```
631
632## Alpine - Source
633
634### Install packages required for building
635
636```
637sudo apk add tar git build-base iperf linux-headers llvm10-dev llvm10-static \
638  clang-dev clang-static cmake python3 flex-dev bison luajit-dev elfutils-dev \
639  zlib-dev
640```
641
642### Build bcc
643
644```
645git clone https://github.com/iovisor/bcc.git
646mkdir bcc/build; cd bcc/build
647# python2 can be substituted here, depending on your environment
648cmake -DPYTHON_CMD=python3 ..
649make && sudo make install
650
651# Optional, but needed if you don't have /usr/bin/python on your system
652ln -s $(which python3) /usr/bin/python
653```
654
655### Test
656
657```
658sudo /usr/share/bcc/tools/execsnoop
659```
660
661## Arch - Source
662
663### Install dependencies
664
665```
666pacman -S cmake clang llvm flex bison python
667```
668
669### Build bcc
670
671```
672git clone https://github.com/iovisor/bcc.git
673pushd .
674mkdir bcc/build
675cd bcc/build
676cmake .. -DPYTHON_CMD=python3 # for python3 support
677make -j$(nproc)
678sudo make install
679cd src/python
680make -j$(nproc)
681sudo make install
682popd
683```
684
685# Older Instructions
686
687## Build LLVM and Clang development libs
688
689```
690git clone https://github.com/llvm/llvm-project.git
691mkdir -p llvm-project/llvm/build/install
692cd llvm-project/llvm/build
693cmake -G "Ninja" -DLLVM_TARGETS_TO_BUILD="BPF;X86" \
694  -DLLVM_ENABLE_PROJECTS="clang" \
695  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/install ..
696ninja && ninja install
697export PATH=$PWD/install/bin:$PATH
698```
699