Skip to content

fix: support building on Alpine Linux 3.17+ (musl) without libexecinfo-dev#204

Merged
M-Elsaeed merged 8 commits into
aws:mainfrom
M-Elsaeed:fix/alpine-musl-execinfo-build
Jun 24, 2026
Merged

fix: support building on Alpine Linux 3.17+ (musl) without libexecinfo-dev#204
M-Elsaeed merged 8 commits into
aws:mainfrom
M-Elsaeed:fix/alpine-musl-execinfo-build

Conversation

@M-Elsaeed

@M-Elsaeed M-Elsaeed commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

On Alpine Linux 3.17+, libexecinfo-dev was removed because musl libc does not support execinfo.h. This causes pip install awslambdaric to fail when building from source on Alpine (no musllinux wheels are published):

backward.h:238:22: fatal error: execinfo.h: No such file or directory

Fix

Make backward.cpp compilation conditional on execinfo.h availability in the bundled aws-lambda-cpp-0.2.6 CMakeLists.txt. When execinfo.h is absent, stack trace support is disabled but all Lambda RIC functionality works correctly.

include(CheckIncludeFileCXX)
check_include_file_cxx("execinfo.h" HAVE_EXECINFO_H)
if (HAVE_EXECINFO_H)
    target_sources(${PROJECT_NAME} PRIVATE "src/backward.cpp")
else()
    message("-- execinfo.h not found, stack traces disabled (musl/Alpine Linux)")
endif()

Testing

Verified with Docker on python:3.12-alpine3.20 (autoconf 2.72, no libexecinfo-dev):

  • ✅ Builds successfully
  • import awslambdaric works
  • ✅ No regression on glibc systems (execinfo.h found → backward.cpp compiled as before)

Context

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

On musl-based systems (Alpine Linux 3.17+), execinfo.h is not available
as the libexecinfo package was removed. This causes a build failure in
the bundled aws-lambda-cpp when backward.cpp is compiled.

This change makes backward.cpp compilation conditional on execinfo.h
availability via CMake's check_include_file_cxx. When absent, stack
trace support is disabled but all RIC functionality works correctly.

Fixes #128
Relates to #144
@M-Elsaeed M-Elsaeed marked this pull request as draft June 9, 2026 13:43
M-Elsaeed and others added 7 commits June 23, 2026 17:03
…ball

The tarball was repacked on macOS, adding 69 ._* resource-fork files.
This strips them; the only real-content change remains the CMakeLists.txt
execinfo.h guard. Real file contents are byte-identical to the prior commit.
Adds a job that runs the documented end-user 'pip install .' flow (BUILD
unset, so the native aws-lambda-cpp extension is actually compiled) and
asserts the runtime_client extension imports.

Covers the full Alpine range that dropped libexecinfo-dev (3.17-3.21) -
the integration-test matrix only starts at 3.19 - plus a glibc Debian
check to ensure stack-trace support still compiles where execinfo.h exists.
Directly guards against regressions of issue #128.
Per review feedback, collapse the per-Alpine-version matrix into a single
representative row per OS family, pinned to the newest Python (3.14):
alpine 3.21, debian bookworm, ubuntu 24.04, amazonlinux2023. Reuses the
per-OS Dockerfiles + RIE invoke. The Alpine (musl) row still guards the
libexecinfo/execinfo.h regression from #128. Amazon Linux 2 is omitted as
it does not provide Python 3.14.
Two changes so the suite is non-redundant and matches customer behavior:

1. Remove elfutils-dev from Dockerfile.echo.alpine. With libdw present,
   backward-cpp uses the DWARF backend and never includes execinfo.h, which
   masked the musl/Alpine build failure (#128) - the CI built clean even on
   Alpine 3.17+ while real customers (minimal documented deps, no elfutils-dev)
   failed. Without it the integration test now exercises the execinfo.h path
   and genuinely guards the fix. Verified: pre-fix code now fails the Alpine
   build with 'execinfo.h: No such file', fixed code builds and invokes.

2. Remove the pip-install-from-source job: it reused the same per-OS
   Dockerfiles + RIE invoke as integration-test, so it duplicated coverage.
   With change (1), integration-test already covers the customer install path
   across all supported OS/Python combinations.
The README listed Alpine as supported but only documented Debian/Ubuntu
build dependencies. Add an Alpine section: since no musllinux wheels are
published, the client always builds from source on Alpine, and the minimal
images need the full toolchain via apk. Notes that libexecinfo-dev is no
longer required (removed in Alpine 3.17+), reflecting the execinfo.h fix.

Verified the documented apk set builds and imports cleanly on
python:3.13-alpine3.20.

@darklight3it darklight3it left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@M-Elsaeed M-Elsaeed marked this pull request as ready for review June 24, 2026 14:03
@M-Elsaeed M-Elsaeed merged commit d3e9632 into aws:main Jun 24, 2026
34 checks passed
M-Elsaeed added a commit to M-Elsaeed/aws-lambda-python-runtime-interface-client that referenced this pull request Jun 25, 2026
Bump version to 4.0.1 and update changelog for the Alpine Linux 3.17+
(musl) build fix (aws#204).
M-Elsaeed added a commit to M-Elsaeed/aws-lambda-python-runtime-interface-client that referenced this pull request Jun 25, 2026
Bump version to 4.0.1 and update changelog for the Alpine Linux 3.17+
(musl) build fix (aws#204).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error : libexecinfo-dev package not found

3 participants