#golang Build tools required during go generate
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?
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"
Quoted 6 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 20 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
You automatically follow any topics you start or reply to. View/Reply Online (#55250): https://lists.yoctoproject.org/g/yocto/message/55250
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1997914
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
A message that is not in the archive (sent off-list or not yet received): SA1PR05MB804852017544ACEA696B255CCC8E9@SA1PR05MB8048.namprd05.prod.outlook.com
There is literaly no stacktrace just a segmentation fault pretty early in the execution (like 3rd instruction or something). I will send more outputs as soon as my dual-core has finished compiling stuff again :/
Von: Khem Raj <[email protected]>
Datum: Freitag, 5. November 2021 um 18:29
An: Sebastian Rühl <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generate
Quoted 11 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 20 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
You automatically follow any topics you start or reply to. View/Reply Online (#55250): https://lists.yoctoproject.org/g/yocto/message/55250
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1997914
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
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) = 0x556083886000arch_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 <[email protected]>
Datum: Freitag, 5. November 2021 um 18:29
An: Sebastian Rühl <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generate
Quoted 11 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 20 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
You automatically follow any topics you start or reply to. View/Reply Online (#55250): https://lists.yoctoproject.org/g/yocto/message/55250
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1997914
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
I'd bet it is a variant of this:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14386
Bruce
Quoted 138 lines · Sebastian Rühl
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 */) = 0brk(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:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002Program received signal SIGSEGV, Segmentation fault.
0x00007fcfd962c2fain 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 <[email protected]>
Datum: Freitag, 5. November 2021 um 18:29
An: Sebastian Rühl <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateQuoted 11 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 12 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#55255): https://lists.yoctoproject.org/g/yocto/message/55255
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1050810
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
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"
But it didn’t help ☹
Sebastian
Von: Bruce Ashfield <[email protected]>
Datum: Freitag, 5. November 2021 um 20:07
An: Sebastian Rühl <[email protected]>
Cc: Khem Raj <[email protected]>, [email protected] <[email protected]>
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
Quoted 129 lines · Sebastian Rühl
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 */) = 0brk(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:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002Program received signal SIGSEGV, Segmentation fault.
0x00007fcfd962c2fain 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 <[email protected]>
Datum: Freitag, 5. November 2021 um 18:29
An: Sebastian Rühl <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateQuoted 11 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 12 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"
Quoted 9 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#55255): https://lists.yoctoproject.org/g/yocto/message/55255
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1050810
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
Quoted 10 lines · Sebastian Rühl
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
Quoted 168 lines
But it didn’t help ☹
Sebastian
Von: Bruce Ashfield <[email protected]>
Datum: Freitag, 5. November 2021 um 20:07
An: Sebastian Rühl <[email protected]>
Cc: Khem Raj <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateI'd bet it is a variant of this:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14386
Bruce
Quoted 129 lines · Sebastian Rühl
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 */) = 0brk(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:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002Program received signal SIGSEGV, Segmentation fault.
0x00007fcfd962c2fain 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 <[email protected]>
Datum: Freitag, 5. November 2021 um 18:29
An: Sebastian Rühl <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateQuoted 11 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 12 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"Quoted 9 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#55255): https://lists.yoctoproject.org/g/yocto/message/55255
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1050810
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=---
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end - "Use the force Harry" - Gandalf, Star Trek II
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 <[email protected]>
Datum: Freitag, 5. November 2021 um 21:51
An: Sebastian Rühl <[email protected]>
Cc: Khem Raj <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generate
Quoted 10 lines · Sebastian Rühl
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
Quoted 164 lines
But it didn’t help ☹
Sebastian
Von: Bruce Ashfield <[email protected]>
Datum: Freitag, 5. November 2021 um 20:07
An: Sebastian Rühl <[email protected]>
Cc: Khem Raj <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateI'd bet it is a variant of this:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14386
Bruce
Quoted 129 lines · Sebastian Rühl
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 */) = 0brk(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:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002Program received signal SIGSEGV, Segmentation fault.
0x00007fcfd962c2fain 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 <[email protected]>
Datum: Freitag, 5. November 2021 um 18:29
An: Sebastian Rühl <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateQuoted 11 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 12 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"Quoted 9 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#55255): https://lists.yoctoproject.org/g/yocto/message/55255
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1050810
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 4 lines
--
- 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
I tweaked the recipe a bit (you should use SRCREV, versus a tag), etc, and added some link flags to make things static.
This tends to be why I write my own do_compile for go applications, so I can use the provided Makefiles when possible (although there were a few bad things in the project Makefile .. so using the built in go.bbclass works just as well).
The almost-no-testing recipe is here:
I did see segfaults with other combinations of flags, but I didn't go back to isolate if all of my tweaks are required or not.
build [/home/bruc...9d7f52f-r0]> ./build/bin/easyjson Usage of ./build/bin/easyjson:
Bruce
Bruce
Quoted 262 lines · 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 <[email protected]>
Datum: Freitag, 5. November 2021 um 21:51
An: Sebastian Rühl <[email protected]>
Cc: Khem Raj <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateQuoted 10 lines · Sebastian Rühl
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
Quoted 164 lines
But it didn’t help ☹
Sebastian
Von: Bruce Ashfield <[email protected]>
Datum: Freitag, 5. November 2021 um 20:07
An: Sebastian Rühl <[email protected]>
Cc: Khem Raj <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateI'd bet it is a variant of this:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=14386
Bruce
Quoted 129 lines · Sebastian Rühl
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 */) = 0brk(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:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/ld-linux-x86-64.so.2: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010001BFD: warning: /workdir/build/tmp/sysroots-uninative/x86_64-linux/lib/.debug/ld-2.33.so: unsupported
GNU_PROPERTY_TYPE(5) type:0xc0010002Program received signal SIGSEGV, Segmentation fault.
0x00007fcfd962c2fain 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 <[email protected]>
Datum: Freitag, 5. November 2021 um 18:29
An: Sebastian Rühl <[email protected]>, [email protected] <[email protected]>
Betreff: Re: [yocto] #golang Build tools required during go generateQuoted 11 lines · On 11/5/21 7:32 AM, [email protected] wrote:
Hi yoto-devs/users,
in order to get a golang application to run which relies on
go generatecalls 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
Quoted 12 lines
Sebastian
[1]
inherit go-mod
BBCLASSEXTEND = "native"
[2]
DEPENDS += "random-go-tool-needed-by-recipe-native"Quoted 9 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#55255): https://lists.yoctoproject.org/g/yocto/message/55255
Mute This Topic: https://lists.yoctoproject.org/mt/86841696/1050810
Mute #golang:https://lists.yoctoproject.org/g/yocto/mutehashtag/golang Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-Quoted 4 lines
--
- Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
Quoted 4 lines
--
- 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