Skip to content

Commit

Permalink
build: Use the same linker flags as NVIDIA Container Toolkit
Browse files Browse the repository at this point in the history
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

containers#1548
  • Loading branch information
debarshiray committed Sep 26, 2024
1 parent 83f28c5 commit 66280a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/go-build-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$?"

0 comments on commit 66280a6

Please sign in to comment.