bcc
bcc copied to clipboard
Build from source for Alpine Linux needs some modifications.
First, I tried to build a docker container with bcc using Alpine linux image (tag: Latest). But it showed some errors and seems it needs some updates. Here's my Dockerfile
FROM alpine:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apk --no-cache update
RUN apk --no-cache add tar git build-base iperf \
linux-headers llvm15-dev llvm15-static \
clang-dev clang-static cmake python3 \
flex-dev bison luajit-dev elfutils-dev \
zlib-dev musl xz zip
RUN git clone https://github.com/iovisor/bcc.git
RUN sed -i 's/error.h/err.h/' bcc/examples/cpp/KModRetExample.cc | cat -n
RUN mkdir bcc/build
WORKDIR bcc/build
RUN cmake -DPYTHON_CMD=python3 .. # build python3 binding
RUN make
RUN make install
WORKDIR /
There are three things to do in order to make things work.
- It needs extra packages such as xz, zip, and musl, which are not instructed in the INSTALL.MD.
- The llvm10, which is instructed in INSTALL.MD is not supported. So I changed it to llvm15.
- Alpine doesn't have error.h headerfile. So i switched 'error.h' from "bcc/usr/share/bcc/tools/execsnoop" up with 'err.h'.
These steps will solve things for now I guess. Any comments?
I could reproduce the problem and solve it by following the steps. Docs should be fixed!
This bit:
RUN sed -i 's/error.h/err.h/' bcc/examples/cpp/KModRetExample.cc | cat -n
is obsolete and actually wrong by now since neither error() (glibc) nor err() (musl variant) are used in KModRetExample.cc. The #include statement can simply be removed.