Commit ca2110e7 authored by Brendan Gregg's avatar Brendan Gregg

update Ubuntu build instructions

parent c1d9ae0c
......@@ -27,22 +27,15 @@ To use some BPFtrace features, minimum kernel versions are required:
- CMake
- Flex
- Bison
- LLVM & Clang 5.0 development packages
- LLVM & Clang 5.0 (or 6.0) development packages
- LibElf
For example, installing the requirements on Ubuntu:
```
apt-get update
apt-get install -y bison cmake flex g++ git libclang-5.0-dev libelf-dev llvm-5.0-dev zlib1g-dev
```
### Compilation
See previous requirements.
See previous requirements, and specific targets in the sections that follow (Ubuntu, Docker).
```
git clone https://github.com/ajor/bpftrace
git clone https://github.com/iovisor/bpftrace
mkdir -p bpftrace/build
cd bpftrace/build
cmake -DCMAKE_BUILD_TYPE=Debug ../
......@@ -53,6 +46,41 @@ By default bpftrace will be built as a dynamically linked executable. If a stati
The latest versions of BCC and Google Test will be downloaded on each build. To speed up builds and only download their sources on the first run, use the CMake option `-DOFFLINE_BUILDS:BOOL=ON`.
To test that the build works, you can try running the test suite, and a one-liner:
```
./tests/bpftrace_test
./src/bpftrace -e 'kprobe:do_nanosleep { printf("sleep by %s\n", comm); }'
```
## Ubuntu
The llvm/clang packages that are currently available for Ubuntu have an issue, so we'll use the ones from llvm.org for now. The build instructions are:
```
vi /etc/apt/sources.list
---append---
# from https://apt.llvm.org/:
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial main
# 5.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-5.0 main
# 6.0
deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
deb-src http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main
---append---
apt-get update
apt-get install -y bison cmake flex g++ git libelf-dev zlib1g-dev libfl-dev
apt-get install clang-5.0 libclang-5.0-dev libclang-common-5.0-dev libclang1-5.0 libllvm5.0 llvm-5.0 llvm-5.0-dev llvm-5.0-runtime
git clone https://github.com/iovisor/bpftrace
cd bpftrace
mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=DEBUG ..
make -j8
```
The bpftrace binary will be in src/bpftrace under the build directory.
## Using Docker
Building inside a Docker container will produce a statically linked bpftrace executable.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment