Skip to contentSkip to conversation

Go toolchain in SDK

DISCUSSION Robert Berger 3 participants 3 messages Jun 16, 2020 – Jun 19, 2020

lore
Share & tools
lore
#0 lore raw

Hi,

What is the "proper" way to add the Go toolchain to an SDK nowadays (dunfell)?

I saw there is in poky:

./meta/recipes-core/meta/meta-go-toolchain.bb

but I am not quite sure how to build an SDK with meta-go-toolchain included.

so I added something like that to local.conf which seems to work for the "classic" SDK:

# --> golang stuff

# attempt to add golang to SDK
TOOLCHAIN_HOST_TASK_append = " \
    packagegroup-go-cross-canadian-${MACHINE} \
"
TOOLCHAIN_TARGET_TASK_append = " \
    ${@multilib_pkg_extend(d, 'packagegroup-go-sdk-target')} \

"
# <-- golang stuff

bitbake core-image-sato-sdk -c populate_sdk

and currently also for:
bitbake core-image-sato-sdk -c populate_sdk_ext

I don't think that's the way it was intended.

Can you please enlighten me?

Regards,

Robert

#1 lore raw
Quoted 5 lines · Robert Berger

Hi,

What is the "proper" way to add the Go toolchain to an SDK nowadays (dunfell)?

I dont think there is sample image target for image based SDKs

Quoted 6 lines

I saw there is in poky:

./meta/recipes-core/meta/meta-go-toolchain.bb

but I am not quite sure how to build an SDK with meta-go-toolchain included.

that is more like a meta-toolchain target

Quoted 15 lines

so I added something like that to local.conf which seems to work for the "classic" SDK:

# --> golang stuff

# attempt to add golang to SDK
TOOLCHAIN_HOST_TASK_append = " \
    packagegroup-go-cross-canadian-${MACHINE} \
"

TOOLCHAIN_TARGET_TASK_append = " \
    ${@multilib_pkg_extend(d, 'packagegroup-go-sdk-target')} \
"
# <-- golang stuff

Quoted 8 lines

bitbake core-image-sato-sdk -c populate_sdk

and currently also for:
bitbake core-image-sato-sdk -c populate_sdk_ext

I don't think that's the way it was intended.

Can you please enlighten me?

what you did is roughly what should be needed. Maybe you might want to create a -dev image

perhaps adding nativesdk-go to TOOLCHAIN_HOST_TASK might get everything you need

Quoted 7 lines

Regards,

Robert

#2 lore raw

Unlike other languages go has the ability to produce cross platform binaries. In my case, I just used my go to produce binaries for my yocto based target and just included it. it was too much effort to incorporate the go toolchain. But then it was > 1 year ago.

srini

________________________________
From: [email protected] <[email protected]> on behalf of Khem Raj via lists.yoctoproject.org <[email protected]>
Sent: Thursday, June 18, 2020 8:27 PM
To: Robert Berger <[email protected]>; [email protected] <[email protected]>
Cc: Robert Berger <[email protected]>
Subject: Re: [yocto] Go toolchain in SDK

Quoted 5 lines · Robert Berger

Hi,

What is the "proper" way to add the Go toolchain to an SDK nowadays (dunfell)?

I dont think there is sample image target for image based SDKs

Quoted 6 lines

I saw there is in poky:

./meta/recipes-core/meta/meta-go-toolchain.bb

but I am not quite sure how to build an SDK with meta-go-toolchain included.

that is more like a meta-toolchain target

Quoted 15 lines

so I added something like that to local.conf which seems to work for the "classic" SDK:

# --> golang stuff

# attempt to add golang to SDK
TOOLCHAIN_HOST_TASK_append = " \
    packagegroup-go-cross-canadian-${MACHINE} \
"
TOOLCHAIN_TARGET_TASK_append = " \
    ${@multilib_pkg_extend(d, 'packagegroup-go-sdk-target')} \

"
# <-- golang stuff

Quoted 8 lines

bitbake core-image-sato-sdk -c populate_sdk

and currently also for:
bitbake core-image-sato-sdk -c populate_sdk_ext

I don't think that's the way it was intended.

Can you please enlighten me?

what you did is roughly what should be needed. Maybe you might want to create a -dev image

perhaps adding nativesdk-go to TOOLCHAIN_HOST_TASK might get everything you need

Quoted 7 lines

Regards,

Robert