Skip to contentSkip to conversation

Yocto recipe for Tailscale #yocto #golang

DISCUSSION Mike Thompson 4 participants 10 messages Sep 18, 2020 – Oct 13, 2020

lore
Share & tools
lore
#0 lore raw

Does anyone know if there is an existing bitbake recipe for building the Tailscale client daemon and CLI tool from the following source?  A search on Google yielded no obvious links.

https://github.com/tailscale/tailscale

The Tailscale client for Linux looks to be built using the Go language which is a complete unknown to me. I've built very simple recipes before for basic Makefile and Automake built software, but I suppose Go brings a new set of challenges.

If an existing recipe is not available, any words of wisdom before I get started on this?

Thanks,

Mike Thompson

#1 lore raw

Hi Mike,

Quoted 5 lines · Mike Thompson via lists.yoctoproject.org

Does anyone know if there is an existing bitbake recipe for building the Tailscale client daemon and CLI tool from the following source? A search on Google yielded no obvious links.

https://github.com/tailscale/tailscale

I usually search on the OpenEmbedded layer index:
http://layers.openembedded.org/layerindex/branch/master/recipes/?q=tailscale

Seems like you are right, there seems to be no recipe available. Be aware that not all recipes/layers are listed there, but the majority are.

Quoted 8 lines

The Tailscale client for Linux looks to be built using the Go language which is a complete unknown to me. I've built very simple recipes before for basic Makefile and Automake built software, but I suppose Go brings a new set of challenges.

If an existing recipe is not available, any words of wisdom before I get started on this?

I never used Go in the Yocto/OpenEmbedded environment, but I'm sure somebody else who has more experience will be able to help. To get started with writing a new recipe I usually get my inspiration from similar recipes (similar language, build system, dependencies, etc.).

Quoted 3 lines

Thanks,

Mike Thompson

#2 lore raw

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

#3 lore raw
Quoted 35 lines · Mike Thompson via lists.yoctoproject.org

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"
Quoted 8 lines
| 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.

Quoted 4 lines
#4 lore raw

Inheriting from go-mod didn't make any difference that I could tell.

This is what I have so far for the Tailscale recipe.  I'm resolving dependencies with individual Bitbake files that pull in each dependency as I find them.

---------------------------------------------

# tailscale_1.0.5.bb

SUMMARY = "Tailscale client and daemon for Linux"

HOMEPAGE = "github.com/tailscale/tailscale"

LICENSE = "CLOSED"

LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=d995c1c44529856a0f35a5ad43e51cc5"

SRC_URI = "git://github.com/tailscale/tailscale.git;nobranch=1;tag=v${PV}"

DEPENDS += "github.com-apenwarr-fixconsole \

github.com-coreos-go-iptable \

github.com-godbus-dbus \

github.com-golang-groupcache \

github.com-jsimonetti-rtnetlink \

github.com-klauspost-compress \

github.com-mdlayher-netlink \

github.com-pborman-getopt \

github.com-peterbourgon-ff \

github.com-tailscale-wireguard-go \

github.com-tcnksm-go-httpstat \

github.com-toqueteos-webbrowser \

golang.org-x \

go4.org-mem \

inet.af-netaddr \

rsc.io-goversion \

"

inherit go

inherit go-mod

GO_IMPORT = "tailscale.com"

GO_INSTALL = "${GO_IMPORT}/cmd/tailscale"

RDEPENDS_${PN}-dev += "bash"

---------------------------------------------

Unfortunately, the golang.org-x.bb recipe is turning into an endless source of dependencies during do_compile stage.  I feel I must be on the wrong track.

Is there a way to package up the following so that just what is needed by Tailscale is included, but dependencies not needed by Tailscale are ignored?

---------------------------------------------

# golang.org-x.bb
DESCRIPTION = "Go X libraries"

SRC_URI = "\
git://github.com/golang/mod.git;protocol=https;name=mod;destsuffix=${PN}-${PV}/src/golang.org/x/mod \
git://github.com/golang/net.git;protocol=https;name=net;destsuffix=${PN}-${PV}/src/golang.org/x/net \
git://github.com/golang/sys.git;protocol=https;name=sys;destsuffix=${PN}-${PV}/src/golang.org/x/sys \
git://github.com/golang/text.git;protocol=https;name=text;destsuffix=${PN}-${PV}/src/golang.org/x/text \
git://github.com/golang/time.git;protocol=https;name=time;destsuffix=${PN}-${PV}/src/golang.org/x/time \
git://github.com/golang/sync.git;protocol=https;name=sync;destsuffix=${PN}-${PV}/src/golang.org/x/sync \
git://github.com/golang/tools.git;protocol=https;name=tools;destsuffix=${PN}-${PV}/src/golang.org/x/tools \
git://github.com/golang/build.git;protocol=https;name=build;destsuffix=${PN}-${PV}/src/golang.org/x/build \
git://github.com/golang/oauth2.git;protocol=https;name=oauth2;destsuffix=${PN}-${PV}/src/golang.org/x/oauth2 \
git://github.com/golang/crypto.git;protocol=https;name=crypto;destsuffix=${PN}-${PV}/src/golang.org/x/crypto \
git://github.com/golang/xerrors.git;protocol=https;name=xerrors;destsuffix=${PN}-${PV}/src/golang.org/x/xerrors \
"
SRCREV_FORMAT = "golang"
SRCREV_mod = "${AUTOREV}"
SRCREV_net = "${AUTOREV}"
SRCREV_sys = "${AUTOREV}"
SRCREV_text = "${AUTOREV}"
SRCREV_time = "${AUTOREV}"
SRCREV_sync = "${AUTOREV}"
SRCREV_tools = "${AUTOREV}"
SRCREV_build = "${AUTOREV}"
SRCREV_oauth2 = "${AUTOREV}"
SRCREV_crypto = "${AUTOREV}"
SRCREV_xerrors = "${AUTOREV}"

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

inherit go
GO_IMPORT = "golang.org/x"
---------------------------------------------

Thanks,

Mike Thompson

#5 lore raw

I seemed to have resolved all my issues getting a Yocto Bitbake recipe for the Tailscale client and CLI utility.

For future reference and in case it helps others, below is my Bitbake recipe:

------------------------------------------------

# tailscale_1.0.5.bb

SUMMARY = "Tailscale client and daemon for Linux"

HOMEPAGE = "github.com/tailscale/tailscale"

SECTION = "net"

LICENSE = "CLOSED"

LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=d995c1c44529856a0f35a5ad43e51cc5"

SRC_URI = "git://github.com/tailscale/tailscale.git;nobranch=1;tag=v${PV}"

inherit go-mod systemd

GO_IMPORT = "tailscale.com"

GO_WORKDIR = "${GO_IMPORT}"

GO_INSTALL = "${GO_IMPORT}/cmd/tailscale ${GO_IMPORT}/cmd/tailscaled"

FILES_${PN} += "${systemd_unitdir}/*"

do_install() {

install -d ${D}/${bindir}

install -d ${D}/${sbindir}

install ${B}/bin/tailscale ${D}/${bindir}/tailscale

install ${B}/bin/tailscaled ${D}/${sbindir}/tailscaled

if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then

install -d ${D}${sysconfdir}/default/

install -m 0644 ${WORKDIR}/build/src/${GO_IMPORT}/cmd/tailscaled/tailscaled.defaults ${D}${sysconfdir}/default/tailscaled

install -d ${D}${systemd_unitdir}/system

install -m 0644 ${WORKDIR}/build/src/${GO_IMPORT}/cmd/tailscaled/tailscaled.service ${D}${systemd_unitdir}/system/tailscaled.service

install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants/

ln -s ${systemd_unitdir}/system/tailscaled.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/tailscaled.service

fi

}

SYSTEMD_PACKAGES = "${PN}"

SYSTEMD_SERVICE_${PN} = "tailscaled.service"

SYSTEMD_AUTO_ENABLE = "enable"

------------------------------------------------

When installed on my target system, systemd reports the following for the tailscaled daemon:
------------------------------------------------
[[0;1;32m●[[0m tailscaled.service - Tailscale node agent
Loaded: loaded (/lib/systemd/system/tailscaled.service; enabled; vendor preset: enabled)
Active: [[0;1;32mactive (running)[[0m since Sat 2020-09-19 20:46:02 UTC; 4min 44s ago
Docs: https://tailscale.com/kb/
Main PID: 252 (tailscaled)
Tasks: 13 (limit: 19081)
Memory: 56.5M
CGroup: /system.slice/tailscaled.service
└─252 /usr/sbin/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tai lscaled.sock --port 41641

Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: cancelMapSafely: synced=false
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: cancelMapSafely: wrote to channel
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: mapRoutine: new map needed while idle.
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: mapRoutine: state:url-visit-required
Sep 19 20:48:03 amber tailscaled[252]: 7.3M/39.1M LinkChange(isExpensive=false); needsRebind=false
Sep 19 20:48:03 amber tailscaled[252]: 7.3M/39.1M magicsock: starting endpoint update (link-change-minor)
Sep 19 20:48:03 amber tailscaled[252]: 7.6M/39.1M LinkChange(isExpensive=false); needsRebind=false
Sep 19 20:48:03 amber tailscaled[252]: 7.6M/39.1M magicsock: starting endpoint update (link-change-minor)
Sep 19 20:48:03 amber tailscaled[252]: 7.5M/39.1M LinkChange(isExpensive=false); needsRebind=false
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M magicsock: starting endpoint update (link-change-minor)

------------------------------------------------

And ifconfig reports the following:
------------------------------------------------

# ifconfig

tailscale0 Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

inet6 addr: fe80::7f12:8835:cc06:b3e7/64 Scope:Link

UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1280  Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:14 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:500

RX bytes:0 (0.0 B)  TX bytes:825 (825.0 B)

------------------------------------------------

Thank you to Khem for the tip on looking into "inherit go-mod" and patience while I sorted through this.

Mike Thompson

#6 lore raw
Quoted 5 lines · Mike Thompson via lists.yoctoproject.org

I seemed to have resolved all my issues getting a Yocto Bitbake recipe for the Tailscale client and CLI utility.

For future reference and in case it helps others, below is my Bitbake recipe:

Hi Mike,

Could you send your tailscale recipe to meta-openembedded/meta-networking?
    Email: OpenEmbedded Development mailing list <[email protected]>
    Instructions: https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

It looks like all the work is done aside from an email!

../Randy

Quoted 114 lines

------------------------------------------------

# tailscale_1.0.5.bb

SUMMARY = "Tailscale client and daemon for Linux"

HOMEPAGE = "github.com/tailscale/tailscale"

SECTION = "net"

LICENSE = "CLOSED"

LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=d995c1c44529856a0f35a5ad43e51cc5"

SRC_URI = "git://github.com/tailscale/tailscale.git;nobranch=1;tag=v${PV}"

inherit go-mod systemd

GO_IMPORT = "tailscale.com"

GO_WORKDIR = "${GO_IMPORT}"

GO_INSTALL = "${GO_IMPORT}/cmd/tailscale ${GO_IMPORT}/cmd/tailscaled"

FILES_${PN} += "${systemd_unitdir}/*"

do_install() {

    install -d ${D}/${bindir}

    install -d ${D}/${sbindir}

    install ${B}/bin/tailscale ${D}/${bindir}/tailscale

    install ${B}/bin/tailscaled ${D}/${sbindir}/tailscaled

    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then

        install -d ${D}${sysconfdir}/default/

        install -m 0644 ${WORKDIR}/build/src/${GO_IMPORT}/cmd/tailscaled/tailscaled.defaults ${D}${sysconfdir}/default/tailscaled

        install -d ${D}${systemd_unitdir}/system

        install -m 0644 ${WORKDIR}/build/src/${GO_IMPORT}/cmd/tailscaled/tailscaled.service ${D}${systemd_unitdir}/system/tailscaled.service

        install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants/

        ln -s ${systemd_unitdir}/system/tailscaled.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/tailscaled.service

    fi

}

SYSTEMD_PACKAGES = "${PN}"

SYSTEMD_SERVICE_${PN} = "tailscaled.service"

SYSTEMD_AUTO_ENABLE = "enable"

------------------------------------------------

When installed on my target system, systemd reports the following for the tailscaled daemon:
------------------------------------------------
[[0;1;32m●[[0m tailscaled.service - Tailscale node agent
     Loaded: loaded (/lib/systemd/system/tailscaled.service; enabled; vendor preset: enabled)
     Active: [[0;1;32mactive (running)[[0m since Sat 2020-09-19 20:46:02 UTC; 4min 44s ago
       Docs: https://tailscale.com/kb/
   Main PID: 252 (tailscaled)
      Tasks: 13 (limit: 19081)
     Memory: 56.5M
     CGroup: /system.slice/tailscaled.service
             └─252 /usr/sbin/tailscaled --state=/var/lib/tailscale/tailscaled.state --socket=/run/tailscale/tai lscaled.sock --port 41641

Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: cancelMapSafely: synced=false
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: cancelMapSafely: wrote to channel
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: mapRoutine: new map needed while idle.
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M control: mapRoutine: state:url-visit-required
Sep 19 20:48:03 amber tailscaled[252]: 7.3M/39.1M LinkChange(isExpensive=false); needsRebind=false
Sep 19 20:48:03 amber tailscaled[252]: 7.3M/39.1M magicsock: starting endpoint update (link-change-minor)
Sep 19 20:48:03 amber tailscaled[252]: 7.6M/39.1M LinkChange(isExpensive=false); needsRebind=false
Sep 19 20:48:03 amber tailscaled[252]: 7.6M/39.1M magicsock: starting endpoint update (link-change-minor)
Sep 19 20:48:03 amber tailscaled[252]: 7.5M/39.1M LinkChange(isExpensive=false); needsRebind=false
Sep 19 20:48:03 amber tailscaled[252]: 7.2M/39.1M magicsock: starting endpoint update (link-change-minor)

------------------------------------------------

And ifconfig reports the following:
------------------------------------------------

# ifconfig

tailscale0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

          inet6 addr: fe80::7f12:8835:cc06:b3e7/64 Scope:Link

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1280  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:500

          RX bytes:0 (0.0 B) TX bytes:825 (825.0 B)

------------------------------------------------

Thank you to Khem for the tip on looking into "inherit go-mod" and patience while I sorted through this. Mike Thompson

Signature · 2 lines
# Randy MacLeod
# Wind River Linux
#7 lore raw
Quoted 5 lines · Randy MacLeod

Could you send your tailscale recipe to meta-openembedded/meta-networking?

Quoted 10 lines

Email: OpenEmbedded Development mailing list <openembedded-devel@...> ( openembedded-devel@... )
Instructions: https://www.openembedded.org/wiki/How_to_submit_a_patch_to_OpenEmbedded

It looks like all the work is done aside from an email!

Sure.  I'm traveling right now, but I'll look to do this in the next week or two.

Mike Thompson

#8 lore raw

A follow up on a Yocto recipe for building a Tailscale package for others who have an interest in this.

Although the final recipe I created appears to successfully build the Tailscale utility and daemon without warnings or errors, the resulting 'tailscaled' daemon crashes when used.

Investigating this issue further I discovered that Tailscale maintains their own GoLang repository ( https://github.com/tailscale/go/tree/build-56db76510f9640d2ad652f206ae6e41c1a5d63ca ) with changes needed to support Tailscale. I suspect, but haven't proven, using the standard Yocto supported versions of GoLang to build Tailscale results in the crashes I see.  Unfortunately, I don't have enough of an understanding of GoLang to determine how to build Tailscale with the unique version of GoLang maintained by the Tailscale folks..

Instead of resolving this build issue, I instead created a Yocto recipe that utilizes the released binaries from Tailscale ( https://pkgs.tailscale.com/stable/#static ) to create a Yocto package.  This isn't ideal as I would much rather build from source, but solves my short term needs.  This alternate recipe to build a Yocto package from binaries is included below.

------------------------------------------------------------------------

tailscale_1.0.5.bb

SUMMARY = "Tailscale client and daemon for Linux from Tailscale pre-built binaries"

HOMEPAGE = "github.com/tailscale/tailscale"

SECTION = "net"

LICENSE = "CLOSED"

COMPATIBLE_HOST = "x86_64.*-linux"

# Archive URL:

#   https://pkgs.tailscale.com/stable/tailscale_1.0.5_amd64.tgz

#

# Archive contents:

#   tailscale_1.0.5_amd64/systemd

#   tailscale_1.0.5_amd64/systemd/tailscaled.service

#   tailscale_1.0.5_amd64/systemd/tailscaled.defaults

#   tailscale_1.0.5_amd64/tailscaled

#   tailscale_1.0.5_amd64/tailscale

#

# Set SRC_URI subdir to ${P} so that files are unpacked into ${S}

SRC_URI = "https://pkgs.tailscale.com/stable/${BPN}_${PV}_amd64.tgz;subdir=${P}"

SRC_URI[md5sum] = "fad1e5317ec567b77c3a0b53b8b976cf"

SRC_URI[sha256sum] = "ecfcda12068d6ecb2be72eba5572ab09406643bcc73c0cd482ae88060720c430"

inherit systemd

FILES_${PN} += "${systemd_unitdir}/*"

do_install() {

install -d ${D}/${bindir}

install -d ${D}/${sbindir}

install ${S}/${PN}_${PV}_amd64/tailscale ${D}/${bindir}/tailscale

install ${S}/${PN}_${PV}_amd64/tailscaled ${D}/${sbindir}/tailscaled

if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then

install -d ${D}${sysconfdir}/default/

install -m 0644 ${S}/${PN}_${PV}_amd64/systemd/tailscaled.defaults ${D}${sysconfdir}/default/tailscaled

install -d ${D}${systemd_unitdir}/system

install -m 0644 ${S}/${PN}_${PV}_amd64/systemd/tailscaled.service ${D}${systemd_unitdir}/system/tailscaled.service

install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants/

ln -s ${systemd_unitdir}/system/tailscaled.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/tailscaled.service

fi

}

SYSTEMD_PACKAGES = "${PN}"

SYSTEMD_SERVICE_${PN} = "tailscaled.service"

SYSTEMD_AUTO_ENABLE = "enable"

------------------------------------------------------------------------

Mike Thompson

#9 lore raw

This is not ideal to capture compiler for your app it should be written portably my guess is that app has issues with using golang properly

Do you know what changes they made to compiler and which version is it locked to

Quoted 140 lines · Mike Thompson via lists.yoctoproject.org

A follow up on a Yocto recipe for building a Tailscale package for others who have an interest in this.

Although the final recipe I created appears to successfully build the Tailscale utility and daemon without warnings or errors, the resulting 'tailscaled' daemon crashes when used.

Investigating this issue further I discovered that Tailscale maintains their own GoLang repository
<https://github.com/tailscale/go/tree/build-56db76510f9640d2ad652f206ae6e41c1a5d63ca>
with changes needed to support Tailscale. I suspect, but haven't proven, using the standard Yocto supported versions of GoLang to build Tailscale results in the crashes I see. Unfortunately, I don't have enough of an understanding of GoLang to determine how to build Tailscale with the unique version of GoLang maintained by the Tailscale folks..

Instead of resolving this build issue, I instead created a Yocto recipe that utilizes the released binaries from Tailscale
<https://pkgs.tailscale.com/stable/#static> to create a Yocto package. This isn't ideal as I would much rather build from source, but solves my short term needs. This alternate recipe to build a Yocto package from binaries is included below.

------------------------------------------------------------------------

tailscale_1.0.5.bb

SUMMARY = "Tailscale client and daemon for Linux from Tailscale pre-built binaries"

HOMEPAGE = "github.com/tailscale/tailscale"

SECTION = "net"

LICENSE = "CLOSED"

COMPATIBLE_HOST = "x86_64.*-linux"

# Archive URL:

# https://pkgs.tailscale.com/stable/tailscale_1.0.5_amd64.tgz

#

# Archive contents:

# tailscale_1.0.5_amd64/systemd

# tailscale_1.0.5_amd64/systemd/tailscaled.service

# tailscale_1.0.5_amd64/systemd/tailscaled.defaults

# tailscale_1.0.5_amd64/tailscaled

# tailscale_1.0.5_amd64/tailscale

#

# Set SRC_URI subdir to ${P} so that files are unpacked into ${S}

SRC_URI = "
https://pkgs.tailscale.com/stable/${BPN}_${PV}_amd64.tgz;subdir=${P}"

SRC_URI[md5sum] = "fad1e5317ec567b77c3a0b53b8b976cf"

SRC_URI[sha256sum] = "ecfcda12068d6ecb2be72eba5572ab09406643bcc73c0cd482ae88060720c430"

inherit systemd

FILES_${PN} += "${systemd_unitdir}/*"

do_install() {

    install -d ${D}/${bindir}

    install -d ${D}/${sbindir}

    install ${S}/${PN}_${PV}_amd64/tailscale ${D}/${bindir}/tailscale

    install ${S}/${PN}_${PV}_amd64/tailscaled ${D}/${sbindir}/tailscaled



    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false',

d)}; then

        install -d ${D}${sysconfdir}/default/

        install -m 0644 ${S}/${PN}_${PV}_amd64/systemd/tailscaled.defaults

${D}${sysconfdir}/default/tailscaled

        install -d ${D}${systemd_unitdir}/system

        install -m 0644 ${S}/${PN}_${PV}_amd64/systemd/tailscaled.service

${D}${systemd_unitdir}/system/tailscaled.service

install -d
${D}${sysconfdir}/systemd/system/multi-user.target.wants/

        ln -s ${systemd_unitdir}/system/tailscaled.service

${D}${sysconfdir}/systemd/system/multi-user.target.wants/tailscaled.service

fi

}

SYSTEMD_PACKAGES = "${PN}"

SYSTEMD_SERVICE_${PN} = "tailscaled.service"

SYSTEMD_AUTO_ENABLE = "enable"

------------------------------------------------------------------------

Mike Thompson