All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCHv3] package/go: cgo for the target needs the toolchain
@ 2023-09-25 13:51 yann.morin
  2023-09-30  6:48 ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: yann.morin @ 2023-09-25 13:51 UTC (permalink / raw)
  To: buildroot; +Cc: yann.morin, Thomas Petazzoni, Christian Stewart, Anisse Astier

From: Christian Stewart <christian@aperture.us>

Build go with cgo support needs to build some .c files to generate
target support code, and thus calls the cross C compiler, which is
failing when the toolchain is not built before host-go:

    >>> host-go 1.21.1 Building
    cd .../build/host-go-1.21.1/src && GO111MODULE=off GOCACHE=.../per-package/host-go/host/share/host-go-cache GOROOT_BOOTSTRAP=.../per-package/host-go/host/lib/go-1.19.11 GOROOT_FINAL=.../per-package/host-go/host/lib/go GOROOT=".../build/host-go-1.21.1" GOBIN=".../build/host-go-1.21.1/bin" GOOS=linux CC=/usr/bin/gcc CXX=/usr/bin/g++ CGO_ENABLED=1 CC_FOR_TARGET=".../per-package/host-go/host/bin/arm-linux-gcc" CXX_FOR_TARGET=".../per-package/host-go/host/bin/arm-linux-g++" GOOS="linux" GOARCH=arm  GOARM=6 GO_ASSUME_CROSSCOMPILING=1 ./make.bash
    Building Go cmd/dist using .../per-package/host-go/host/lib/go-1.19.11.  (go1.19.11 linux/amd64)
    go tool dist: cannot invoke C compiler [".../per-package/host-go/host/bin/arm-linux-gcc"]: fork/exec .../per-package/host-go/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.

This happens systematically with PPD, and happens without PPD when
host-go is explicitly built (by running: "make host-go").

Since only CGO support needs to compile C files, onmy add the toolchain
dependency in that case.

When the target is not supported by go, then there is obviously no need
to depend on the toolchain (even if we unconditionally enable cgo
support in only-for-the-host host-go).

Signed-off-by: Christian Stewart <christian@aperture.us>
[yann.morin@orange.com:
  - only add the toolchain dependency for target cgo
  - reword commit log
]
Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Anisse Astier <anisse@astier.eu>

---
Changes v2 -> v3:
  - properly reassign authorship to Christian (sorry for the screw up)

Changes v1 -> v2:
  - only add the toolchain dependency for target cgo
  - reword commit log

v1 by Christian:
    https://lore.kernel.org/buildroot/20230728052530.1122268-1-christian@aperture.us/
---
 package/go/go.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/go/go.mk b/package/go/go.mk
index e5195089ac..6f080be5c0 100644
--- a/package/go/go.mk
+++ b/package/go/go.mk
@@ -90,6 +90,7 @@ HOST_GO_TARGET_ENV = \
 # any target package needing cgo support must include
 # 'depends on BR2_TOOLCHAIN_HAS_THREADS' in its config file.
 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
+HOST_GO_DEPENDENCIES += toolchain
 HOST_GO_CGO_ENABLED = 1
 else
 HOST_GO_CGO_ENABLED = 0
-- 
2.34.1

____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou falsifie. Merci.

This message and its attachments may contain confidential or privileged information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been modified, changed or falsified.
Thank you.

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

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

* Re: [Buildroot] [PATCHv3] package/go: cgo for the target needs the toolchain
  2023-09-25 13:51 [Buildroot] [PATCHv3] package/go: cgo for the target needs the toolchain yann.morin
@ 2023-09-30  6:48 ` Peter Korsgaard
  2023-10-12 16:03   ` Peter Korsgaard
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Korsgaard @ 2023-09-30  6:48 UTC (permalink / raw)
  To: yann.morin; +Cc: Anisse Astier, Christian Stewart, Thomas Petazzoni, buildroot

>>>>>   <yann.morin@orange.com> writes:

 > From: Christian Stewart <christian@aperture.us>
 > Build go with cgo support needs to build some .c files to generate
 > target support code, and thus calls the cross C compiler, which is
 > failing when the toolchain is not built before host-go:

 >>>> host-go 1.21.1 Building
 >     cd .../build/host-go-1.21.1/src && GO111MODULE=off GOCACHE=.../per-package/host-go/host/share/host-go-cache GOROOT_BOOTSTRAP=.../per-package/host-go/host/lib/go-1.19.11 GOROOT_FINAL=.../per-package/host-go/host/lib/go GOROOT=".../build/host-go-1.21.1" GOBIN=".../build/host-go-1.21.1/bin" GOOS=linux CC=/usr/bin/gcc CXX=/usr/bin/g++ CGO_ENABLED=1 CC_FOR_TARGET=".../per-package/host-go/host/bin/arm-linux-gcc" CXX_FOR_TARGET=".../per-package/host-go/host/bin/arm-linux-g++" GOOS="linux" GOARCH=arm  GOARM=6 GO_ASSUME_CROSSCOMPILING=1 ./make.bash
 >     Building Go cmd/dist using .../per-package/host-go/host/lib/go-1.19.11.  (go1.19.11 linux/amd64)
 >     go tool dist: cannot invoke C compiler [".../per-package/host-go/host/bin/arm-linux-gcc"]: fork/exec .../per-package/host-go/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.

 > This happens systematically with PPD, and happens without PPD when
 > host-go is explicitly built (by running: "make host-go").

 > Since only CGO support needs to compile C files, onmy add the toolchain
 > dependency in that case.

 > When the target is not supported by go, then there is obviously no need
 > to depend on the toolchain (even if we unconditionally enable cgo
 > support in only-for-the-host host-go).

 > Signed-off-by: Christian Stewart <christian@aperture.us>
 > [yann.morin@orange.com:
 >   - only add the toolchain dependency for target cgo
 >   - reword commit log
 > ]
 > Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
 > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 > Cc: Anisse Astier <anisse@astier.eu>

 > ---
 > Changes v2 -> v3:
 >   - properly reassign authorship to Christian (sorry for the screw up)

 > Changes v1 -> v2:
 >   - only add the toolchain dependency for target cgo
 >   - reword commit log

 > v1 by Christian:
 >     https://lore.kernel.org/buildroot/20230728052530.1122268-1-christian@aperture.us/
 > ---
 >  package/go/go.mk | 1 +
 >  1 file changed, 1 insertion(+)


Committed, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCHv3] package/go: cgo for the target needs the toolchain
  2023-09-30  6:48 ` Peter Korsgaard
@ 2023-10-12 16:03   ` Peter Korsgaard
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2023-10-12 16:03 UTC (permalink / raw)
  To: yann.morin; +Cc: Thomas Petazzoni, Anisse Astier, Christian Stewart, buildroot

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

>>>>>   <yann.morin@orange.com> writes:
 >> From: Christian Stewart <christian@aperture.us>
 >> Build go with cgo support needs to build some .c files to generate
 >> target support code, and thus calls the cross C compiler, which is
 >> failing when the toolchain is not built before host-go:

 >>>>> host-go 1.21.1 Building
 >> cd .../build/host-go-1.21.1/src && GO111MODULE=off GOCACHE=.../per-package/host-go/host/share/host-go-cache GOROOT_BOOTSTRAP=.../per-package/host-go/host/lib/go-1.19.11 GOROOT_FINAL=.../per-package/host-go/host/lib/go GOROOT=".../build/host-go-1.21.1" GOBIN=".../build/host-go-1.21.1/bin" GOOS=linux CC=/usr/bin/gcc CXX=/usr/bin/g++ CGO_ENABLED=1 CC_FOR_TARGET=".../per-package/host-go/host/bin/arm-linux-gcc" CXX_FOR_TARGET=".../per-package/host-go/host/bin/arm-linux-g++" GOOS="linux" GOARCH=arm  GOARM=6 GO_ASSUME_CROSSCOMPILING=1 ./make.bash
 >> Building Go cmd/dist using .../per-package/host-go/host/lib/go-1.19.11.  (go1.19.11 linux/amd64)
 >> go tool dist: cannot invoke C compiler [".../per-package/host-go/host/bin/arm-linux-gcc"]: fork/exec .../per-package/host-go/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.

 >> This happens systematically with PPD, and happens without PPD when
 >> host-go is explicitly built (by running: "make host-go").

 >> Since only CGO support needs to compile C files, onmy add the toolchain
 >> dependency in that case.

 >> When the target is not supported by go, then there is obviously no need
 >> to depend on the toolchain (even if we unconditionally enable cgo
 >> support in only-for-the-host host-go).

 >> Signed-off-by: Christian Stewart <christian@aperture.us>
 >> [yann.morin@orange.com:
 >> - only add the toolchain dependency for target cgo
 >> - reword commit log
 >> ]
 >> Signed-off-by: Yann E. MORIN <yann.morin@orange.com>
 >> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
 >> Cc: Anisse Astier <anisse@astier.eu>

 >> ---
 >> Changes v2 -> v3:
 >> - properly reassign authorship to Christian (sorry for the screw up)

 >> Changes v1 -> v2:
 >> - only add the toolchain dependency for target cgo
 >> - reword commit log

 >> v1 by Christian:
 >> https://lore.kernel.org/buildroot/20230728052530.1122268-1-christian@aperture.us/
 >> ---
 >> package/go/go.mk | 1 +
 >> 1 file changed, 1 insertion(+)


 > Committed, thanks.

Committed to 2023.02.x and 2023.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2023-10-12 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-25 13:51 [Buildroot] [PATCHv3] package/go: cgo for the target needs the toolchain yann.morin
2023-09-30  6:48 ` Peter Korsgaard
2023-10-12 16:03   ` Peter Korsgaard

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.