如何将Go-cross添加到Yocto SDK? 还是在其他计算机上编译Go for Yocto?

I have been using the Yocto SDK to compile C and C++ code for Yocto so that every machine does not need the 150GB+ Bitbake environment. Yocto version is 2.4 (Rocko)

Now I would like to have the same functionality for Golang, but I can't figure out how to do it.

If I'm on the Bitbake machine, I can call the binary arm-arch-gnueabi-go binary found under the directory tmp/work/x86_64-linux/go-cross-arm/ to compile code. But if I copy those binaries to another machine, it links to libraries with hard-coded paths on the Bitbake machine so that won't work.

Is there a way to include arm-arch-gnueabi-go in the SDK when I run populate_sdk on the image? Or is there another easy way to compile Go for the target on other machines?

You can add the following lines in local.conf file or image recipe:

TOOLCHAIN_HOST_TASK_append = " \
    packagegroup-go-cross-canadian-${MACHINE} \
"

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