Re: Yocto recipe for Tailscale #yocto #golang


Khem Raj
 


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 

On Tue, Oct 13, 2020 at 11:51 AM Mike Thompson via lists.yoctoproject.org <mthompson=dustyrobotics.com@...> wrote:

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 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 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




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