From 0cbab12f76f32a035711938f4bc98c47736d4a5e Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Mon, 19 May 2025 23:00:01 -0400 Subject: [PATCH 1/4] ci: Upgrade to cibuildwheel 3.0.0b1 This is necessary for building Python 3.14 wheels. Signed-off-by: Matt Wozniski --- .github/workflows/build_wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 3fc9d157..574b239e 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -66,11 +66,11 @@ jobs: run: | tar zxvf *.tar.gz --strip-components=1 - name: Build wheels - uses: pypa/cibuildwheel@v2.22.0 + uses: pypa/cibuildwheel@v3.0.0b1 env: CIBW_BUILD: "cp3{7..13}-${{ matrix.wheel_type }}" CIBW_ARCHS_LINUX: auto aarch64 - CIBW_PRERELEASE_PYTHONS: True + CIBW_ENABLE: cpython-prerelease - uses: actions/upload-artifact@v4 with: name: ${{ matrix.wheel_type }}-wheels From e461b68260377cb8384c20d197c337bd4be3b3a3 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Mon, 19 May 2025 23:14:22 -0400 Subject: [PATCH 2/4] Switch from musllinux_1_1 to musllinux_1_2 The `musllinux_1_1` image is past end of life. Switch to `musllinux_1_2` instead. Signed-off-by: Matt Wozniski --- news/237.removal.1.rst | 1 + pyproject.toml | 25 +++++++------------------ 2 files changed, 8 insertions(+), 18 deletions(-) create mode 100644 news/237.removal.1.rst diff --git a/news/237.removal.1.rst b/news/237.removal.1.rst new file mode 100644 index 00000000..338843c8 --- /dev/null +++ b/news/237.removal.1.rst @@ -0,0 +1 @@ +We no longer provide x86-64 musllinux_1_1 wheels. The manylinux project dropped support for musllinux_1_1 on November 1st, 2024. diff --git a/pyproject.toml b/pyproject.toml index 84f6a0dc..c6e05bae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,7 +46,7 @@ underlines = "-~" build = ["cp38-*", "cp39-*", "cp310-*", "cp311-*"] manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" -musllinux-x86_64-image = "musllinux_1_1" +musllinux-x86_64-image = "musllinux_1_2" skip = "*-musllinux_aarch64" [tool.cibuildwheel.linux] @@ -70,34 +70,23 @@ before-all = [ # dependency of elfutils. "apk del gettext-dev glib-dev", - # Build musl-fts from source. This is a build dependency of elfutils, but - # isn't in the Alpine repos of the musllinux_1_1 image. The build steps come - # from https://git.alpinelinux.org/aports/tree/main/musl-fts/APKBUILD - # Setting PATH before calling boostrap.sh fixes an automake failure. I think - # the failure may be caused by a different pkg-config in /usr/local/bin. - "cd /", - "apk add --update automake autoconf libtool", - "VERS=1.2.7", - "curl -L https://github.com/void-linux/musl-fts/archive/refs/tags/v$VERS.tar.gz > ./musl-fts.tar.gz", - "tar -xf musl-fts.tar.gz", - "cd musl-fts-$VERS", - "PATH=/usr/bin:/bin ./bootstrap.sh", - "CFLAGS=-fPIC ./configure --prefix=/usr", - "make install", - # Build the latest elfutils from source. The build steps come from # https://git.alpinelinux.org/aports/tree/main/elfutils, and the need to # set the FNM_EXTMATCH macro to get the build to succeed is seen here: # 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-libintl musl-obstack-dev xz-dev zlib-dev zstd-dev", + "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", "VERS=0.189", "curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2", "tar -xf elfutils.tar.bz2", "cd elfutils-$VERS", "patch libdwfl/dwfl_segment_report_module.c < {package}/build_scripts/elfutils_contiguous_segments.diff", "CFLAGS='-w -DFNM_EXTMATCH=0' ./configure --prefix=/usr --disable-nls --disable-libdebuginfod --disable-debuginfod --with-zstd", - "make install" + "make install", + + # Reinstall libintl, as the Python interpreter requires it + "apk del musl-libintl", + "apk add libintl", ] [tool.coverage.run] From ffacdf88998e2294eb54c12ef21106cda3069182 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Tue, 20 May 2025 01:41:38 -0400 Subject: [PATCH 3/4] Stop shipping Python 3.7 wheels Python 3.7 has been end-of-life since June 2023, and is not supported by any version of cibuildwheel which also supports Python 3.14. Continue testing that we can attach to a running Python 3.7 process or debug a core file left by one from a newer version of Python. Signed-off-by: Matt Wozniski --- .github/workflows/build_wheels.yml | 11 +++++++---- news/237.removal.2.rst | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 news/237.removal.2.rst diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index 574b239e..6c635074 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -68,7 +68,7 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v3.0.0b1 env: - CIBW_BUILD: "cp3{7..13}-${{ matrix.wheel_type }}" + CIBW_BUILD: "cp3{8..13}-${{ matrix.wheel_type }}" CIBW_ARCHS_LINUX: auto aarch64 CIBW_ENABLE: cpython-prerelease - uses: actions/upload-artifact@v4 @@ -82,7 +82,7 @@ jobs: strategy: fail-fast: false matrix: - python_version: ["2.7"] + python_version: ["2.7", "3.7"] steps: - uses: actions/checkout@v4 - uses: actions/download-artifact@v4 @@ -99,7 +99,10 @@ jobs: sudo apt-get update sudo apt-get install -qy \ gdb \ - python2.7-dev python2.7-dbg + python${{ matrix.python_version }}-dev \ + python${{ matrix.python_version }}-dbg + sudo apt-get install -qy \ + python${{ matrix.python_version }}-distutils || true - name: Install Python dependencies run: | python3 -m pip install --upgrade pip @@ -119,7 +122,7 @@ jobs: strategy: fail-fast: false matrix: - python_version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python_version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Set up Python diff --git a/news/237.removal.2.rst b/news/237.removal.2.rst new file mode 100644 index 00000000..3022c07f --- /dev/null +++ b/news/237.removal.2.rst @@ -0,0 +1 @@ +We no longer provide Python 3.7 wheels. Python 3.7 has been end-of-life since June 2023. From 0789c64494177a441f1ef4a465c1605164903169 Mon Sep 17 00:00:00 2001 From: Matt Wozniski Date: Mon, 19 May 2025 23:42:27 -0400 Subject: [PATCH 4/4] Upgrade from elfutils 0.189 to 0.193 Drop our patch for correctly handling core files with non-contiguous segments. This patch made it into the upstream 0.191 release. Work around some new warnings that appear when building `elfutils` on musl by setting `-Wno-error` in both `CFLAGS` and `CXXFLAGS`. While we're at it, standardize the flags used for building `elfutils` across `manylinux` and `musllinux`. Signed-off-by: Matt Wozniski --- Dockerfile | 4 +- MANIFEST.in | 1 - .../elfutils_contiguous_segments.diff | 66 ------------------- pyproject.toml | 12 ++-- 4 files changed, 7 insertions(+), 76 deletions(-) delete mode 100644 build_scripts/elfutils_contiguous_segments.diff diff --git a/Dockerfile b/Dockerfile index db03fdd1..aa7a050f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ # Stage 1: Elfutils build stage FROM ubuntu:22.04 AS elfutils_builder ARG DEBIAN_FRONTEND=noninteractive -ENV VERS=0.189 +ENV VERS=0.193 # Install elfutils build dependencies RUN apt-get update \ @@ -31,7 +31,7 @@ RUN apt-get update \ && 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='-w' ./configure --prefix=/usr/local --disable-nls --disable-debuginfod --enable-libdebuginfod=dummy --with-zstd \ + && 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 diff --git a/MANIFEST.in b/MANIFEST.in index d8053ae3..def84573 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -14,7 +14,6 @@ include README.md include src/pystack/py.typed include .bumpversion.cfg include .pre-commit-config.yaml -include build_scripts/elfutils_contiguous_segments.diff recursive-include src/pystack/_pystack * recursive-include src/pystack *.py diff --git a/build_scripts/elfutils_contiguous_segments.diff b/build_scripts/elfutils_contiguous_segments.diff deleted file mode 100644 index 37b1a4dd..00000000 --- a/build_scripts/elfutils_contiguous_segments.diff +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c -index 3ef62a7d..09ee37b3 100644 ---- a/libdwfl/dwfl_segment_report_module.c -+++ b/libdwfl/dwfl_segment_report_module.c -@@ -737,17 +737,34 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, - && invalid_elf (module->elf, module->disk_file_has_build_id, - &build_id)) - { -- elf_end (module->elf); -- close (module->fd); -- module->elf = NULL; -- module->fd = -1; -+ /* If MODULE's build-id doesn't match the disk file's -+ build-id, close ELF only if MODULE and ELF refer to -+ different builds of files with the same name. This -+ prevents premature closure of the correct ELF in cases -+ where segments of a module are non-contiguous in memory. */ -+ if (name != NULL && module->name[0] != '\0' -+ && strcmp (basename (module->name), basename (name)) == 0) -+ { -+ elf_end (module->elf); -+ close (module->fd); -+ module->elf = NULL; -+ module->fd = -1; -+ } - } -- if (module->elf != NULL) -+ else if (module->elf != NULL) - { -- /* Ignore this found module if it would conflict in address -- space with any already existing module of DWFL. */ -+ /* This module has already been reported. */ - skip_this_module = true; - } -+ else -+ { -+ /* Only report this module if we haven't already done so. */ -+ for (Dwfl_Module *mod = dwfl->modulelist; mod != NULL; -+ mod = mod->next) -+ if (mod->low_addr == module_start -+ && mod->high_addr == module_end) -+ skip_this_module = true; -+ } - } - if (skip_this_module) - goto out; -@@ -781,10 +798,6 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, - } - } - -- /* Our return value now says to skip the segments contained -- within the module. */ -- ndx = addr_segndx (dwfl, segment, module_end, true); -- - /* Examine its .dynamic section to get more interesting details. - If it has DT_SONAME, we'll use that as the module name. - If it has a DT_DEBUG, then it's actually a PIE rather than a DSO. -@@ -929,6 +942,8 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, - ndx = -1; - goto out; - } -+ else -+ ndx++; - - /* We have reported the module. Now let the caller decide whether we - should read the whole thing in right now. */ diff --git a/pyproject.toml b/pyproject.toml index c6e05bae..ed5f9c86 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -51,14 +51,13 @@ skip = "*-musllinux_aarch64" [tool.cibuildwheel.linux] before-all = [ - "yum install -y python-devel-2.7.5", + "yum install -y python-devel-2.7.5 libzstd-devel", "cd /", - "VERS=0.189", + "VERS=0.193", "curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2", "tar -xf elfutils.tar.bz2", "cd elfutils-$VERS", - "patch libdwfl/dwfl_segment_report_module.c < {package}/build_scripts/elfutils_contiguous_segments.diff", - "CFLAGS='-w' ./configure --enable-libdebuginfod=dummy --disable-debuginfod --prefix=/usr --libdir=/usr/lib64", + "CFLAGS='-Wno-error -g -O3' CXXFLAGS='-Wno-error -g -O3' ./configure --disable-nls --enable-libdebuginfod=dummy --disable-debuginfod --with-zstd", "make install" ] @@ -76,12 +75,11 @@ 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", - "VERS=0.189", + "VERS=0.193", "curl https://sourceware.org/elfutils/ftp/$VERS/elfutils-$VERS.tar.bz2 > ./elfutils.tar.bz2", "tar -xf elfutils.tar.bz2", "cd elfutils-$VERS", - "patch libdwfl/dwfl_segment_report_module.c < {package}/build_scripts/elfutils_contiguous_segments.diff", - "CFLAGS='-w -DFNM_EXTMATCH=0' ./configure --prefix=/usr --disable-nls --disable-libdebuginfod --disable-debuginfod --with-zstd", + "CFLAGS='-Wno-error -DFNM_EXTMATCH=0 -g -O3' CXXFLAGS='-Wno-error -g -O3' ./configure --disable-nls --enable-libdebuginfod=dummy --disable-debuginfod --with-zstd", "make install", # Reinstall libintl, as the Python interpreter requires it