Cannot build bpftrace_test by using Dockerfile.ubuntu
envgap__bpftrace__bpftrace-3972
01 / FAILURE SIGNATURE
As reported upstream
ERROR: failed to solve: process "/bin/sh -c make -C /build -j8" did not complete successfully: exit code: 2
Not a benchmark task.
- In a clean container the reported failure did not reproduce, or the known fix did not make the project run.
02 / ENVIRONMENT RECIPE
- Base commit
e66a9afba288ac5662bc38935d8339f4d628453d- Manifest
src/util/CMakeLists.txt- Reproduce
Awaiting issue-specific recipe- Run under trace
Awaiting a meaningful runtime command
03 / ORIGINAL ISSUE TEXT
bpftrace/bpftrace #3972 · read the original issue
<!--
Note: bpftrace is under active development and not all distros ship the most
recent version yet. Please make sure the bug reproduces on the latest release
or master.
-->
### What reproduces the bug? Provide code if possible.
Hi, I tried to use bpftrace/docker/Dockerfile.ubuntu to build bpftrace_test. And I got some error messages:
```bash
docker build -f docker/Dockerfile.ubuntu -t builder .
[+] Building 73.7s (11/11) FINISHED docker:default
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile.ubuntu 0.0s
=> => transferring dockerfile: 976B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:devel 3.1s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [1/6] FROM docker.io/library/ubuntu:devel@sha256:008b026f11c0b5653d564d0c9877a116770f06dfbdb36ca75c46f 0.0s
=> [internal] load build context 0.2s
=> => transferring context: 224.30kB 0.2s
=> CACHED [2/6] RUN apt-get update && apt-get install -y asciidoctor binutils-dev bison b 0.0s
=> CACHED [3/6] COPY . /src 0.0s
=> CACHED [4/6] WORKDIR /src 0.0s
=> CACHED [5/6] RUN cmake -B /build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug 0.0s
=> ERROR [6/6] RUN make -C /build -j8
------
> [6/6] RUN make -C /build -j8:
0.284 make: Entering directory '/build'
0.364 [ 0%] [BISON][bison_parser] Building parser with bison 3.8.2
0.375 [ 1%] Building CXX object src/debugfs/CMakeFiles/debugfs.dir/debugfs.cpp.o
....
60.87 [100%] Building CXX object tests/CMakeFiles/bpftrace_test.dir/utils.cpp.o
68.27 [100%] Linking CXX executable bpftrace_test
70.21 /usr/bin/ld: ../src/util/libutil.a(paths.cpp.o): undefined reference to symbol 'elf_version@@ELFUTILS_1.0'
70.21 /usr/bin/ld: /usr/lib/x86_64-linux-gnu/libelf.so: error adding symbols: DSO missing from command line
70.28 collect2: error: ld returned 1 exit status
70.29 make[2]: *** [tests/CMakeFiles/bpftrace_test.dir/build.make:657: tests/bpftrace_test] Error 1
70.29 make[1]: *** [CMakeFiles/Makefile2:2528: tests/CMakeFiles/bpftrace_test.dir/all] Error 2
70.29 make: *** [Makefile:146: all] Error 2
70.29 make: Leaving directory '/build'
------
Dockerfile.ubuntu:40
--------------------
38 | # Use CMAKE_BUILD_TYPE=Release if you don't plan on developing bpftrace
39 | RUN cmake -B /build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
40 | >>> RUN make -C /build -j8
41 |
42 | ENTRYPOINT ["/build/src/bpftrace"]
--------------------
ERROR: failed to solve: process "/bin/sh -c make -C /build -j8" did not complete successfully: exit code: 2
```
The Dockerfile.ubuntu I used is pasted down below:
Dockerfile.ubuntu:
```Dockerfile
# This Dockerfile is used to both document and test building bpftrace on the
# development version of ubuntu. We attempt to catch bugs as early as possible
# which is why we are using devel.
FROM ubuntu:devel
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
asciidoctor \
binutils-dev \
bison \
build-essential \
clang \
cmake \
flex \
libbpf-dev \
libbpfcc-dev \
libcereal-dev \
libdw-dev \
libelf-dev \
libiberty-dev \
libpcap-dev \
llvm-dev \
libclang-dev \
systemtap-sdt-dev \
zlib1g-dev \
liblldb-dev \
xxd \
pahole \
libgtest-dev \
libgmock-dev \
clang-format \
git
COPY . /src
WORKDIR /src
# Use CMAKE_BUILD_TYPE=Release if you don't plan on developing bpftrace
RUN cmake -B /build -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
RUN make -C /build -j$(nproc)
ENTRYPOINT ["/build/src/bpftrace"]
```
This is the environment I used to build bpttrace_test:
distros: Ubuntu 22.04.3 LTS
kernel: 6.5.0-21-generic
branch: master
latest commit: e66a9afba288ac5662bc38935d8339f4d628453d
### `bpftrace --info` output
04 / LABELS
Labels from the report text only; not yet run
No supported category has been assigned.
Label rules and the text that matched
[]