All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v1 1/1] package/go: add toolchain as dependency of host-go
@ 2023-07-28  5:25 Christian Stewart via buildroot
  2023-07-28  7:26 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Stewart via buildroot @ 2023-07-28  5:25 UTC (permalink / raw)
  To: buildroot; +Cc: Christian Stewart, Yann E . MORIN, Thomas Petazzoni

Running "make host-go" in a clean Buildroot tree causes a build failure:

Building Go cmd/dist using /host/lib/go-1.19.10. (go1.19.10 linux/amd64)
go tool dist: cannot invoke C compiler ["/host/bin/arm-linux-gcc"]:
fork/exec /host/bin/arm-linux-gcc: no such file or directory

Go needs a system C compiler for use with cgo.
To set a C compiler, set CC=the-compiler.
To disable cgo, set CGO_ENABLED=0.

Despite the fact that we're compiling the Go compiler and not compiling anything
for the target system, the Go compiler make.bash still attempts to call the
target C compiler during the build process.

The dependency on toolchain is necessary only for host-go and not the other
host-go-bootstrap packages as we only pass the path to the target compiler to
the final host-go compiler package make.bash.

Fix the issue by adding toolchain to the host-go package dependencies.

Signed-off-by: Christian Stewart <christian@aperture.us>
---
 package/go/go.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/go/go.mk b/package/go/go.mk
index efa47e5781..ada343f766 100644
--- a/package/go/go.mk
+++ b/package/go/go.mk
@@ -12,7 +12,8 @@ GO_LICENSE = BSD-3-Clause
 GO_LICENSE_FILES = LICENSE
 GO_CPE_ID_VENDOR = golang
 
-HOST_GO_DEPENDENCIES = host-go-bootstrap-stage2
+# Go requires the target toolchain to build the compiler.
+HOST_GO_DEPENDENCIES = host-go-bootstrap-stage2 toolchain
 HOST_GO_GOPATH = $(HOST_DIR)/share/go-path
 HOST_GO_HOST_CACHE = $(HOST_DIR)/share/host-go-cache
 HOST_GO_ROOT = $(HOST_DIR)/lib/go
-- 
2.41.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-29 21:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-28  5:25 [Buildroot] [PATCH v1 1/1] package/go: add toolchain as dependency of host-go Christian Stewart via buildroot
2023-07-28  7:26 ` Thomas Petazzoni via buildroot
2023-07-29  1:19   ` Christian Stewart via buildroot
2023-07-29 21:05     ` Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.