Skip to content

Commit e9925c7

Browse files
committed
Disable CGO
1 parent bbbf3c2 commit e9925c7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,16 @@ endif
4848
# Safe, since this code isn't performance critical.
4949
export CGO_CFLAGS := -O1
5050

51+
# Disable CGO explicitly
52+
export CGO_ENABLED=0
53+
5154
# build the vitess binaries with dynamic dependency on libc
5255
build-dyn:
5356
ifndef NOBANNER
5457
echo $$(date): Building source tree
5558
endif
5659
bash ./build.env
57-
CGO_ENABLED=0 go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
60+
go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
5861

5962
# build the vitess binaries statically
6063
build:
@@ -63,7 +66,7 @@ ifndef NOBANNER
6366
endif
6467
bash ./build.env
6568
# build all the binaries by default with CGO disabled.
66-
CGO_ENABLED=0 go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
69+
go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
6770

6871
# cross-build can be used to cross-compile Vitess client binaries
6972
# Outside of select client binaries (namely vtctlclient & vtexplain), cross-compiled Vitess Binaries are not recommended for production deployments
@@ -76,7 +79,7 @@ endif
7679
# In order to cross-compile, go install requires GOBIN to be unset
7780
export GOBIN=""
7881
# For the specified GOOS + GOARCH, build all the binaries by default with CGO disabled
79-
CGO_ENABLED=0 GOOS=${GOOS} GOARCH=${GOARCH} go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
82+
GOOS=${GOOS} GOARCH=${GOARCH} go install -trimpath $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
8083

8184
if [ ! -x "${HOME}/go/bin/${GOOS}_${GOARCH}/vttablet" ]; then \
8285
echo "Missing vttablet at: ${HOME}/go/bin/${GOOS}_${GOARCH}/vttablet" && exit; \

0 commit comments

Comments
 (0)