Skip to content

Commit

Permalink
Update to 0.19.1
Browse files Browse the repository at this point in the history
  • Loading branch information
wdoekes committed Apr 3, 2024
1 parent 8805856 commit 3ca2f03
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 65 deletions.
60 changes: 19 additions & 41 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ ARG DEBIAN_FRONTEND=noninteractive
RUN echo 'APT::Install-Recommends "0";' >/etc/apt/apt.conf.d/01norecommends
# We'll be ignoring "debconf: delaying package configuration, since apt-utils
# is not installed"
RUN . /etc/os-release && \
apt-get update -q && \
RUN apt-get update -q && \
apt-get dist-upgrade -y && \
apt-get install -y $force \
apt-get install -y \
ca-certificates curl \
build-essential devscripts dh-autoreconf dpkg-dev equivs quilt && \
printf "%s\n" \
Expand All @@ -28,20 +27,7 @@ RUN . /etc/os-release && \

# Apt-get prerequisites according to control file.
COPY control /build/debian/control
RUN . /etc/os-release && \
mk-build-deps --install --remove --tool "apt-get -y" /build/debian/control
RUN . /etc/os-release && case $VERSION_ID in \
8) \
cd /build && \
curl https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.39/pcre2-10.39.tar.gz \
-sSfLo pcre2-10.39.tar.gz.tar.gz && \
test $(md5sum /build/pcre2-10.39.tar.gz.tar.gz | awk '{print $1}' | tee /dev/stderr) = 7389e3524de2cda3d21fde8c224febf1 && \
tar zxf pcre2-10.39.tar.gz.tar.gz && \
cd pcre2-10.39 && \
CFLAGS='-fPIC -O2' ./configure --enable-shared=no --enable-static=yes && \
make -j6 && \
make install;; \
esac
RUN mk-build-deps --install --remove --tool "apt-get -y" /build/debian/control

# debian, deb, jessie, bpftrace, 0.17.1, '', 0osso0
ARG osdistro osdistshort oscodename upname upversion debepoch= debversion
Expand All @@ -61,18 +47,20 @@ RUN . /etc/os-release && \
# is made conditional by the "[z]" "wildcard". (We need one existing
# file (README.rst) so the COPY doesn't fail.)
COPY ./README.rst .cache/${upname}_${upversion}.orig.tar.g[z] /build/
# http://archive.ubuntu.com/ubuntu/pool/universe/b/bpftrace/bpftrace_0.20.2.orig.tar.gz
# 593db18cf2b541d1f0026d7dc9796269
# https://github.com/bpftrace/bpftrace/archive/refs/tags/v0.17.1.tar.gz
# 41c7966d306f0e098719374e5d24eae1
RUN if ! test -s /build/${upname}_${upversion}.orig.tar.gz; then \
#url="http://archive.ubuntu.com/ubuntu/pool/universe/b/${upname}/${upname}_${upversion}.orig.tar.gz" && \
url="https://github.com/${upname}/${upname}/archive/refs/tags/v${upversion}.tar.gz" && \
echo "Fetching: ${url}" >&2 && \
curl -fLsS "${url}" -o /build/${upname}_${upversion}.orig.tar.gz; fi
# 3f464e9187dc812af140dd0f3f1c58f7 = 0.18.6
RUN test $(md5sum /build/${upname}_${upversion}.orig.tar.gz | awk '{print $1}' | \
tee /dev/stderr) = 41c7966d306f0e098719374e5d24eae1
RUN sum=$(md5sum /build/${upname}_${upversion}.orig.tar.gz | awk '{print $1}') && \
echo "${upversion}: ${sum}" >&2 && \
case ${upversion} in \
0.20.3) test "$sum" = 2fad05fd87ccefce5bc58e4f2bc3674a;; \
0.20.2) test "$sum" = 593db18cf2b541d1f0026d7dc9796269;; \
0.19.1) test "$sum" = 9a371dffc71824214dc0dd3d57ba3c80;; \
0.17.1) test "$sum" = 41c7966d306f0e098719374e5d24eae1;; \
*) false;; \
esac
RUN cd /build && tar zxf "${upname}_${upversion}.orig.tar.gz" && \
mv debian "${upname}-${upversion}/"
COPY . /build/${upname}-${upversion}/debian/
Expand All @@ -87,31 +75,21 @@ RUN rm -rf \
WORKDIR /build/${upname}-${upversion}

# FIXME: Better/earlier download?
# FIXME: md5sum
RUN curl -fLsS https://github.com/libbpf/libbpf/archive/refs/tags/v1.4.0.tar.gz \
-o ../libbpf-1.4.0.tar.gz && \
tar zxf ../libbpf-1.4.0.tar.gz && rmdir libbpf && ln -s libbpf-1.4.0 libbpf
echo '1d1ecd6073cd59f96e780d9858dcde9b ../libbpf-1.4.0.tar.gz' | md5sum -c && \
tar zxf ../libbpf-1.4.0.tar.gz && { rmdir libbpf || true; } && ln -s libbpf-1.4.0 libbpf
RUN curl -fLsS https://github.com/iovisor/bcc/archive/refs/tags/v0.30.0.tar.gz \
-o ../bcc-0.30.0.tar.gz && \
tar zxf ../bcc-0.30.0.tar.gz && rmdir bcc && ln -s bcc-0.30.0 bcc
echo '9d02f4ac5813052cdf449954c945940a ../bcc-0.30.0.tar.gz' | md5sum -c && \
tar zxf ../bcc-0.30.0.tar.gz && { rmdir bcc || true; } && ln -s bcc-0.30.0 bcc
# Ignore these extra files in the source dir when checking for changes.
RUN ! test -f debian/source/options && \
echo 'extend-diff-ignore = "^bcc.*|^libbpf.*"' >debian/source/options
RUN apt-get install -y arping git git-man iperf libbsd-dev \
libcurl3-gnutls libdbus-1-3 libdebuginfod-common libdebuginfod-dev \
libdebuginfod1 libedit-dev liberror-perl libmd-dev libnet1 libpcap0.8 \
netperf python3-distutils

# /usr/bin/c++ -g -O2 -ffile-prefix-map=/build/bpftrace-0.17.1=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro CMakeFiles/bpftrace.dir/main.cpp.o -o bpftrace -Wl,-rpath,/usr/lib/llvm-14/lib: libbpftrace.a ../resources/libresources.a libruntime.a ../build-libs/lib64/libbpf.a ../build-libs/lib64/libbcc.a ../build-libs/lib64/libbcc_bpf.a ../build-libs/lib64/libbpf.a ../build-libs/lib64/libbcc.a ../build-libs/lib64/libbcc_bpf.a ../build-libs/lib64/libbcc-loader-static.a /usr/lib/x86_64-linux-gnu/libelf.so /usr/lib/x86_64-linux-gnu/libdw.so -lz aot/libaot.a ast/libast.a ../libparser.a ast/libast_defs.a /usr/lib/llvm-14/lib/libclang-14.so.1 /usr/lib/llvm-14/lib/libLLVM-14.so.1 arch/libarch.a cxxdemangler/libcxxdemangler_llvm.a
# ./src/driver.cpp:8:14: warning: 'yy_scan_string' violates the C++ One Definition Rule [-Wodr]
# .././obj-x86_64-linux-gnu/lex.yy.cc:2483:17: note: 'yy_scan_string' was previously declared here
# /usr/bin/ld: /tmp/cczqJGkl.ltrans12.ltrans.o: undefined reference to symbol 'lzma_stream_decoder@@XZ_5.0'
# /usr/bin/ld: /lib/x86_64-linux-gnu/liblzma.so.5: error adding symbols: DSO missing from command line
# collect2: error: ld returned 1 exit status
RUN sed -i -e 's/find_package(LibLzma)/#&/' bcc/CMakeLists.txt

# Build!
RUN DEB_BUILD_OPTIONS=parallel=6 dpkg-buildpackage -us -uc -sa || touch /tmp/fail
RUN ! test -f /tmp/fail
RUN DEB_BUILD_OPTIONS=parallel=6 dpkg-buildpackage -us -uc -sa #|| touch /tmp/fail
#RUN ! test -f /tmp/fail

# TODO: for bonus points, we could run quick tests here;
# for starters dpkg -i tests?
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
# Pass these on the command line.
oscodename=${1:-ubuntu/jammy} # ubuntu/jammy
upname=bpftrace
upversion=${2:-0.17.1} # bpftrace version
upversion=${2:-0.19.1} # bpftrace version
debepoch=
debversion=${3:-0osso0} # deb build version, e.g. 0osso2

Expand Down
32 changes: 10 additions & 22 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
OSSO build of bpftrace
======================

This enables builds for bpftrace 0.17.1 for *Ubuntu/Jammy*.
This enables builds for bpftrace 0.17.1 for *Ubuntu/Jammy*. Also
includes *Netflix* *bpftop* (v0.4.0) in /usr/sbin.


------------
Expand All @@ -16,27 +17,14 @@ And it will create the build files in ``Dockerfile.out/``.

For example::

$ ls -1 Dockerfile.out/jammy/bpftrace_0.17.1-0osso0+ubu22.04/
bpftrace_0.17.1-0osso0+ubu22.04_amd64.buildinfo
bpftrace_0.17.1-0osso0+ubu22.04_amd64.changes
bpftrace_0.17.1-0osso0+ubu22.04_amd64.deb
bpftrace_0.17.1-0osso0+ubu22.04.debian.tar.xz
bpftrace_0.17.1-0osso0+ubu22.04.dsc
bpftrace_0.17.1.orig.tar.gz


----
TODO
----

* Include bpftop in the release:
https://github.com/Netflix/bpftop/releases

* ``dpkg-shlibdeps: warning: package could avoid a useless dependency if
debian/bpftrace/usr/bin/bpftrace was not linked against libz.so.1 (it
uses none of the library's symbols)``

* Try newer builds than 0.17.1.
$ ls -1 Dockerfile.out/jammy/bpftrace_0.19.1-0osso0+ubu22.04
bpftrace_0.19.1-0osso0+ubu22.04_amd64.buildinfo
bpftrace_0.19.1-0osso0+ubu22.04_amd64.changes
bpftrace_0.19.1-0osso0+ubu22.04_amd64.deb
bpftrace_0.19.1-0osso0+ubu22.04.debian.tar.xz
bpftrace_0.19.1-0osso0+ubu22.04.dsc
bpftrace_0.19.1.orig.tar.gz
bpftrace-dbgsym_0.19.1-0osso0+ubu22.04_amd64.ddeb


-------
Expand Down
9 changes: 9 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
bpftrace (0.19.1-0osso0+REL) stable; urgency=medium

* Upgrade to 0.19.1. In 0bc46144 (Daniel Xu), the embedded build infra was
removed and we'd have to build bcc/libbpf separately. (Maybe local static
install?)

-- Walter Doekes <wjdoekes+bpftrace@osso.nl> Wed, 03 Apr 2024 13:54:31 +0200

bpftrace (0.17.1-0osso0+REL) stable; urgency=medium

* Take build directory from Ubuntu/Noble.
Expand All @@ -7,6 +15,7 @@ bpftrace (0.17.1-0osso0+REL) stable; urgency=medium
- Set -DUSE_SYSTEM_BPF_BCC=0 and build bcc/libbpf statically.
- Forcefully disable liblzma on bcc static library to avoid issue during
link time when -llzma is not specified.
- Do not strip bpftrace-aotrt which is not built.

-- Walter Doekes <wjdoekes+bpftrace@osso.nl> Wed, 03 Apr 2024 13:44:41 +0200

Expand Down
9 changes: 8 additions & 1 deletion rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

override_dh_auto_configure:
mkdir -vp obj-x86_64-linux-gnu && cd obj-x86_64-linux-gnu && \
../build-libs.sh
../build-libs.sh
dh_auto_configure -- -DBUILD_TESTING:BOOL=OFF -DUSE_SYSTEM_BPF_BCC=0

STRIP_CMD=strip --keep-symbol=BEGIN_trigger --keep-symbol=END_trigger --remove-section=.comment --remove-section=.note
Expand All @@ -24,3 +24,10 @@ override_dh_auto_install:
rm -rf debian/bpftrace/usr/share/bpftrace/tools/old
rmdir debian/bpftrace/usr/share/bpftrace/tools \
debian/bpftrace/usr/share/bpftrace

# Add some extra binaries
curl -fLsS https://github.com/Netflix/bpftop/releases/download/v0.4.0/bpftop \
-o debian/bpftrace/usr/sbin/bpftop-v0.4.0
echo 'a4cc9a3d87688fc861e039062dbaf55e debian/bpftrace/usr/sbin/bpftop-v0.4.0' | md5sum -c
chmod 755 debian/bpftrace/usr/sbin/bpftop-v0.4.0
ln -s bpftop-v0.4.0 debian/bpftrace/usr/sbin/bpftop

0 comments on commit 3ca2f03

Please sign in to comment.