bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Build from source for Alpine Linux needs some modifications.

Open suhho1993 opened this issue 2 years ago • 2 comments

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.

  1. It needs extra packages such as xz, zip, and musl, which are not instructed in the INSTALL.MD.
  2. The llvm10, which is instructed in INSTALL.MD is not supported. So I changed it to llvm15.
  3. 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?

suhho1993 avatar Apr 27 '23 06:04 suhho1993

I could reproduce the problem and solve it by following the steps. Docs should be fixed!

changhoon-sung avatar Jan 09 '24 15:01 changhoon-sung

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.

hhoffstaette avatar Sep 11 '24 14:09 hhoffstaette