Skip to content

Commit

Permalink
Fix CGO-less TBot Build (#52505) (#52562)
Browse files Browse the repository at this point in the history
* Fix CGOLess tbot build

* Remove buildmode=pie for CGO_ENABLED=0 builds
  • Loading branch information
strideynet authored Feb 27, 2025
1 parent eea3fca commit 7366b43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,10 @@ $(BUILDDIR)/tsh:

.PHONY: $(BUILDDIR)/tbot
# tbot is CGO-less by default except on Windows because lib/client/terminal/ wants CGO on this OS
$(BUILDDIR)/tbot: TBOT_CGO_FLAGS ?= $(if $(filter windows,$(OS)),$(CGOFLAG))
# We force cgo to be disabled, else the compiler might decide to enable it.
$(BUILDDIR)/tbot: TBOT_CGO_FLAGS ?= $(if $(filter windows,$(OS)),$(CGOFLAG),CGO_ENABLED=0)
# Build mode pie requires CGO
$(BUILDDIR)/tbot: BUILDFLAGS_TBOT += $(if $(TBOT_CGO_FLAGS), -buildmode=pie)
$(BUILDDIR)/tbot: BUILDFLAGS_TBOT += $(if $(findstring CGO_ENABLED=1,$(TBOT_CGO_FLAGS)), -buildmode=pie)
$(BUILDDIR)/tbot:
GOOS=$(OS) GOARCH=$(ARCH) $(TBOT_CGO_FLAGS) go build -tags "$(FIPS_TAG)" -o $(BUILDDIR)/tbot $(BUILDFLAGS_TBOT) $(TOOLS_LDFLAGS) ./tool/tbot

Expand Down
2 changes: 1 addition & 1 deletion integrations/teleport-spacelift-runner/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include ../../build.assets/images.mk
.PHONY: docker-build
docker-build:
docker buildx build --platform="$(OS)/$(ARCH)" \
--build-arg BUILDBOX=$(BUILDBOX_CENTOS7) \
--build-arg BUILDBOX=$(BUILDBOX_CENTOS7_NOARCH) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--load \
-f ./Dockerfile \
Expand Down

0 comments on commit 7366b43

Please sign in to comment.