File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ build-runner-binary:
4545 #!/usr/bin/env bash
4646 set -e
4747 echo " Building runner for linux/amd64"
48- cd {{ source_directory ()}} / cmd/ runner && GOOS=linux GOARCH=amd64 go build -ldflags " -X 'main.Version=$version' -extldflags '-static'"
48+ cd {{ source_directory ()}} / cmd/ runner && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags " -X 'main.Version=$version' -extldflags '-static'"
4949 echo " Runner build complete!"
5050
5151# Build shim
@@ -56,7 +56,12 @@ build-shim-binary:
5656 cd {{ source_directory ()}} / cmd/ shim
5757 if [ -n " $shim_os" ] && [ -n " $shim_arch" ]; then
5858 echo " Building shim for $shim_os/$shim_arch"
59- GOOS=$shim_os GOARCH=$shim_arch go build -ldflags " -X 'main.Version=$version' -extldflags '-static'"
59+ if [ " $shim_os" = " linux" ] && [ " $(uname -s)" != " Linux" ]; then
60+ echo " WARNING: Cross-compiling to Linux, disabling CGO (DCGM unavailable)"
61+ CGO_ENABLED=0 GOOS=$shim_os GOARCH=$shim_arch go build -ldflags " -X 'main.Version=$version' -extldflags '-static'"
62+ else
63+ CGO_ENABLED=1 GOOS=$shim_os GOARCH=$shim_arch go build -ldflags " -X 'main.Version=$version'"
64+ fi
6065 else
6166 echo " Building shim for current platform"
6267 go build -ldflags " -X 'main.Version=$version' -extldflags '-static'"
Original file line number Diff line number Diff line change 1- //go:build linux
1+ //go:build linux && cgo
22
33package dcgm
44
Original file line number Diff line number Diff line change 1+ //go:build linux && !cgo
2+
3+ package dcgm
4+
5+ import "fmt"
6+
7+ func NewDCGMWrapper (address string ) (DCGMWrapperInterface , error ) {
8+ return nil , fmt .Errorf ("DCGM unavailable: built with CGO disabled (cross-compilation)" )
9+ }
Original file line number Diff line number Diff line change 1- //go:build linux
1+ //go:build linux && cgo
22
33package dcgm
44
You can’t perform that action at this time.
0 commit comments