Skip to content

Commit 9520db0

Browse files
mbmtbtbcgodlygeek
authored andcommitted
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.
1 parent 1de2b1c commit 9520db0

3 files changed

Lines changed: 7 additions & 44 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Once the codespace is ready, all dependencies will be installed and hooks
2525
will be configured automatically.
2626

2727
Note that the dev container is built from the project's `Dockerfile`, which
28-
compiles `elfutils` from source, so the first build takes a few minutes.
28+
uses the distribution-provided `libdw` and `libelf` development packages.
2929

3030
pystack requires elevated ptrace permissions to inspect processes — the dev
3131
container already handles this via `--cap-add=SYS_PTRACE` and

Dockerfile

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,4 @@
1-
# Stage 1: Elfutils build stage
2-
FROM ubuntu:26.04 AS elfutils_builder
3-
ARG DEBIAN_FRONTEND=noninteractive
4-
ENV VERS=0.193
5-
6-
# Install elfutils build dependencies
7-
RUN apt-get update \
8-
&& apt-get install -y --force-yes --no-install-recommends software-properties-common gpg-agent \
9-
build-essential \
10-
libzstd-dev \
11-
ca-certificates \
12-
curl \
13-
lsb-release \
14-
bzip2 \
15-
zlib1g-dev \
16-
zlib1g-dev:native \
17-
libbz2-dev \
18-
liblzma-dev \
19-
gettext \
20-
po-debconf \
21-
gawk \
22-
libc6-dbg \
23-
flex \
24-
bison \
25-
pkg-config \
26-
libarchive-dev \
27-
libcurl4-gnutls-dev \
28-
&& apt-get clean \
29-
&& rm -rf /var/lib/apt/lists/* \
30-
&& mkdir /elfutils \
31-
&& cd /elfutils \
32-
&& curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2 \
33-
&& tar -xf elfutils.tar.bz2 --strip-components 1 \
34-
&& CFLAGS='-Wno-error -g -O3' CXXFLAGS='-Wno-error -g -O3' ./configure --disable-nls --enable-libdebuginfod=dummy --disable-debuginfod --with-zstd \
35-
&& make install
36-
37-
# Stage 2: Final stage
1+
# Build stage
382
FROM ubuntu:26.04
393
ARG DEBIAN_FRONTEND=noninteractive
404
LABEL org.opencontainers.image.source="https://github.com/bloomberg/pystack"
@@ -57,21 +21,19 @@ RUN apt-get update \
5721
liblzma-dev \
5822
libbz2-dev \
5923
zlib1g-dev \
24+
libdw-dev \
25+
libelf-dev \
6026
&& apt-get clean \
6127
&& rm -rf /var/lib/apt/lists/* /etc/debuginfod/*.urls
6228

63-
# Copy the installed files from the elfutils_builder stage
64-
COPY --from=elfutils_builder /usr/local /usr/local
65-
6629
# Install uv
6730
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
6831

6932
# Set environment variables
7033
ENV VIRTUAL_ENV="/venv" \
7134
PATH="/venv/bin:/root/.local/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin" \
7235
PYTHONDONTWRITEBYTECODE=1 \
73-
TZ=UTC \
74-
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
36+
TZ=UTC
7537

7638
# Install Python interpreters via uv, and install setuptools for each
7739
RUN uv_versions="3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15" \

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,14 @@ skip = "*-musllinux_aarch64"
121121
[tool.cibuildwheel.linux]
122122
before-all = [
123123
"yum install -y libzstd-devel cmake",
124+
"yum install -y devtoolset-10-make || true", # Install a new enough GNU make on manylinux2014
124125
"cd /",
125126
"VERS=0.195",
126127
"curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2",
127128
"tar -xf elfutils.tar.bz2",
128129
"cd elfutils-$VERS",
129130
"CFLAGS='-Wno-error -g -O3' CXXFLAGS='-Wno-error -g -O3' ./configure --disable-nls --enable-libdebuginfod=dummy --disable-debuginfod --with-zstd",
130-
"make install"
131+
'PATH="/opt/rh/devtoolset-10/root/usr/bin/:$PATH" make install', # Ensure we pick up gnu make 4.x on manylinux2014
131132
]
132133

133134
# Override the default linux before-all for musl linux

0 commit comments

Comments
 (0)