-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build linux && !arm64 && nonglibc | ||
|
||
// Package modules is all the module definitions for system-probe | ||
package modules | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/DataDog/datadog-agent/cmd/system-probe/api/module" | ||
) | ||
|
||
// All System Probe modules should register their factories here | ||
var All = []module.Factory{ | ||
EBPFProbe, | ||
NetworkTracer, | ||
TCPQueueLength, | ||
OOMKillProbe, | ||
// there is a dependency from EventMonitor -> NetworkTracer | ||
// so EventMonitor has to follow NetworkTracer | ||
EventMonitor, | ||
Process, | ||
DynamicInstrumentation, | ||
LanguageDetectionModule, | ||
ComplianceModule, | ||
Pinger, | ||
Traceroute, | ||
DiscoveryModule, | ||
} | ||
|
||
func inactivityEventLog(_ time.Duration) { | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2024-present Datadog, Inc. | ||
|
||
//go:build linux && arm64 && nonglibc | ||
|
||
// Package modules is all the module definitions for system-probe | ||
package modules | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/DataDog/datadog-agent/cmd/system-probe/api/module" | ||
) | ||
|
||
// All System Probe modules should register their factories here | ||
var All = []module.Factory{ | ||
EBPFProbe, | ||
NetworkTracer, | ||
TCPQueueLength, | ||
OOMKillProbe, | ||
// there is a dependency from EventMonitor -> NetworkTracer | ||
// so EventMonitor has to follow NetworkTracer | ||
EventMonitor, | ||
Process, | ||
DynamicInstrumentation, | ||
LanguageDetectionModule, | ||
ComplianceModule, | ||
Pinger, | ||
Traceroute, | ||
DiscoveryModule, | ||
GPUMonitoring, // GPU monitoring needs to be initialized afer EventMonitor, so that we have the event consumer ready | ||
} | ||
|
||
func inactivityEventLog(_ time.Duration) { | ||
|
||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,6 @@ | ||||||
--- | ||||||
enhancements: | ||||||
- | | ||||||
Add an build option (`--non-glibc`) to build the agent on non-glibc environment like musl libc. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
The option disables system-probe gpu module and corechecks gpu collector using | ||||||
`github.com/NVIDIA/go-nvml` which depends on a glibc-extended definition. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If someone may build the agent by |
||
): | ||
""" | ||
Build the agent. If the bits to include in the build are not specified, | ||
|
@@ -219,6 +220,9 @@ def build( | |
all_tags |= set(build_tags) | ||
build_tags = list(all_tags) | ||
|
||
if non_glibc: | ||
build_tags.append("nonglibc") | ||
|
||
cmd = "go build -mod={go_mod} {race_opt} {build_type} -tags \"{go_build_tags}\" " | ||
|
||
if not agent_bin: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -689,10 +689,12 @@ def build( | |
ebpf_compiler='clang', | ||
static=False, | ||
fips_mode=False, | ||
non_glibc=False, | ||
): | ||
""" | ||
Build the system-probe | ||
""" | ||
raise NameError('test') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this. |
||
if not is_macos: | ||
build_object_files( | ||
ctx, | ||
|
@@ -716,6 +718,7 @@ def build( | |
arch=arch, | ||
static=static, | ||
fips_mode=fips_mode, | ||
non_glibc=non_glibc, | ||
) | ||
|
||
|
||
|
@@ -743,6 +746,7 @@ def build_sysprobe_binary( | |
strip_binary=False, | ||
fips_mode=False, | ||
static=False, | ||
non_glibc=False, | ||
) -> None: | ||
arch_obj = Arch.from_str(arch) | ||
|
||
|
@@ -765,6 +769,9 @@ def build_sysprobe_binary( | |
build_tags.extend(["osusergo", "netgo"]) | ||
build_tags = list(set(build_tags).difference({"netcgo"})) | ||
|
||
if non_glibc: | ||
build_tags.append("nonglibc") | ||
|
||
if not is_windows and "pcap" in build_tags: | ||
build_libpcap(ctx) | ||
cgo_flags = get_libpcap_cgo_flags(ctx, install_path) | ||
|
There was a problem hiding this comment.
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.