From c806a760e83b2e00bc422328de8211c37d6ce5de Mon Sep 17 00:00:00 2001 From: mbmtbtbc Date: Fri, 29 May 2026 18:08:50 +0530 Subject: [PATCH] Update elfutils to 0.195 and use ubuntu apt packages in dockerfile --- CONTRIBUTING.md | 4 ++-- Dockerfile | 46 ++++------------------------------------------ pyproject.toml | 4 ++-- 3 files changed, 8 insertions(+), 46 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bbc251a7..18a1ea41 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,8 +24,8 @@ a ready-to-use environment directly: Once the codespace is ready, all dependencies will be installed and hooks will be configured automatically. -Note that the dev container is built from the project's `Dockerfile`, which -compiles `elfutils` from source, so the first build takes a few minutes. +Note that the dev container is built from the project's `Dockerfile`, which +uses the distribution-provided `libdw` and `libelf` development packages. pystack requires elevated ptrace permissions to inspect processes — the dev container already handles this via `--cap-add=SYS_PTRACE` and diff --git a/Dockerfile b/Dockerfile index ee929576..95e49fcf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,40 +1,4 @@ -# Stage 1: Elfutils build stage -FROM ubuntu:26.04 AS elfutils_builder -ARG DEBIAN_FRONTEND=noninteractive -ENV VERS=0.193 - -# Install elfutils build dependencies -RUN apt-get update \ - && apt-get install -y --force-yes --no-install-recommends software-properties-common gpg-agent \ - build-essential \ - libzstd-dev \ - ca-certificates \ - curl \ - lsb-release \ - bzip2 \ - zlib1g-dev \ - zlib1g-dev:native \ - libbz2-dev \ - liblzma-dev \ - gettext \ - po-debconf \ - gawk \ - libc6-dbg \ - flex \ - bison \ - pkg-config \ - libarchive-dev \ - libcurl4-gnutls-dev \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ - && mkdir /elfutils \ - && cd /elfutils \ - && curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2 \ - && tar -xf elfutils.tar.bz2 --strip-components 1 \ - && CFLAGS='-Wno-error -g -O3' CXXFLAGS='-Wno-error -g -O3' ./configure --disable-nls --enable-libdebuginfod=dummy --disable-debuginfod --with-zstd \ - && make install - -# Stage 2: Final stage +# Build stage FROM ubuntu:26.04 ARG DEBIAN_FRONTEND=noninteractive LABEL org.opencontainers.image.source="https://github.com/bloomberg/pystack" @@ -79,19 +43,17 @@ RUN apt-get update \ liblzma-dev \ libbz2-dev \ zlib1g-dev \ + libdw-dev \ + libelf-dev \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* /etc/debuginfod/*.urls -# Copy the installed files from the elfutils_builder stage -COPY --from=elfutils_builder /usr/local /usr/local - # Set environment variables ENV PYTHON=python3.12 \ VIRTUAL_ENV="/venv" \ PATH="/venv/bin:$PATH" \ PYTHONDONTWRITEBYTECODE=1 \ - TZ=UTC \ - PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + TZ=UTC # Copy the required files COPY pyproject.toml /tmp/ diff --git a/pyproject.toml b/pyproject.toml index c7b951c8..9421e1f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,7 +121,7 @@ skip = "*-musllinux_aarch64" before-all = [ "yum install -y libzstd-devel cmake", "cd /", - "VERS=0.193", + "VERS=0.195", "curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2", "tar -xf elfutils.tar.bz2", "cd elfutils-$VERS", @@ -143,7 +143,7 @@ before-all = [ # https://git.alpinelinux.org/aports/tree/main/elfutils/musl-macros.patch "cd /", "apk add --update argp-standalone bison bsd-compat-headers bzip2-dev flex-dev libtool linux-headers musl-fts-dev musl-libintl musl-obstack-dev xz-dev zlib-dev zstd-dev cmake", - "VERS=0.193", + "VERS=0.195", "curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2", "tar -xf elfutils.tar.bz2", "cd elfutils-$VERS",