summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2024-05-14 11:30:11 +0100
committerSteve Sakoman <steve@sakoman.com>2024-05-29 05:24:08 -0700
commit6ae41f83cafb1c522dbafa3e6471d7a2588d6e3e (patch)
tree7442a79e56dc2dcfe5fc9425299dcb4625cb5555 /meta/classes
parent04b2e68c4ffe66381784d4dd18c6afce55d6d9bc (diff)
downloadpoky-6ae41f83cafb1c522dbafa3e6471d7a2588d6e3e.tar.gz
go.bbclass: fix path to linker in native Go builds
Building native Go tools results in the tool pointing to the wrong location of dynamic linker (see below). The linker is looked up in the temporary dir, which can be removed if rm_work is inherited. This results in being unable to execute the program with the 'No such file or directory' error. Override linker specificiation for native recipes (and let Go build environment to pick up a correct one on it's own). The error is observed in case the distro doesn't use uninative.bbclass. If uninative.bbclass is used, the binary will be patched automatically to use the uninative loader instead of the system one. Without this patch: $ ldd tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man linux-vdso.so.1 (0x00007ffe945ec000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3a7490e000) /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/x86_64-linux/go-md2man-native/1.0.10+gitAUTOINC+f79a8a8ca6-r0/recipe-sysroot-native/usr/lib/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x00007f3a74d13000) $ tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man --help -bash: tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man: No such file or directory With the patch $ ldd tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man linux-vdso.so.1 (0x00007ffd19dbf000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2d44181000) /lib64/ld-linux-x86-64.so.2 (0x00007f2d44586000) $ tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man --help Usage of tmp-rpb-glibc/sysroots-components/x86_64/go-md2man-native/usr/bin/go-md2man: -in string Path to file to be processed (default: stdin) -out string Path to output processed file (default: stdout) (From OE-Core rev: b611c77e4883ad81a8f40cbee3fea006500735ed) Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 44b397daa68b4d0a461225fe9ff7db8b5fcfdb7b) Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/go.bbclass5
1 files changed, 4 insertions, 1 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 55f9d8f230..97366779e3 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -45,7 +45,10 @@ GO_LINKMODE ?= ""
45GO_LINKMODE:class-nativesdk = "--linkmode=external" 45GO_LINKMODE:class-nativesdk = "--linkmode=external"
46GO_LINKMODE:class-native = "--linkmode=external" 46GO_LINKMODE:class-native = "--linkmode=external"
47GO_EXTRA_LDFLAGS ?= "" 47GO_EXTRA_LDFLAGS ?= ""
48GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} -I ${@get_linuxloader(d)} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"' 48GO_LINUXLOADER ?= "-I ${@get_linuxloader(d)}"
49# Use system loader. If uninative is used, the uninative loader will be patched automatically
50GO_LINUXLOADER:class-native = ""
51GO_LDFLAGS ?= '-ldflags="${GO_RPATH} ${GO_LINKMODE} ${GO_LINUXLOADER} ${GO_EXTRA_LDFLAGS} -extldflags '${GO_EXTLDFLAGS}'"'
49export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath" 52export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS} -trimpath"
50export GOPATH_OMIT_IN_ACTIONID ?= "1" 53export GOPATH_OMIT_IN_ACTIONID ?= "1"
51export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c" 54export GOPTESTBUILDFLAGS ?= "${GOBUILDFLAGS} -c"