From 1de2b1cde724c4804f089b227d8fc5875e311949 Mon Sep 17 00:00:00 2001 From: Vaibhavi Yadav Date: Fri, 29 May 2026 18:08:50 +0530 Subject: [PATCH 1/2] Update the vendored elfutils to 0.195 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index b80cb06c..1bbd746b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,7 +122,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", @@ -144,7 +144,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", From 9520db06e025005571cc2a8b8bfc73dd82befc38 Mon Sep 17 00:00:00 2001 From: Vaibhavi Yadav Date: Fri, 29 May 2026 18:08:50 +0530 Subject: [PATCH 2/2] Use Ubuntu's elfutils in Docker and devcontainers Ubuntu currently ships 0.194, which is slightly older than the 0.195 that we vendor with cibuildwheel, but the Docker image is used only for testing, and so the only reason we'd need to use a newer version there is if we want to use a feature that's only available in a later version, or if we're affected by a bug in 0.194 that's fixed in a later version. If either of those ever happens, we can reintroduce the build from source at that point. --- CONTRIBUTING.md | 2 +- Dockerfile | 46 ++++------------------------------------------ pyproject.toml | 3 ++- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bbc251a7..2586c953 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -25,7 +25,7 @@ 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. +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 c56e376c..d6ada201 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" @@ -57,12 +21,11 @@ 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 - # Install uv COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv @@ -70,8 +33,7 @@ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv ENV VIRTUAL_ENV="/venv" \ PATH="/venv/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin" \ PYTHONDONTWRITEBYTECODE=1 \ - TZ=UTC \ - PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + TZ=UTC # Install Python interpreters via uv, and install setuptools for each RUN uv_versions="3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15" \ diff --git a/pyproject.toml b/pyproject.toml index 1bbd746b..f320c983 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -121,13 +121,14 @@ skip = "*-musllinux_aarch64" [tool.cibuildwheel.linux] before-all = [ "yum install -y libzstd-devel cmake", + "yum install -y devtoolset-10-make || true", # Install a new enough GNU make on manylinux2014 "cd /", "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", "CFLAGS='-Wno-error -g -O3' CXXFLAGS='-Wno-error -g -O3' ./configure --disable-nls --enable-libdebuginfod=dummy --disable-debuginfod --with-zstd", - "make install" + 'PATH="/opt/rh/devtoolset-10/root/usr/bin/:$PATH" make install', # Ensure we pick up gnu make 4.x on manylinux2014 ] # Override the default linux before-all for musl linux