external/virtualization-layer: fix libnvidia-container build error

Add a patch to libnvidia-container to fix build issues with go 1.24.

Signed-off-by: Matt Madison <matt@madison.systems>
This commit is contained in:
Matt Madison
2025-03-09 07:48:14 -07:00
parent 2bbc15ae8b
commit 54ca488dd9
2 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
From d44307d59b60926e016b98f27aa87aadb050e4a6 Mon Sep 17 00:00:00 2001
From: Matt Madison <matt@madison.systems>
Date: Sun, 9 Mar 2025 07:34:57 -0700
Subject: [PATCH] nvcgo: fix build with go 1.24
Go doesn't allow adding methods to types defined elsewhere,
leading to this error:
/main.go:35:10: cannot define new methods on non-local type CDeviceRule
Change the locally-defined method to be an ordinary function instead.
Upstream-Status: Pending
Signed-off-by: Matt Madison <matt@madison.systems>
---
src/nvcgo/main.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nvcgo/main.go b/src/nvcgo/main.go
index 1523a06d..380ebfb0 100644
--- a/src/nvcgo/main.go
+++ b/src/nvcgo/main.go
@@ -32,7 +32,7 @@ func main() {}
type CDeviceRule = C.struct_device_rule
// Convert a C-based DeviceRule to a Go-based cgroup.DeviceRule
-func (r *CDeviceRule) convert() cgroup.DeviceRule {
+func convert(r *CDeviceRule) cgroup.DeviceRule {
return cgroup.DeviceRule{
Allow: bool(r.allow),
Type: C.GoString(r._type),
@@ -100,7 +100,7 @@ func AddDeviceRules(version C.int, cgroupPath *C.char, crules []CDeviceRule, rer
rules := make([]cgroup.DeviceRule, len(crules))
for i, cr := range crules {
- rules[i] = cr.convert()
+ rules[i] = convert(&cr)
}
err = api.AddDeviceRules(C.GoString(cgroupPath), rules)
--
2.43.0

View File

@@ -45,6 +45,7 @@ SRC_URI = "git://github.com/NVIDIA/libnvidia-container.git;protocol=https;name=l
git://github.com/NVIDIA/nvidia-modprobe.git;protocol=https;branch=main;name=modprobe;destsuffix=${NVIDIA_MODPROBE_SRCURI_DESTSUFFIX} \
file://0001-OE-cross-build-fixups.patch \
file://0002-Expose-device-file-attrs.patch \
file://0003-nvcgo-fix-build-with-go-1.24.patch \
"
# tag: v1.14.2