Open
Description
a minimal example: https://github.com/hunshcn/nvml-go-bazel
run this program in gpu will raise error
$ bazel run //:test
execroot/_main/bazel-out/k8-fastbuild/bin/test_/test: symbol lookup error: /home/zhuangweiyu/.cache/bazel/_bazel_zhuangweiyu/1caac8ba4aabb81291495d841190e051/execroot/_main/bazel-out/k8-fastbuild/bin/test_/test: undefined symbol: nvmlComputeInstanceDestroy
There will be no problem in building through go build, so I think this is related to rules_go.
Some attempts to solve the problem
in this issue NVIDIA/go-nvml#18, I try add
gc_linkopts = [
"-extldflags",
"-Wl,-z,lazy",
],
but still failed (another problem)
SIGSEGV: segmentation violation
PC=0x0 m=12 sigcode=1 addr=0x0
signal arrived during cgo execution
goroutine 1 gp=0xc000002540 m=12 mp=0xc000900008 [syscall]:
runtime.cgocall(0x194a8f9, 0xc0002a5950)
GOROOT/src/runtime/cgocall.go:167 +0x4b fp=0xc0002a5928 sp=0xc0002a58f0 pc=0x4869cb
github.com/NVIDIA/go-nvml/pkg/nvml._Cfunc_nvmlInit_v2()
_cgo_gotypes.go:5241 +0x45 fp=0xc0002a5950 sp=0xc0002a5928 pc=0x17841c5
github.com/NVIDIA/go-nvml/pkg/nvml.nvmlInit_v2()
_main/external/gazelle~~go_deps~com_github_nvidia_go_nvml/pkg/nvml/nvml.go:33 +0x13 fp=0xc0002a5968 sp=0xc0002a5950 pc=0x1787ff3
github.com/NVIDIA/go-nvml/pkg/nvml.(*library).Init(0xc000920ab0?)
_main/external/gazelle~~go_deps~com_github_nvidia_go_nvml/pkg/nvml/init.go:24 +0x2f fp=0xc0002a5980 sp=0xc0002a5968 pc=0x1786faf
Metadata
Metadata
Assignees
Labels
No labels