* How to include full Golang build support in SDK?
@ 2024-05-27 6:35 Jonas Fredriksson
2024-05-27 7:16 ` [yocto] " Bratiranjan Acharya
0 siblings, 1 reply; 5+ messages in thread
From: Jonas Fredriksson @ 2024-05-27 6:35 UTC (permalink / raw)
To: yocto
[-- Attachment #1: Type: text/plain, Size: 835 bytes --]
Hello, I'm trying to create an SDK that has support for cross-compiling Golang applications. I know that Golang supports this out-of-the-box via *"env GOOS=linux GOARCH=arm64 go build"* but I am linking against CGO which proved difficult this way.
What I have:
>
>
>
> TOOLCHAIN_HOST_TASK:append = " \
> nativesdk-go \
> packagegroup-go-cross-canadian-${MACHINE} \
> "
>
> TOOLCHAIN_TARGET_TASK:append = " \
> ${@multilib_pkg_extend(d, 'packagegroup-go-sdk-target')} \
> "
>
> IMAGE_INSTALL:append = " go"
>
>
When this SDK is built and installed, it only gives me this directory tree:
>
>
>
> $ ls -lah x86_64-pokysdk-linux/usr/lib/go/
> bin
> pkg
>
>
What I specifically need is the " *src* " directory, because the packages are in there.
What do I need to add to my sdk, and how?
[-- Attachment #2: Type: text/html, Size: 999 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [yocto] How to include full Golang build support in SDK?
2024-05-27 6:35 How to include full Golang build support in SDK? Jonas Fredriksson
@ 2024-05-27 7:16 ` Bratiranjan Acharya
2024-05-27 7:21 ` Jonas Fredriksson
0 siblings, 1 reply; 5+ messages in thread
From: Bratiranjan Acharya @ 2024-05-27 7:16 UTC (permalink / raw)
To: Jonas Fredriksson, yocto
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
Hi,
As per my understanding please try these things
1)locate where the Go source files are installed on your system, maybe in $GOROOT/src d irectory.
2)You may need to include this to your sdk to ensure it is added.
May need to add this line to, your recipe
*FILES:${PN}-dev += "${datadir}/go/src"*
Then try to rebuild your SDK.
Thanks & Regards
Brati
[-- Attachment #2: Type: text/html, Size: 6383 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [yocto] How to include full Golang build support in SDK?
2024-05-27 7:16 ` [yocto] " Bratiranjan Acharya
@ 2024-05-27 7:21 ` Jonas Fredriksson
2024-05-27 7:25 ` Janne Kiiskila
0 siblings, 1 reply; 5+ messages in thread
From: Jonas Fredriksson @ 2024-05-27 7:21 UTC (permalink / raw)
To: Bratiranjan Acharya, yocto
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
Thank you for your answer.
The thing is, right now I don't really have a recipe that builds the application, that is for the customer to provide. My task right now is just to provide the SDK that they can build against. Or are you referring to the image-recipe?
[-- Attachment #2: Type: text/html, Size: 278 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [yocto] How to include full Golang build support in SDK?
2024-05-27 7:21 ` Jonas Fredriksson
@ 2024-05-27 7:25 ` Janne Kiiskila
2024-05-27 9:26 ` Jonas Fredriksson
0 siblings, 1 reply; 5+ messages in thread
From: Janne Kiiskila @ 2024-05-27 7:25 UTC (permalink / raw)
To: yocto@lists.yoctoproject.org, jonas.fredriksson92@gmail.com,
Bratiranjan Acharya
[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]
Hei,
I do not think the SDK per se needs to provide anything, all of the magic is in the recipe.
Here’s one example of a golang based application, which is cross-compilable as well.
I think they key trick is to inherit go.
https://github.com/PelionIoT/meta-edge/blob/main/recipes-edge/edge-proxy/edge-proxy_git.bb
Best Regards,
Janne Kiiskilä
From: yocto@lists.yoctoproject.org <yocto@lists.yoctoproject.org> On Behalf Of Jonas Fredriksson via lists.yoctoproject.org
Sent: maanantai 27. toukokuuta 2024 10.22
To: Bratiranjan Acharya <bratiranjan12@gmail.com>; yocto@lists.yoctoproject.org
Subject: Re: [yocto] How to include full Golang build support in SDK?
You don't often get email from jonas.fredriksson92=gmail.com@lists.yoctoproject.org<mailto:jonas.fredriksson92=gmail.com@lists.yoctoproject.org>. Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
Thank you for your answer.
The thing is, right now I don't really have a recipe that builds the application, that is for the customer to provide. My task right now is just to provide the SDK that they can build against. Or are you referring to the image-recipe?
[-- Attachment #2: Type: text/html, Size: 5918 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [yocto] How to include full Golang build support in SDK?
2024-05-27 7:25 ` Janne Kiiskila
@ 2024-05-27 9:26 ` Jonas Fredriksson
0 siblings, 0 replies; 5+ messages in thread
From: Jonas Fredriksson @ 2024-05-27 9:26 UTC (permalink / raw)
To: Janne Kiiskila, yocto
[-- Attachment #1: Type: text/plain, Size: 385 bytes --]
Thanks Janne,
I will try to just make a recipe then. But it feels like a tedious way to work, since the application will need to be continuously built and deployed on the target platform as part of the development, ideally without having to rebuild the entire image. Perhaps I can just run bitbake (of kas in my case) to build the specific package and scp over the binary anyways.
[-- Attachment #2: Type: text/html, Size: 412 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-27 9:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 6:35 How to include full Golang build support in SDK? Jonas Fredriksson
2024-05-27 7:16 ` [yocto] " Bratiranjan Acharya
2024-05-27 7:21 ` Jonas Fredriksson
2024-05-27 7:25 ` Janne Kiiskila
2024-05-27 9:26 ` Jonas Fredriksson
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.