build: Use the same linker flags as NVIDIA Container Toolkit
The previous commit explains how the NVIDIA Container Toolkit is
sensitive to some linker flags. Therefore, use the same linker flags
that are used by NVIDIA Container Toolkit to build the nvidia-cdi-hook,
nvidia-ctk, etc. binaries, because they use the same Go APIs that
toolbox(1) does [1]. It's better to use the same build configuration to
prevent subtle bugs from creeping in.
[1] NVIDIA Container Toolkit commit 772cf77dcc2347ce
https://github.com/NVIDIA/nvidia-container-toolkit/commit/772cf77dcc2347ce
https://github.com/NVIDIA/nvidia-container-toolkit/pull/333
https://github.com/containers/toolbox/pull/1548
This commit is contained in:
parent
83f28c52e4
commit
66280a617a
|
|
@ -116,7 +116,7 @@ dynamic_linker="/run/host$dynamic_linker_canonical_dirname/$dynamic_linker_basen
|
|||
go build \
|
||||
$tags \
|
||||
-trimpath \
|
||||
-ldflags "-extldflags '-Wl,-dynamic-linker,$dynamic_linker -Wl,-rpath,/run/host$libc_dir_canonical_dirname' -linkmode external -X github.com/containers/toolbox/pkg/version.currentVersion=$4" \
|
||||
-ldflags "-extldflags '-Wl,-dynamic-linker,$dynamic_linker -Wl,-rpath,/run/host$libc_dir_canonical_dirname -Wl,--export-dynamic -Wl,--unresolved-symbols=ignore-in-object-files' -linkmode external -X github.com/containers/toolbox/pkg/version.currentVersion=$4" \
|
||||
-o "$2/$3"
|
||||
|
||||
exit "$?"
|
||||
|
|
|
|||
Loading…
Reference in New Issue