Skip to content

Commit 66280a6

Browse files
committed
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 NVIDIA/nvidia-container-toolkit@772cf77dcc2347ce NVIDIA/nvidia-container-toolkit#333 #1548
1 parent 83f28c5 commit 66280a6

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/go-build-wrapper‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ dynamic_linker="/run/host$dynamic_linker_canonical_dirname/$dynamic_linker_basen
116116
go build \
117117
$tags \
118118
-trimpath \
119-
-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" \
119+
-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" \
120120
-o "$2/$3"
121121

122122
exit "$?"

0 commit comments

Comments
 (0)