golang: do not rely on Go script host detection 18584/head
authorMichael Pratt <mcpratt@pm.me>
Fri, 27 May 2022 06:25:52 +0000 (02:25 -0400)
committerMichael Pratt <mcpratt@pm.me>
Fri, 27 May 2022 06:39:52 +0000 (02:39 -0400)
for some use cases, for example:
a system with 64 bit kernel
and 32 bit userspace programs

the local Go installation is "detected"
using the kernel "uname",
causing build failure if they happen to differ

by adding the argument GOHOSTARCH using the corresponding make variable
it would be fully controlled in the openwrt git tree
based on the HOST_ARCH make variable.

Signed-off-by: Michael Pratt <mcpratt@pm.me>
lang/golang/golang/Makefile

index c13025cfeee06d04d6abde80670ee6889acf7e9f..ad75dd165fe984850e8204b0293022ca774f7367 100644 (file)
@@ -202,6 +202,7 @@ endif
 $(eval $(call GoCompiler/AddProfile,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH),$(HOST_GO_INSTALL_SUFFIX)))
 
 HOST_GO_VARS= \
+       GOHOSTARCH="$(GO_HOST_ARCH)" \
        GOCACHE="$(GO_BUILD_CACHE_DIR)" \
        GOENV=off \
        CC="$(HOSTCC_NOCACHE)" \
@@ -273,6 +274,7 @@ PKG_GO_ZBOOTSTRAP_MODS:= \
 PKG_GO_ZBOOTSTRAP_PATH:=$(PKG_BUILD_DIR)/src/internal/buildcfg/zbootstrap.go
 
 PKG_GO_VARS= \
+       GOHOSTARCH="$(GO_HOST_ARCH)" \
        GOCACHE="$(GO_BUILD_CACHE_DIR)" \
        GOENV=off \
        GO_GCC_HELPER_PATH="$$$$PATH" \