Skip to content

build: use lambda image to ensure binary compatibility when building from source #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 20, 2025

Conversation

florentinl
Copy link
Contributor

@florentinl florentinl commented Aug 18, 2025

What does this PR do?

This PR changes the base image for the layer creation process.

Instead of using the generic python image (docker/library/python based on debian), I suggest using the lambda python image (lambda/python based on AL2 or AL2023 depending on python3 version).

Motivation

ddtrace contains native dependencies which enforce a minimal version of glibc set by the version found at build time.
This means that the glibc version of the build image must be the same as (or older than) the glibc version of the runtime image.

When pushing wheels to PyPi, the dd-trace-py compiles native dependencies for the manylinux2014 target which uses an old version of glibc (2.17).

With the release of Debian Trixie last week, all python have now a newer version of glibc than Amazon Linux 2023 (2.34) and executing a function with a layer built from source for python3.13 yields the following error

 Runtime.ImportModuleError: Unable to import module 'datadog_lambda.handler': /lib64/libc.so.6: version `GLIBC_2.38' not found (required by /opt/python/lib/python3.13/site-packages/ddtrace/internal/native/_native.cpython-313-x86_64-linux-gnu.so)

By building on the same image used by the runtime, we ensure the binary compatibility.

Testing Guidelines

All builds in the CI and snapshot tests pass.

Additional Notes

This is a blocker for the enabling system-tests for lambda: https://github.com/DataDog/system-tests/actions/runs/17033940078/job/48282245449?pr=4891#step:91:105

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@florentinl florentinl force-pushed the florentinl/fix-glibc-compat branch 2 times, most recently from 4f8a701 to 3f57731 Compare August 18, 2025 12:22
@florentinl florentinl force-pushed the florentinl/fix-glibc-compat branch from 3f57731 to 6c8e28f Compare August 18, 2025 13:35
@florentinl florentinl changed the title build: use lambda image to build to ensure GLIBC version compat build: use lambda image to ensure ABI compatibility when building from source Aug 18, 2025
@florentinl florentinl changed the title build: use lambda image to ensure ABI compatibility when building from source build: use lambda image to ensure binary compatibility when building from source Aug 18, 2025
@florentinl florentinl marked this pull request as ready for review August 18, 2025 13:56
@florentinl florentinl requested review from a team as code owners August 18, 2025 13:56
Copy link
Contributor

@purple4reina purple4reina left a comment

Choose a reason for hiding this comment

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

Let's be sure to add the docker tag before merging.

@florentinl florentinl force-pushed the florentinl/fix-glibc-compat branch from b7c84ea to 62693de Compare August 20, 2025 07:45
@florentinl
Copy link
Contributor Author

/merge

@dd-devflow-routing-codex
Copy link

dd-devflow-routing-codex bot commented Aug 20, 2025

View all feedbacks in Devflow UI.

2025-08-20 07:46:27 UTC ℹ️ Start processing command /merge


2025-08-20 07:46:32 UTC ℹ️ MergeQueue: waiting for PR to be ready

This merge request is not mergeable yet, because of pending checks/missing approvals. It will be added to the queue as soon as checks pass and/or get approvals.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2025-08-20 07:52:13 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 0s (p90).


2025-08-20 08:31:36 UTC ℹ️ MergeQueue: This merge request was already merged

This pull request was merged directly.

@florentinl florentinl merged commit 3b5260d into main Aug 20, 2025
69 checks passed
@florentinl florentinl deleted the florentinl/fix-glibc-compat branch August 20, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants