# Mender-artifact with nativesdk bbclass

**URL:** <https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126>\
**Category:** General Discussions\
**Created:** [October 8, 2019, 10:53pm UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126 "2019-10-08T22:53:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcampbellizo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mcampbellizo/32/395_2.png) [@mcampbellizo](https://hub.mender.io/u/mcampbellizo)\
**Post date:** [October 8, 2019, 10:53pm UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/1 "2019-10-08T22:53:20Z")

</div>

I’m trying to extend the mender-artifact recipe with nativesdk so I can include it in our SDK. We would like to use it for manipulating the artifact to inject applications build with the SDK. I found a post on the old mailing list, but there was no response: [https://groups.google.com/a/lists.mender.io/forum/#!msg/mender/6\_A7TVA\_H18/EfxRApwBCAAJ](https://groups.google.com/a/lists.mender.io/forum/#!msg/mender/6_A7TVA_H18/EfxRApwBCAAJ)

I’m very familiar with Yocto, but not so much with golang, so I’m a bit stumped on where to even start.

I’m hitting the following error:

```auto
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="off"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH="/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/build:/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot/opt/modus/tonos-r1/2.1.0/sysroots/x86_64-modussdk-linux/usr/lib/x86_64-modussdk-linux/go"
    GOPROXY=""
    GORACE=""
    GOROOT="/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot-native/usr/lib/go"
    GOTMPDIR="/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/go-tmp"
    GOTOOLDIR="/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot-native/usr/lib/x86_64-modussdk-linux/go/pkg/tool/linux_amd64"
    GCCGO="gccgo"
    CC="x86_64-modussdk-linux-gcc --sysroot=/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot"
    CXX="x86_64-modussdk-linux-g++ --sysroot=/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot"
    CGO_ENABLED="1"
    GOMOD=""
    CGO_CFLAGS="-O2 -pipe"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-O2 -pipe"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-Wl,-O1"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="--sysroot=/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/go-tmp/go-build653512947=/tmp/go-build -gno-record-gcc-switches"
    NOTE: make -j 8 GOPATH=/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/build:/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot/opt/modus/tonos-r1/2.1.0/sysroots/x86_64-modussdk-linux/usr/lib/x86_64-modussdk-linux/go -C /home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/build/src/github.com/mendersoftware/mender-artifact V=1 install
    make: Entering directory '/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/git/src/github.com/mendersoftware/mender-artifact'
    cd cli/mender-artifact && x86_64-modussdk-linux-go install -ldflags "-X main.Version=2.4.1" -v 
    NOTE: .com is removed below as the forum wont let me post links
    github./mendersoftware/mender-artifact/vendor/golang.org/x/sys/unix
    github./mendersoftware/mender-artifact/vendor/github.com/pkg/errors
    github./mendersoftware/mender-artifact/vendor/github.com/urfave/cli
    github./mendersoftware/mender-artifact/artifact
    github./mendersoftware/mender-artifact/handlers
    github./mendersoftware/mender-artifact/awriter
    github./mendersoftware/mender-artifact/areader
    github./mendersoftware/mender-artifact/vendor/golang.org/x/crypto/ssh/terminal
    github./mendersoftware/mender-artifact/vendor/github.com/sirupsen/logrus
    github./mendersoftware/mender-artifact/cli/mender-artifact
    # github.com/mendersoftware/mender-artifact/cli/mender-artifact
    /home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/recipe-sysroot-native/usr/lib/x86_64-modussdk-linux/go/pkg/tool/linux_amd64/link: seeking to -12042 in $WORK/b001/exe/a.out: seek $WORK/b001/exe/a.out: invalid argument
    Makefile:45: recipe for target 'install' failed
    make: *** [install] Error 2
    make: Leaving directory '/home/mcampbell/work/izo-yocto/build-tonos-r1/tmp/work/x86_64-nativesdk-modussdk-linux/nativesdk-mender-artifact/2.4.1-r0/git/src/github.com/mendersoftware/mender-artifact'
    ERROR: oe_runmake failed
    WARNING: exit code 1 from a shell command.

```

Edit: @mirzak: Formatting

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [October 9, 2019, 7:51am UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/2 "2019-10-09T07:51:17Z")

</div>

I tried to reproduce using the `warrior` branch together with poky, but it worked for me. At least the following sequence,

I updated the recipe with:

```auto
BBCLASSEXTEND = "native nativesdk"

```

and then ran:

```auto
bitbake nativesdk-mender-artifact

```

Which Yocto version are you using?

---

<div class="post-metadata">

**Author:** ![mcampbellizo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mcampbellizo/32/395_2.png) [@mcampbellizo](https://hub.mender.io/u/mcampbellizo)\
**Post date:** [October 9, 2019, 11:49am UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/3 "2019-10-09T11:49:19Z")

</div>

Thanks for the super quick reply! We are currently on Thud, so this is a good clue. I’ll take a look at what’s changed in go.bbclass between the two versions of Poky. I bet the answer is in there.

That gives me something to dig into but if you have any other thoughts they would be appreciated.

---

<div class="post-metadata">

**Author:** ![mcampbellizo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mcampbellizo/32/395_2.png) [@mcampbellizo](https://hub.mender.io/u/mcampbellizo)\
**Post date:** [October 9, 2019, 12:38pm UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/4 "2019-10-09T12:38:53Z")

</div>

Sorry, I spaced. We’re actually on Poky Thud, not Rocko. (I edited the original post to be correct).

---

<div class="post-metadata">

**Author:** ![mcampbellizo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mcampbellizo/32/395_2.png) [@mcampbellizo](https://hub.mender.io/u/mcampbellizo)\
**Post date:** [October 9, 2019, 3:25pm UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/5 "2019-10-09T15:25:08Z")

</div>

I tried just copying in `go.bbclass` from the master of Poky into my Thud version of Poky locally. Unfortunately, the error still persists.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [October 9, 2019, 3:57pm UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/6 "2019-10-09T15:57:01Z")

</div>

Can at least confirm that I can reproduce this on `thud` as well. Though no idea why it is happening yet 🙂

---

<div class="post-metadata">

**Author:** ![mcampbellizo](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mcampbellizo/32/395_2.png) [@mcampbellizo](https://hub.mender.io/u/mcampbellizo)\
**Post date:** [October 9, 2019, 4:37pm UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/7 "2019-10-09T16:37:28Z")

</div>

Thanks for giving me some sanity there. FYI, I’ve decided to take the binary built by the `mender-artifact-native` recipe and create a nativesdk recipe that just copied that prebuilt binary in. That will get us going for now. We plan up on updating to Warrior in the future so we will be able to go back tot he more proper method of building from source at that time. Thank you very much for the help!

---

<div class="post-metadata">

**Author:** ![wkswain](https://avatars.discourse-cdn.com/v4/letter/w/3e96dc/32.png) [@wkswain](https://hub.mender.io/u/wkswain)\
**Post date:** [May 25, 2020, 10:51pm UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/8 "2020-05-25T22:51:31Z")

</div>

@mirzak  
I noticed above that GOCACHE is “off”. I’ve come across this a couple times on xilinx-zynq, and now again on xilinx-zynqmp. Xilinx currently supports “thud”.

I’ve found that for mender, mender-artifact, and any other golang recipes, I’ve had to add the following to those recipes as a workaround:

do\_compile\_prepend () {  
export GOCACHE="${B}/.cache"  
}

This is probably fixed somewhere after thud branch. Hope that helps someone else.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [May 26, 2020, 6:39am UTC](https://hub.mender.io/t/mender-artifact-with-nativesdk-bbclass/1126/9 "2020-05-26T06:39:44Z")

</div>

Thanks for reporting @wkswain.

I have never experienced any problems with this. Looking at `go.bbclass`, this was only fixed on `zeus` branch and later. But I guess it depends on the host environment if it allows it or not.

The upstream fix:

> <https://github.com/openembedded/openembedded-core/commit/9a6d208b9979035bbfc1def80fb6558db4bddb12#diff-72f5e17657d96fc56979a44217d8cc83>

I think it would be ok to fix this in the Mender recipes, but if the problem exists for all go recipes I do not know if it is helpful.
