Skip to content
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

Add option to build on non-glibc env #32943

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

at-wat
Copy link
Contributor

@at-wat at-wat commented Jan 14, 2025

What does this PR do?

Add an build option (--non-glibc) to build the agent on non-glibc environment like musl libc.
The option disables system-probe gpu module and corechecks gpu collector using github.com/NVIDIA/go-nvml which depends on a glibc-extended definition.

Motivation

(reported at #32942)
Recently added system-probe gpu module and corechecks gpu collector use github.com/NVIDIA/go-nvml which requires glibc.
So, agent can't be built for non-glibc environments like Alpine Linux and Arch Linux which use musl libc.

Describe how you validated your changes

I applied this change as a patch to seqsense/datadog-agent-alpine#134 and confirmed that the build is fixed by setting the option --non-glibc.

Possible Drawbacks / Trade-offs

The doesn't take effect unless setting the option.

Additional Notes

Add an build option (`--non-glibc`) to build the agent on
non-glibc environment like musl libc.
The option disables system-probe gpu module and
corechecks gpu collector using `github.com/NVIDIA/go-nvml`
which depends on a glibc-extended definition.
Copy link
Contributor

@maycmlee maycmlee left a comment

Choose a reason for hiding this comment

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

Just small edits, but approving to not block.

---
enhancements:
- |
Add an build option (`--non-glibc`) to build the agent on non-glibc environment like musl libc.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Add an build option (`--non-glibc`) to build the agent on non-glibc environment like musl libc.
Add an build option (`--non-glibc`) to build the Agent on `non-glibc` environment like musl libc.

Copy link
Member

@brycekahle brycekahle left a comment

Choose a reason for hiding this comment

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

See inline comments

@@ -146,6 +146,7 @@ def build(
bundle_ebpf=False,
agent_bin=None,
run_on=None, # noqa: U100, F841. Used by the run_on_devcontainer decorator
non_glibc=False,
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer a glibc=True argument for the invoke task and have --no-glibc be the command line option that gets you a non-glibc build.

):
"""
Build the system-probe
"""
raise NameError('test')
Copy link
Member

Choose a reason for hiding this comment

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

Please remove this.

@@ -3,7 +3,7 @@
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2016-present Datadog, Inc.

//go:build linux && !arm64
Copy link
Member

Choose a reason for hiding this comment

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

Go build tags are usually positive assertions, so let's use a glibc build tag instead and add it to the list of default build tags.

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.

4 participants