Re: Yocto recipe for Tailscale #yocto #golang


Khem Raj
 

On 9/18/20 4:46 PM, Mike Thompson via lists.yoctoproject.org wrote:
OK, I'm making some progress a Bitbake recipe for the Tailscale client built using Go from various samples I found in the OpenEmbedded layers.
However, I'm running into import issues during compilation and I'm hoping a person familiar with Go might be able to provide some hints. From what I can tell, Go packages to are allowed to declare that they must be imported using a specific name <https://golang.org/cmd/go/#hdr-Import_path_checking> and it seems that declaration is included in the Tailscale source code.
Is there a way to craft the Bitbake recipe to honor that requirement for the Tailscale Go source code?
Currently, my Bitbake recipe for Tailscale looks as shown below.
tailscale_1.0.5.bb
-----------------------------------------------------------------
SUMMARY = "Tailscale client and daemon for Linux"
HOMEPAGE = "github.com/tailscale/tailscale"
LICENSE = "DWTFYW"
LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=d995c1c44529856a0f35a5ad43e51cc5"
GO_IMPORT = "github.com/tailscale/tailscale"
SRC_URI = "git://${GO_IMPORT};nobranch=1;tag=v${PV}"
inherit go
GO_INSTALL = "${GO_IMPORT}/cmd/tailscale"
RDEPENDS_${PN}-dev += "bash"
-----------------------------------------------------------------
The Bitbake output with the import error is below:
-----------------------------------------------------------------
$ bitbake tailscale
...
NOTE: Executing Tasks
ERROR: tailscale-1.0.5-r0 do_compile: Execution of '/home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/temp/run.do_compile.10615' failed with exit code 1:
can't load package: package github.com/tailscale/tailscale/cmd/tailscale: code in directory /home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/build/src/github.com/tailscale/tailscale/cmd/tailscale expects import "tailscale.com/cmd/tailscale"
can't load package: package .: no Go files in /home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/build
WARNING: exit code 1 from a shell command.
ERROR: Logfile of failure stored in: /home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/temp/log.do_compile.10615
Log data follows:
| DEBUG: Executing shell function do_compile
| can't load package: package github.com/tailscale/tailscale/cmd/tailscale: code in directory /home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/build/src/github.com/tailscale/tailscale/cmd/tailscale expects import "tailscale.com/cmd/tailscale"
| can't load package: package .: no Go files in /home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/build
| WARNING: exit code 1 from a shell command.
| ERROR: Execution of '/home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/temp/run.do_compile.10615' failed with exit code 1:
| can't load package: package github.com/tailscale/tailscale/cmd/tailscale: code in directory /home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/build/src/github.com/tailscale/tailscale/cmd/tailscale expects import "tailscale.com/cmd/tailscale"
| can't load package: package .: no Go files in /home/mike/Development/markbot_linux/build_markbot/tmp/work/corei7-64-dusty-linux/tailscale/1.0.5-r0/build
| WARNING: exit code 1 from a shell command.
|
ERROR: Task (/home/mike/Development/markbot_linux/sources/meta-markbot/recipes-tailscale/tailscale/tailscale_1.0.5.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2253 tasks of which 2245 didn't need to be rerun and 1 failed.
-----------------------------------------------------------------
Thanks,
Mike Thompson

perhaps you need to inherit go-mod as well, if its using modules.

Join yocto@lists.yoctoproject.org to automatically receive all group messages.