Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions runner/.justfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ build-runner-binary:
#!/usr/bin/env bash
set -e
echo "Building runner for linux/amd64"
cd {{source_directory()}}/cmd/runner && GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.Version=$version' -extldflags '-static'"
cd {{source_directory()}}/cmd/runner && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X 'main.Version=$version' -extldflags '-static'"
echo "Runner build complete!"

# Build shim
Expand All @@ -56,7 +56,12 @@ build-shim-binary:
cd {{source_directory()}}/cmd/shim
if [ -n "$shim_os" ] && [ -n "$shim_arch" ]; then
echo "Building shim for $shim_os/$shim_arch"
GOOS=$shim_os GOARCH=$shim_arch go build -ldflags "-X 'main.Version=$version' -extldflags '-static'"
if [ "$shim_os" = "linux" ] && [ "$(uname -s)" != "Linux" ]; then
echo "WARNING: Cross-compiling to Linux, disabling CGO (DCGM unavailable)"
CGO_ENABLED=0 GOOS=$shim_os GOARCH=$shim_arch go build -ldflags "-X 'main.Version=$version' -extldflags '-static'"
else
CGO_ENABLED=1 GOOS=$shim_os GOARCH=$shim_arch go build -ldflags "-X 'main.Version=$version'"
fi
else
echo "Building shim for current platform"
go build -ldflags "-X 'main.Version=$version' -extldflags '-static'"
Expand Down
2 changes: 1 addition & 1 deletion runner/internal/shim/dcgm/wrapper_linux.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux
//go:build linux && cgo

package dcgm

Expand Down
9 changes: 9 additions & 0 deletions runner/internal/shim/dcgm/wrapper_linux_nocgo.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build linux && !cgo

package dcgm

import "fmt"

func NewDCGMWrapper(address string) (DCGMWrapperInterface, error) {
return nil, fmt.Errorf("DCGM unavailable: built with CGO disabled (cross-compilation)")
}
2 changes: 1 addition & 1 deletion runner/internal/shim/dcgm/wrapper_linux_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux
//go:build linux && cgo

package dcgm

Expand Down