Re: #golang Build tools required during go generate #golang


Sebastian Rühl
 

Sure here you go:

 

```

SUMMARY = "easyjson"

DESCRIPTION = "easy json command util"

HOMEPAGE = "https://github.com/mailru/easyjson"

LICENSE = "MIT"

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

 

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

 

SRC_URI = "git://${GO_IMPORT};nobranch=1;protocol=https"

SRCREV = "v${PV}"

 

GO_IMPORT = "github.com/mailru/easyjson"

GO_WORKDIR ?= "${GO_IMPORT}/easyjson"

 

GO_LINKSHARED = ""

export CGO_ENABLED = "0"

 

inherit go-mod

BBCLASSEXTEND = "native"

# Upstream class "forgot" this argument

GOBUILDFLAGS:append = " -trimpath"

 

INSANE_SKIP = "arch"

```

 

Sebastian

 

Von: Bruce Ashfield <bruce.ashfield@...>
Datum: Freitag, 5. November 2021 um 21:51
An: Sebastian Rühl <sebastian@...>
Cc: Khem Raj <raj.khem@...>, yocto@... <yocto@...>
Betreff: Re: [yocto] #golang Build tools required during go generate

On Fri, Nov 5, 2021 at 3:18 PM Sebastian Rühl <sebastian@...> wrote:
>
> Yep might be… For me that’s desirable as these a built-utils, it’s golang and I see no benefit in having them dynamically linked anyay. Any tips how to statically link these? As far as I understand the golang classes do dynamic linking by default. Btw. I’m using the backported 1.16 versions from hardknot but I don’t think that matters as our “main” application works just perfectly fine on the target hardware.
>
>
>
> I tried:
>
> GO_LINKSHARED = ""
>
> export CGO_ENABLED = "0"

It varies based on the application, the ones I've dealt with, tend to
have a -static flag.

Of course, the flag may not be exposed, and in those scenarios, I
patch the Makefile/build.

If you have public repos, or a pointer to the source of the
applications, I could have a look to see if there's anything I can
specifically recommend.

Bruce

>
>
>
> But it didn’t help
>
>
>
> Sebastian
>
>
>
> Von: Bruce Ashfield <bruce.ashfield@...>
> Datum: Freitag, 5. November 2021 um 20:07
> An: Sebastian Rühl <sebastian@...>
> Cc: Khem Raj <raj.khem@...>, yocto@... <yocto@...>
> Betreff: Re: [yocto] #golang Build tools required during go generate
>
> I'd bet it is a variant of this:
>
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=14386
>
> Bruce
>
> On Fri, Nov 5, 2021 at 2:58 PM Sebastian Rühl <sebastian@...> wrote:
> >
> > Here some outputs:
> >
> >
> >
> > Bitbake -c devshell target-recipe
> >
> > sh-4.4# easyjson
> >
> > Segmentation fault
> >
> > sh-4.4# strace easyjson
> >
> > execve("/workdir/build/tmp/work/aarch64-fslc-linux/datadog-agent/7.31.1-r0/recipe-sysroot-native/usr/bin/easyjson", ["easyjson"], 0x7ffc7e88d530 /* 138 vars */) = 0
> >
> > brk(NULL)                               = 0x556083886000
> >
> > arch_prctl(0x3001 /* ARCH_??? */, 0x7fffd54fcc80) = -1 EINVAL (Invalid argument)
> >
> > --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x556083a1d000} ---
> >
> > +++ killed by SIGSEGV +++
> >
> > Segmentation fault
> >
> > sh-4.4# file $(which easyjson)
> >
> > /workdir/build/tmp/work/aarch64-fslc-linux/datadog-agent/7.31.1-r0/recipe-sysroot-native/usr/bin/easyjson: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2, stripped
> >
> > sh-4.4# gdb $(which easyjson)
> >
> > GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
> >
> > Copyright (C) 2018 Free Software Foundation, Inc.
> >
> > License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> >
> > This is free software: you are free to change and redistribute it.
> >
> > There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
> >
> > and "show warranty" for details.
> >
> > This GDB was configured as "x86_64-linux-gnu".
> >
> > Type "show configuration" for configuration details.
> >
> > For bug reporting instructions, please see:
> >
> > <http://www.gnu.org/software/gdb/bugs/>.
> >
> > Find the GDB manual and other documentation resources online at:
> >
> > <http://www.gnu.org/software/gdb/documentation/>.
> >
> > For help, type "help".
> >
> > Type "apropos word" to search for commands related to "word"...
> >
> > Reading symbols from /workdir/build/tmp/work/aarch64-fslc-linux/datadog-agent/7.31.1-r0/recipe-sysroot-native/usr/bin/easyjson...(no debugging symbols found)...done.
> >
> > (gdb) run
> >
> > Starting program: /workdir/build/tmp/work/aarch64-fslc-linux/datadog-agent/7.31.1-r0/recipe-sysroot-native/usr/bin/easyjson
> >
> > warning: Error disabling address space randomization: Operation not permitted
> >
> > BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
> >
> > BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
> >
> > BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010001
> >
> > BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported GNU_PROPERTY_TYPE (5) type: 0xc0010002
> >
> >
> >
> > Program received signal SIGSEGV, Segmentation fault.
> >
> > 0x00007fcfd962c2fa in strcmp () from /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2
> >
> > (gdb)
> >
> >
> >
> > Hope that helps….
> >
> >
> >
> > Small background: Yocto on dunfell, build with poky docker image
> >
> >
> >
> > Von: Khem Raj <raj.khem@...>
> > Datum: Freitag, 5. November 2021 um 18:29
> > An: Sebastian Rühl <sebastian@...>, yocto@... <yocto@...>
> > Betreff: Re: [yocto] #golang Build tools required during go generate
> >
> >
> >
> > On 11/5/21 7:32 AM, sebastian@... wrote:
> > > Hi yoto-devs/users,
> > >
> > > in order to get a golang application to run which relies on `go
> > > generate` calls I wrote special recipes for this tools and include them
> > > in my original recipe. However I always get a segmentation fault.
> > > In the tools (which happens to be based on golang too) I use [1] in the
> > > recipes and in the recipe I want to use them I include them via [2].
> > > However if for example enter the dev-shell or during build I get a
> > > segmentation fault although the binary seems to be compiled for the
> > > right architecture (host-amd64).
> > > Is there something wrong I try to use that?
> >
> > do you have stack trace ? that might give some more info on whats going on
> >
> > >
> > > Sebastian
> > >
> > > [1]
> > > inherit go-mod
> > > BBCLASSEXTEND = "native"
> > > [2]
> > > DEPENDS += "random-go-tool-needed-by-recipe-native"
> > >
> > >
> > >
> > >
> >
> >
> >
> >
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II



--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

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