diff --git a/Makefile.d/build.mk b/Makefile.d/build.mk index 677324bfdeb..fc541a56133 100644 --- a/Makefile.d/build.mk +++ b/Makefile.d/build.mk @@ -36,7 +36,7 @@ binary/build: \ cmd/agent/core/ngt/ngt: \ ngt/install $(eval CGO_ENABLED = 1) - $(call go-build,agent/core/ngt,-linkmode 'external',-static -fPIC -pthread -fopenmp -std=gnu++20 -lstdc++ -lm -z relro -z now $(EXTLDFLAGS), cgo,NGT-$(NGT_VERSION),$@) + $(call go-build,agent/core/ngt,-linkmode 'external',-static -fPIC -pthread -fopenmp -std=gnu++20 -lstdc++ -lm -z relro -z now $(EXTLDFLAGS), cgo,NGT-$(NGT_VERSION),$@,CC_FOR_TARGET=${TARGET CC=${CC}}) cmd/agent/core/faiss/faiss: \ faiss/install diff --git a/Makefile.d/functions.mk b/Makefile.d/functions.mk index 8f7b0173ffc..0dc137fdd36 100644 --- a/Makefile.d/functions.mk +++ b/Makefile.d/functions.mk @@ -68,6 +68,7 @@ define go-build GOOS=$(GOOS) \ GOPRIVATE=$(GOPRIVATE) \ GO_VERSION=$(GO_VERSION) \ + $7 \ go build \ --ldflags "-w $2 \ -extldflags '$3' \ diff --git a/dockers/agent/core/ngt/Dockerfile b/dockers/agent/core/ngt/Dockerfile index 6cb096e5d64..80cb3f52a72 100644 --- a/dockers/agent/core/ngt/Dockerfile +++ b/dockers/agent/core/ngt/Dockerfile @@ -112,10 +112,12 @@ RUN --mount=type=cache,target="${GOPATH}/pkg",id="go-build-${TARGETARCH}" \ --mount=type=cache,target="${HOME}/.cache/go-build",id="go-build-${TARGETARCH}" \ if [ "${TARGETARCH}" = "amd64" ] ; then \ export CC=${XARCH}-${TARGETOS}-gnu-gcc; \ + export TARGET=gcc-${XARCH_GCC}-${TARGETOS}-gnu ; \ elif [ "${TARGETARCH}" = "arm64" ] ; then \ export CC=${AARCH_GCC}-${TARGETOS}-gnu-gcc; \ + export TARGET=gcc-${AARCH_GCC}-${TARGETOS}-gnu ; \ fi \ - && make GOARCH=${TARGETARCH} GOOS=${TARGETOS} CC_FOR_TARGET=${CC} REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \ + && make GOARCH=${TARGETARCH} GOOS=${TARGETOS} REPO=${ORG} NAME=${REPO} cmd/${PKG}/${APP_NAME} \ && mv "cmd/${PKG}/${APP_NAME}" "/usr/bin/${APP_NAME}" WORKDIR ${GOPATH}/src/github.com/${ORG}/${REPO}/cmd/${PKG}