Skip to contentSkip to conversation

go: log build id computations

PATCH In review Alexander Kanavin 4 participants 16 messages Jan 1, 2022 – Jan 12, 2022 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 go: log build id computations

go writes build-specific ids into binaries it produces and has a custom system for calculating them from file hashes, environment variables and other inputs (not that dissimilar to sstate cache, actually). This can go wrong :) in various ways (for purposes of reproducibility in particular), so this enables useful logs to see what happens and why.

---
 meta/classes/go.bbclass                | 2 ++
 meta/recipes-devtools/go/go-common.inc | 2 ++
 2 files changed, 4 insertions(+)
meta/classes/go.bbclass +2 -0
index aa54b4a08c..5c1fdd7d5f 100644
@@ -2,6 +2,8 @@ inherit goarch
 
 GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
 
+export GODEBUG = "gocachehash=1"
+
 GOROOT:class-native = "${STAGING_LIBDIR_NATIVE}/go"
 GOROOT:class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go"
 GOROOT = "${STAGING_LIBDIR}/go"
meta/recipes-devtools/go/go-common.inc +2 -0
index dfccebdb83..5bbf35b787 100644
@@ -37,6 +37,8 @@ export GO386 ?= "${TARGET_GO386}"
 export GOMIPS ?= "${TARGET_GOMIPS}"
 export GOROOT_FINAL ?= "${libdir}/go"
 
+export GODEBUG = "gocachehash=1"
+
 do_compile:prepend() {
 	BUILD_CC=${BUILD_CC}
 }
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/6 lib/oe/reproducible: correctly set .git location when recursively looking for git repos

---
 meta/lib/oe/reproducible.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/reproducible.py +1 -1
index 4fb99d963c..35b8be6d08 100644
@@ -92,7 +92,7 @@ def find_git_folder(d, sourcedir):
     for root, dirs, files in os.walk(workdir, topdown=True):
         dirs[:] = [d for d in dirs if d not in exclude]
         if '.git' in dirs:
-            return root
+            return os.path.join(root, ".git")
 
     bb.warn("Failed to find a git repository in WORKDIR: %s" % workdir)
     return None
Signature · 1 line
2.20.1
#2 lore raw

PATCH 3/6 go: correctly set debug-prefix-map and build directory

In reply to Alexander Kanavin

Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other.

Additionally, the top level build directory cannot be named 'go-something'.

---
 meta/classes/go.bbclass                 |  2 +-
 meta/recipes-devtools/go/go-common.inc  |  2 +-
 meta/recipes-devtools/go/go-runtime.inc |  7 ++++++-
 meta/recipes-devtools/go/go-target.inc  | 10 ++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/go.bbclass +1 -1
index 5c1fdd7d5f..9c4c92bffd 100644
@@ -67,7 +67,7 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 
 python go_do_unpack() {
meta/recipes-devtools/go/go-common.inc +1 -1
index 5bbf35b787..83f8db7b39 100644
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 SSTATE_SCAN_CMD = "true"
 
 export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 export CGO_ENABLED = "1"
 
meta/recipes-devtools/go/go-runtime.inc +6 -1
index 617e6b5414..a08d44dd3a 100644
@@ -2,10 +2,15 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
 PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
 export CGO_CFLAGS = "${CFLAGS}"
 export CGO_CPPFLAGS = "${CPPFLAGS}"
 export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
 export GOCACHE = "${B}/.cache"
 
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
meta/recipes-devtools/go/go-target.inc +10 -0
index 47b4411d54..51f1b79cc3 100644
@@ -1,6 +1,16 @@
 DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
+
 export GOCACHE = "${B}/.cache"
 GO_LDFLAGS = ""
 GO_LDFLAGS:class-nativesdk = "-linkmode external"
Signature · 1 line
2.20.1
#3 lore raw

Re: [OE-core] [PATCH 3/6] go: correctly set debug-prefix-map and build directory

сб, 1 янв. 2022 г. в 14:30, Alexander Kanavin <[email protected]>:

Quoted 8 lines

Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other.

Quoted 4 lines

Additionally, the top level build directory cannot be named 'go-something'.

This patch breaks the build here, with the following error messages (full log attached):

| HASH[build go/importer]
| HASH[build go/importer]: "go1.17.5"
| HASH[build go/importer]: "compile\n"
| HASH[build go/importer]: "goos linux goarch arm64\n"
| HASH[build go/importer]: "import \"go/importer\"\n"
| HASH[build go/importer]: "omitdebug false standard true local false
prefix \"\"\n"
| HASH[build go/importer]: "modinfo \"\"\n"
| HASH[build go/importer]: "compile compile version go1.17.5 [] []\n"
| HASH[build go/importer]: "=\n"
| HASH /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/src/go/importer/importer.go:
030536f1a71bcd0c3615684f4b94373b4136a282de9e6cd9d283e454704be386
| HASH[build go/importer]: "file importer.go AwU28acbzQw2FWhPS5Q3\n"
| HASH[build go/importer]: "import go/build XGXQDTt1BQjYRjE7nFi7\n"
| HASH[build go/importer]: "import go/internal/gccgoimporter

MqGIqtLxk8pkuc9XENIo\n"
| HASH[build go/importer]: "import go/internal/gcimporter U16uHUOXrDggYRgVMENf\n"
| HASH[build go/importer]: "import go/internal/srcimporter vtV3UGYK55GaAj4JI8MN\n"

| HASH[build go/importer]: "import go/token 36MC7EMX8CqyCcPmrSmS\n"
| HASH[build go/importer]: "import go/types EyjwGzDrQ1CtOXxe_UYb\n"
| HASH[build go/importer]: "import io A3HnNVYVSU1F06BuLR5o\n"
| HASH[build go/importer]: "import runtime TtpuHdFJwA5GfsHmM2LT\n"
| HASH[build go/importer]:

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
| HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
"srcfiles" = e6f8fcd87c2dd28b3381ad27b9938048b5b3bde6a19db4a4837e184ef9cef82a
| HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
"stdout" = 3cb42089ec7038a91addcc400ee71ea90feee998a35e992b699729f04ae85c1a
| go tool dist: FAILED:
/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/pkg/tool/native_native/go_bootstrap install -gcflags=all= -ldflags=all= std: exit status 2
| WARNING: /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939:175 exit 2 from './make.bash --target-only --no-banner std'
| WARNING: Backtrace (BB generated script):
| #1: do_compile, /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 175
| #2: main, /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 185

Quoted 87 lines
---
 meta/classes/go.bbclass                 |  2 +-
 meta/recipes-devtools/go/go-common.inc  |  2 +-
 meta/recipes-devtools/go/go-runtime.inc |  7 ++++++-
 meta/recipes-devtools/go/go-target.inc  | 10 ++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/go.bbclass +1 -1
index 5c1fdd7d5f..9c4c92bffd 100644
@@ -67,7 +67,7 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 
 python go_do_unpack() {
meta/recipes-devtools/go/go-common.inc +1 -1
index 5bbf35b787..83f8db7b39 100644
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 SSTATE_SCAN_CMD = "true"
 
 export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 export CGO_ENABLED = "1"
 
meta/recipes-devtools/go/go-runtime.inc +6 -1
index 617e6b5414..a08d44dd3a 100644
@@ -2,10 +2,15 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
 PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
 export CGO_CFLAGS = "${CFLAGS}"
 export CGO_CPPFLAGS = "${CPPFLAGS}"
 export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
 export GOCACHE = "${B}/.cache"
 
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
meta/recipes-devtools/go/go-target.inc +10 -1
index 47b4411d54..51f1b79cc3 100644
@@ -1,6 +1,16 @@
 DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
+
 export GOCACHE = "${B}/.cache"
 GO_LDFLAGS = ""
 GO_LDFLAGS:class-nativesdk = "-linkmode external"
--

2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#160096): https://lists.openembedded.org/g/openembedded-core/message/160096
Mute This Topic: https://lists.openembedded.org/mt/88071320/3618183
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 2 lines
With best wishes
Dmitry
#4 lore raw

Re: [OE-core] [PATCH 3/6] go: correctly set debug-prefix-map and build directory

aarch64-linaro-linux-gcc: error: ${SECURITY_LDFLAGS}: No such file or directory

You need to find out why the variable isn't expanded. 'bitbake -e go-runtime' may help.

Alex

Quoted 169 lines · Dmitry Baryshkov

сб, 1 янв. 2022 г. в 14:30, Alexander Kanavin <[email protected]>:

Quoted 8 lines

Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other.

Quoted 4 lines

Additionally, the top level build directory cannot be named 'go-something'.

This patch breaks the build here, with the following error messages (full log attached):

| HASH[build go/importer]
| HASH[build go/importer]: "go1.17.5"
| HASH[build go/importer]: "compile\n"
| HASH[build go/importer]: "goos linux goarch arm64\n"
| HASH[build go/importer]: "import \"go/importer\"\n"
| HASH[build go/importer]: "omitdebug false standard true local false
prefix \"\"\n"
| HASH[build go/importer]: "modinfo \"\"\n"
| HASH[build go/importer]: "compile compile version go1.17.5 [] []\n"
| HASH[build go/importer]: "=\n"
| HASH
/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/src/go/importer/importer.go:
030536f1a71bcd0c3615684f4b94373b4136a282de9e6cd9d283e454704be386
| HASH[build go/importer]: "file importer.go AwU28acbzQw2FWhPS5Q3\n"
| HASH[build go/importer]: "import go/build XGXQDTt1BQjYRjE7nFi7\n"
| HASH[build go/importer]: "import go/internal/gccgoimporter

MqGIqtLxk8pkuc9XENIo\n"
| HASH[build go/importer]: "import go/internal/gcimporter U16uHUOXrDggYRgVMENf\n"
| HASH[build go/importer]: "import go/internal/srcimporter vtV3UGYK55GaAj4JI8MN\n"

| HASH[build go/importer]: "import go/token 36MC7EMX8CqyCcPmrSmS\n"
| HASH[build go/importer]: "import go/types EyjwGzDrQ1CtOXxe_UYb\n"
| HASH[build go/importer]: "import io A3HnNVYVSU1F06BuLR5o\n"
| HASH[build go/importer]: "import runtime TtpuHdFJwA5GfsHmM2LT\n"
| HASH[build go/importer]:

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d | HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d "srcfiles" = e6f8fcd87c2dd28b3381ad27b9938048b5b3bde6a19db4a4837e184ef9cef82a | HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d "stdout" = 3cb42089ec7038a91addcc400ee71ea90feee998a35e992b699729f04ae85c1a | go tool dist: FAILED:

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/pkg/tool/native_native/go_bootstrap install -gcflags=all= -ldflags=all= std: exit status 2
| WARNING:
/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939:175 exit 2 from './make.bash --target-only --no-banner std'
| WARNING: Backtrace (BB generated script):
| #1: do_compile,

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 175
| #2: main, /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 185

Review

Quoted 21 lines
---
 meta/classes/go.bbclass                 |  2 +-
 meta/recipes-devtools/go/go-common.inc  |  2 +-
 meta/recipes-devtools/go/go-runtime.inc |  7 ++++++-
 meta/recipes-devtools/go/go-target.inc  | 10 ++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/go.bbclass +1 -1
index 5c1fdd7d5f..9c4c92bffd 100644
@@ -67,7 +67,7 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 
 python go_do_unpack() {
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-common.inc

Review

Quoted 13 lines

index 5bbf35b787..83f8db7b39 100644

meta/recipes-devtools/go/go-common.inc +1 -1
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 SSTATE_SCAN_CMD = "true"
 
 export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 export CGO_ENABLED = "1"
 
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-runtime.inc

Quoted 7 lines

index 617e6b5414..a08d44dd3a 100644

meta/recipes-devtools/go/go-runtime.inc +0 -0
@@ -2,10 +2,15 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
 PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
 

meta/recipes-devtools/go/go-runtime.inc DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" · line 13

Quoted 10 lines
meta/recipes-devtools/go/go-runtime.inc +6 -1
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
 export CGO_CFLAGS = "${CFLAGS}"
 export CGO_CPPFLAGS = "${CPPFLAGS}"
 export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}

${SECURITY_LDFLAGS}"

Review

Quoted 4 lines
meta/recipes-devtools/go/go-runtime.inc +0 -0
 export GOCACHE = "${B}/.cache"
 
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-target.inc

meta/recipes-devtools/go/go-target.inc line 2

Quoted 6 lines

index 47b4411d54..51f1b79cc3 100644

meta/recipes-devtools/go/go-target.inc +0 -0
@@ -1,6 +1,16 @@
 DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk

go-native"

meta/recipes-devtools/go/go-target.inc

Quoted 10 lines
meta/recipes-devtools/go/go-target.inc +9 -0
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}

${SECURITY_LDFLAGS}"

Quoted 11 lines
meta/recipes-devtools/go/go-target.inc +1 -1
+
 export GOCACHE = "${B}/.cache"
 GO_LDFLAGS = ""
 GO_LDFLAGS:class-nativesdk = "-linkmode external"
--

2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#160096):

https://lists.openembedded.org/g/openembedded-core/message/160096

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/88071320/3618183
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
With best wishes
Dmitry

#5 lore raw

Re: [OE-core] [PATCH 3/6] go: correctly set debug-prefix-map and build directory

пн, 10 янв. 2022 г. в 11:08, Alexander Kanavin <[email protected]>:

Quoted 4 lines

aarch64-linaro-linux-gcc: error: ${SECURITY_LDFLAGS}: No such file or directory

You need to find out why the variable isn't expanded. 'bitbake -e go-runtime' may help.

The distro I was using here (rpb if that matters) does not use security_flags.inc, so SECURITY_LDFLAGS are not defined. Please remove such dependency. We can not expect that every distro would include security_flags.inc

Quoted 157 lines

Alex

Quoted 153 lines · Dmitry Baryshkov

сб, 1 янв. 2022 г. в 14:30, Alexander Kanavin <[email protected]>:

Quoted 8 lines

Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other.

Quoted 4 lines

Additionally, the top level build directory cannot be named 'go-something'.

This patch breaks the build here, with the following error messages (full log attached):

| HASH[build go/importer]
| HASH[build go/importer]: "go1.17.5"
| HASH[build go/importer]: "compile\n"
| HASH[build go/importer]: "goos linux goarch arm64\n"
| HASH[build go/importer]: "import \"go/importer\"\n"
| HASH[build go/importer]: "omitdebug false standard true local false
prefix \"\"\n"
| HASH[build go/importer]: "modinfo \"\"\n"
| HASH[build go/importer]: "compile compile version go1.17.5 [] []\n"
| HASH[build go/importer]: "=\n"
| HASH /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/src/go/importer/importer.go:
030536f1a71bcd0c3615684f4b94373b4136a282de9e6cd9d283e454704be386
| HASH[build go/importer]: "file importer.go AwU28acbzQw2FWhPS5Q3\n"
| HASH[build go/importer]: "import go/build XGXQDTt1BQjYRjE7nFi7\n"
| HASH[build go/importer]: "import go/internal/gccgoimporter

MqGIqtLxk8pkuc9XENIo\n"
| HASH[build go/importer]: "import go/internal/gcimporter U16uHUOXrDggYRgVMENf\n"
| HASH[build go/importer]: "import go/internal/srcimporter vtV3UGYK55GaAj4JI8MN\n"

| HASH[build go/importer]: "import go/token 36MC7EMX8CqyCcPmrSmS\n"
| HASH[build go/importer]: "import go/types EyjwGzDrQ1CtOXxe_UYb\n"
| HASH[build go/importer]: "import io A3HnNVYVSU1F06BuLR5o\n"
| HASH[build go/importer]: "import runtime TtpuHdFJwA5GfsHmM2LT\n"
| HASH[build go/importer]:

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
| HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
"srcfiles" = e6f8fcd87c2dd28b3381ad27b9938048b5b3bde6a19db4a4837e184ef9cef82a
| HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
"stdout" = 3cb42089ec7038a91addcc400ee71ea90feee998a35e992b699729f04ae85c1a
| go tool dist: FAILED:
/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/pkg/tool/native_native/go_bootstrap install -gcflags=all= -ldflags=all= std: exit status 2
| WARNING: /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939:175 exit 2 from './make.bash --target-only --no-banner std'
| WARNING: Backtrace (BB generated script):
| #1: do_compile, /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 175
| #2: main, /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 185

Quoted 79 lines
---
 meta/classes/go.bbclass                 |  2 +-
 meta/recipes-devtools/go/go-common.inc  |  2 +-
 meta/recipes-devtools/go/go-runtime.inc |  7 ++++++-
 meta/recipes-devtools/go/go-target.inc  | 10 ++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/go.bbclass +1 -1
index 5c1fdd7d5f..9c4c92bffd 100644
@@ -67,7 +67,7 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 
 python go_do_unpack() {
meta/recipes-devtools/go/go-common.inc +1 -1
index 5bbf35b787..83f8db7b39 100644
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 SSTATE_SCAN_CMD = "true"
 
 export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 export CGO_ENABLED = "1"
 
meta/recipes-devtools/go/go-runtime.inc +6 -1
index 617e6b5414..a08d44dd3a 100644
@@ -2,10 +2,15 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
 PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
 export CGO_CFLAGS = "${CFLAGS}"
 export CGO_CPPFLAGS = "${CPPFLAGS}"
 export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
 export GOCACHE = "${B}/.cache"
 
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
meta/recipes-devtools/go/go-target.inc +10 -1
index 47b4411d54..51f1b79cc3 100644
@@ -1,6 +1,16 @@
 DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
+
 export GOCACHE = "${B}/.cache"
 GO_LDFLAGS = ""
 GO_LDFLAGS:class-nativesdk = "-linkmode external"
--

2.20.1

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#160096): https://lists.openembedded.org/g/openembedded-core/message/160096
Mute This Topic: https://lists.openembedded.org/mt/88071320/3618183
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw

Re: [OE-core] [PATCH 3/6] go: correctly set debug-prefix-map and build directory

In reply to Alexander Kanavin

пн, 10 янв. 2022 г. в 11:08, Alexander Kanavin <[email protected]>:

Quoted 4 lines

aarch64-linaro-linux-gcc: error: ${SECURITY_LDFLAGS}: No such file or directory

You need to find out why the variable isn't expanded. 'bitbake -e go-runtime' may help.

For the reference:

# $CGO_LDFLAGS [2 operations]
# exported /home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-devtools/go/go-runtime.inc:13
# [export] "1"
# set /home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-devtools/go/go-runtime.inc:13
# "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"

# pre-expansion value:
#   "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
export CGO_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
\${SECURITY_LDFLAGS}"

Quoting bitbake manual:

If the variable expansion syntax is used on a variable that does not exist, the string is kept as is. For example, given the following assignment, BAR expands to the literal string "${FOO}" as long as FOO does not exist.

     BAR = "${FOO}"
Quoted 157 lines

Alex

Quoted 153 lines · Dmitry Baryshkov

сб, 1 янв. 2022 г. в 14:30, Alexander Kanavin <[email protected]>:

Quoted 8 lines

Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other.

Quoted 4 lines

Additionally, the top level build directory cannot be named 'go-something'.

This patch breaks the build here, with the following error messages (full log attached):

| HASH[build go/importer]
| HASH[build go/importer]: "go1.17.5"
| HASH[build go/importer]: "compile\n"
| HASH[build go/importer]: "goos linux goarch arm64\n"
| HASH[build go/importer]: "import \"go/importer\"\n"
| HASH[build go/importer]: "omitdebug false standard true local false
prefix \"\"\n"
| HASH[build go/importer]: "modinfo \"\"\n"
| HASH[build go/importer]: "compile compile version go1.17.5 [] []\n"
| HASH[build go/importer]: "=\n"
| HASH /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/src/go/importer/importer.go:
030536f1a71bcd0c3615684f4b94373b4136a282de9e6cd9d283e454704be386
| HASH[build go/importer]: "file importer.go AwU28acbzQw2FWhPS5Q3\n"
| HASH[build go/importer]: "import go/build XGXQDTt1BQjYRjE7nFi7\n"
| HASH[build go/importer]: "import go/internal/gccgoimporter

MqGIqtLxk8pkuc9XENIo\n"
| HASH[build go/importer]: "import go/internal/gcimporter U16uHUOXrDggYRgVMENf\n"
| HASH[build go/importer]: "import go/internal/srcimporter vtV3UGYK55GaAj4JI8MN\n"

| HASH[build go/importer]: "import go/token 36MC7EMX8CqyCcPmrSmS\n"
| HASH[build go/importer]: "import go/types EyjwGzDrQ1CtOXxe_UYb\n"
| HASH[build go/importer]: "import io A3HnNVYVSU1F06BuLR5o\n"
| HASH[build go/importer]: "import runtime TtpuHdFJwA5GfsHmM2LT\n"
| HASH[build go/importer]:

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
| HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
"srcfiles" = e6f8fcd87c2dd28b3381ad27b9938048b5b3bde6a19db4a4837e184ef9cef82a
| HASH subkey b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d
"stdout" = 3cb42089ec7038a91addcc400ee71ea90feee998a35e992b699729f04ae85c1a
| go tool dist: FAILED:
/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/pkg/tool/native_native/go_bootstrap install -gcflags=all= -ldflags=all= std: exit status 2
| WARNING: /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939:175 exit 2 from './make.bash --target-only --no-banner std'
| WARNING: Backtrace (BB generated script):
| #1: do_compile, /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 175
| #2: main, /home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939, line 185

Quoted 79 lines
---
 meta/classes/go.bbclass                 |  2 +-
 meta/recipes-devtools/go/go-common.inc  |  2 +-
 meta/recipes-devtools/go/go-runtime.inc |  7 ++++++-
 meta/recipes-devtools/go/go-target.inc  | 10 ++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/go.bbclass +1 -1
index 5c1fdd7d5f..9c4c92bffd 100644
@@ -67,7 +67,7 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 
 python go_do_unpack() {
meta/recipes-devtools/go/go-common.inc +1 -1
index 5bbf35b787..83f8db7b39 100644
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 SSTATE_SCAN_CMD = "true"
 
 export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 export CGO_ENABLED = "1"
 
meta/recipes-devtools/go/go-runtime.inc +6 -1
index 617e6b5414..a08d44dd3a 100644
@@ -2,10 +2,15 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
 PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
 export CGO_CFLAGS = "${CFLAGS}"
 export CGO_CPPFLAGS = "${CPPFLAGS}"
 export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
 export GOCACHE = "${B}/.cache"
 
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
meta/recipes-devtools/go/go-target.inc +10 -1
index 47b4411d54..51f1b79cc3 100644
@@ -1,6 +1,16 @@
 DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
 
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
+
 export GOCACHE = "${B}/.cache"
 GO_LDFLAGS = ""
 GO_LDFLAGS:class-nativesdk = "-linkmode external"
--

2.20.1

Quoted 8 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#160096): https://lists.openembedded.org/g/openembedded-core/message/160096
Mute This Topic: https://lists.openembedded.org/mt/88071320/3618183
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

--
With best wishes
Dmitry

Signature · 2 lines
With best wishes
Dmitry
#7 lore raw

Re: [OE-core] [PATCH 3/6] go: correctly set debug-prefix-map and build directory

I'm not immediately sure how to solve this though. We do want to keep those flags when they're defined.

Ideas? Perhaps they could be defined empty in some place which is present in all distributions?

Alex

Quoted 215 lines · Dmitry Baryshkov

пн, 10 янв. 2022 г. в 11:08, Alexander Kanavin <[email protected]>:

Quoted 2 lines

aarch64-linaro-linux-gcc: error: ${SECURITY_LDFLAGS}: No such file or

directory

Quoted 2 lines

You need to find out why the variable isn't expanded. 'bitbake -e

go-runtime' may help.

For the reference:

# $CGO_LDFLAGS [2 operations]
# exported
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-devtools/go/go-runtime.inc:13
# [export] "1"
# set
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-devtools/go/go-runtime.inc:13
# "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"

# pre-expansion value:
#   "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
export CGO_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
\${SECURITY_LDFLAGS}"

Quoting bitbake manual:

If the variable expansion syntax is used on a variable that does not exist, the string is kept as is. For example, given the following assignment, BAR expands to the literal string "${FOO}" as long as FOO does not exist.

     BAR = "${FOO}"
Quoted 4 lines

Alex

On Mon, 10 Jan 2022 at 05:34, Dmitry Baryshkov <[email protected]>

Quoted 18 lines · wrote:
Quoted 18 lines

сб, 1 янв. 2022 г. в 14:30, Alexander Kanavin <[email protected]>:

Quoted 8 lines

Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other.

Quoted 4 lines

Additionally, the top level build directory cannot be named 'go-something'.

This patch breaks the build here, with the following error messages (full log attached):

Quoted 11 lines
Quoted 11 lines
| HASH[build go/importer]
| HASH[build go/importer]: "go1.17.5"
| HASH[build go/importer]: "compile\n"
| HASH[build go/importer]: "goos linux goarch arm64\n"
| HASH[build go/importer]: "import \"go/importer\"\n"
| HASH[build go/importer]: "omitdebug false standard true local false
prefix \"\"\n"
| HASH[build go/importer]: "modinfo \"\"\n"
| HASH[build go/importer]: "compile compile version go1.17.5 [] []\n"
| HASH[build go/importer]: "=\n"
| HASH

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/src/go/importer/importer.go:

Quoted 8 lines
Quoted 8 lines

030536f1a71bcd0c3615684f4b94373b4136a282de9e6cd9d283e454704be386

| HASH[build go/importer]: "file importer.go AwU28acbzQw2FWhPS5Q3\n"
| HASH[build go/importer]: "import go/build XGXQDTt1BQjYRjE7nFi7\n"
| HASH[build go/importer]: "import go/internal/gccgoimporter

MqGIqtLxk8pkuc9XENIo\n"
| HASH[build go/importer]: "import go/internal/gcimporter U16uHUOXrDggYRgVMENf\n"
| HASH[build go/importer]: "import go/internal/srcimporter

Quoted 8 lines
Quoted 8 lines

vtV3UGYK55GaAj4JI8MN\n"

| HASH[build go/importer]: "import go/token 36MC7EMX8CqyCcPmrSmS\n"
| HASH[build go/importer]: "import go/types EyjwGzDrQ1CtOXxe_UYb\n"
| HASH[build go/importer]: "import io A3HnNVYVSU1F06BuLR5o\n"
| HASH[build go/importer]: "import runtime TtpuHdFJwA5GfsHmM2LT\n"
| HASH[build go/importer]:

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d | HASH subkey

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d

Quoted 1 line
Quoted 1 line

"srcfiles" =

e6f8fcd87c2dd28b3381ad27b9938048b5b3bde6a19db4a4837e184ef9cef82a

Quoted 1 line
Quoted 1 line

| HASH subkey

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d

Quoted 1 line
Quoted 1 line

"stdout" =

3cb42089ec7038a91addcc400ee71ea90feee998a35e992b699729f04ae85c1a

Quoted 2 lines
Quoted 2 lines

| go tool dist: FAILED:

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/pkg/tool/native_native/go_bootstrap

Quoted 2 lines
Quoted 2 lines

install -gcflags=all= -ldflags=all= std: exit status 2 | WARNING:

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939:175

Quoted 4 lines
Quoted 4 lines

exit 2 from './make.bash --target-only --no-banner std' | WARNING: Backtrace (BB generated script):
| #1: do_compile,

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939,

Quoted 2 lines
Quoted 2 lines

line 175
| #2: main,

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939,

Quoted 16 lines
Quoted 16 lines

line 185

Quoted 13 lines
---
 meta/classes/go.bbclass                 |  2 +-
 meta/recipes-devtools/go/go-common.inc  |  2 +-
 meta/recipes-devtools/go/go-runtime.inc |  7 ++++++-
 meta/recipes-devtools/go/go-target.inc  | 10 ++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/go.bbclass +0 -0
index 5c1fdd7d5f..9c4c92bffd 100644
@@ -67,7 +67,7 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
meta/classes/go.bbclass +1 -1
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 
 python go_do_unpack() {
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-common.inc

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

index 5bbf35b787..83f8db7b39 100644

meta/recipes-devtools/go/go-common.inc +0 -0
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 SSTATE_SCAN_CMD = "true"
 
Quoted 7 lines
Quoted 7 lines

Review

Quoted 7 lines
meta/recipes-devtools/go/go-common.inc +1 -1
 export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 export CGO_ENABLED = "1"
 
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-runtime.inc

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

index 617e6b5414..a08d44dd3a 100644

meta/recipes-devtools/go/go-runtime.inc +0 -0
@@ -2,10 +2,15 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
 PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
 
Quoted 10 lines
Quoted 10 lines

meta/recipes-devtools/go/go-runtime.inc DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"

Quoted 10 lines
meta/recipes-devtools/go/go-runtime.inc +6 -1
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
 export CGO_CFLAGS = "${CFLAGS}"
 export CGO_CPPFLAGS = "${CPPFLAGS}"
 export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}

${SECURITY_LDFLAGS}"

Quoted 4 lines
Quoted 4 lines

Review

Quoted 4 lines
meta/recipes-devtools/go/go-runtime.inc +0 -0
 export GOCACHE = "${B}/.cache"
 
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-target.inc

Quoted 6 lines
Quoted 6 lines

meta/recipes-devtools/go/go-target.inc line 2

Quoted 6 lines

index 47b4411d54..51f1b79cc3 100644

meta/recipes-devtools/go/go-target.inc +0 -0
@@ -1,6 +1,16 @@
 DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk

go-native"

Quoted 10 lines
Quoted 10 lines

meta/recipes-devtools/go/go-target.inc

Quoted 10 lines
meta/recipes-devtools/go/go-target.inc +9 -0
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}

${SECURITY_LDFLAGS}"

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
meta/recipes-devtools/go/go-target.inc +1 -1
+
 export GOCACHE = "${B}/.cache"
 GO_LDFLAGS = ""
 GO_LDFLAGS:class-nativesdk = "-linkmode external"
--

2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#160096):

https://lists.openembedded.org/g/openembedded-core/message/160096

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/88071320/3618183
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub

[[email protected]]

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
With best wishes
Dmitry

--
With best wishes
Dmitry

#8 lore raw

Re: [OE-core] [PATCH 3/6] go: correctly set debug-prefix-map and build directory

Em qua., 12 de jan. de 2022 às 12:01, Alexander Kanavin <[email protected]> escreveu:

Quoted 3 lines

I'm not immediately sure how to solve this though. We do want to keep those flags when they're defined.

Ideas? Perhaps they could be defined empty in some place which is present in all distributions?

I believe it does make sense; it ought to have a default.
https://github.com/openembedded/openembedded-core/blob/master/meta/conf/distro/include/default-distrovars.inc
sounds like the right place.

Signature · 3 lines
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9 9981-7854          Mobile: +1 (347) 903-9750

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Re: [OE-core] [PATCH 3/6] go: correctly set debug-prefix-map and build directory

One experiment that can be tried is unsetting DEBUG_PREFIX_MAP in the go recipe though, but it may make things non-reproducible again.

Quoted 231 lines · Alexander Kanavin via lists.openembedded.org

I'm not immediately sure how to solve this though. We do want to keep those flags when they're defined.

Ideas? Perhaps they could be defined empty in some place which is present in all distributions?

Alex

Quoted 204 lines · Dmitry Baryshkov

пн, 10 янв. 2022 г. в 11:08, Alexander Kanavin <[email protected]>:

Quoted 2 lines

aarch64-linaro-linux-gcc: error: ${SECURITY_LDFLAGS}: No such file or

directory

Quoted 2 lines

You need to find out why the variable isn't expanded. 'bitbake -e

go-runtime' may help.

For the reference:

# $CGO_LDFLAGS [2 operations]
# exported
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-devtools/go/go-runtime.inc:13
# [export] "1"
# set
/home/lumag/Projects/RPB/build-rpb/conf/../../layers/openembedded-core/meta/recipes-devtools/go/go-runtime.inc:13
# "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"

# pre-expansion value:
#   "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${SECURITY_LDFLAGS}"
export CGO_LDFLAGS="-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed
\${SECURITY_LDFLAGS}"

Quoting bitbake manual:

If the variable expansion syntax is used on a variable that does not exist, the string is kept as is. For example, given the following assignment, BAR expands to the literal string "${FOO}" as long as FOO does not exist.

     BAR = "${FOO}"
Quoted 4 lines

Alex

On Mon, 10 Jan 2022 at 05:34, Dmitry Baryshkov <[email protected]>

Quoted 30 lines · wrote:
Quoted 2 lines

сб, 1 янв. 2022 г. в 14:30, Alexander Kanavin <[email protected]

:

Quoted 27 lines
Quoted 8 lines

Go has its own system for creating temporary build sub-directories with randomized names, and setting up debug-prefix-map on the fly to prevent those directories leaking into target binaries. OE's own settings were clashing with it, so this change carefully avoids the two stepping on each other.

Quoted 4 lines

Additionally, the top level build directory cannot be named 'go-something'.

This patch breaks the build here, with the following error messages (full log attached):

| HASH[build go/importer]
| HASH[build go/importer]: "go1.17.5"
| HASH[build go/importer]: "compile\n"
| HASH[build go/importer]: "goos linux goarch arm64\n"
| HASH[build go/importer]: "import \"go/importer\"\n"
| HASH[build go/importer]: "omitdebug false standard true local false
prefix \"\"\n"
| HASH[build go/importer]: "modinfo \"\"\n"
| HASH[build go/importer]: "compile compile version go1.17.5 [] []\n"
| HASH[build go/importer]: "=\n"
| HASH

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/src/go/importer/importer.go:

Quoted 8 lines
Quoted 8 lines

030536f1a71bcd0c3615684f4b94373b4136a282de9e6cd9d283e454704be386

| HASH[build go/importer]: "file importer.go AwU28acbzQw2FWhPS5Q3\n"
| HASH[build go/importer]: "import go/build XGXQDTt1BQjYRjE7nFi7\n"
| HASH[build go/importer]: "import go/internal/gccgoimporter

MqGIqtLxk8pkuc9XENIo\n"
| HASH[build go/importer]: "import go/internal/gcimporter U16uHUOXrDggYRgVMENf\n"
| HASH[build go/importer]: "import go/internal/srcimporter

Quoted 8 lines
Quoted 8 lines

vtV3UGYK55GaAj4JI8MN\n"

| HASH[build go/importer]: "import go/token 36MC7EMX8CqyCcPmrSmS\n"
| HASH[build go/importer]: "import go/types EyjwGzDrQ1CtOXxe_UYb\n"
| HASH[build go/importer]: "import io A3HnNVYVSU1F06BuLR5o\n"
| HASH[build go/importer]: "import runtime TtpuHdFJwA5GfsHmM2LT\n"
| HASH[build go/importer]:

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d | HASH subkey

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d

Quoted 1 line
Quoted 1 line

"srcfiles" =

e6f8fcd87c2dd28b3381ad27b9938048b5b3bde6a19db4a4837e184ef9cef82a

Quoted 1 line
Quoted 1 line

| HASH subkey

b98eef9d67666fef158497b06bd4a9793d63af81f5e9e5008e51e0fa35b86a7d

Quoted 1 line
Quoted 1 line

"stdout" =

3cb42089ec7038a91addcc400ee71ea90feee998a35e992b699729f04ae85c1a

Quoted 2 lines
Quoted 2 lines

| go tool dist: FAILED:

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/go/pkg/tool/native_native/go_bootstrap

Quoted 2 lines
Quoted 2 lines

install -gcflags=all= -ldflags=all= std: exit status 2 | WARNING:

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939:175

Quoted 4 lines
Quoted 4 lines

exit 2 from './make.bash --target-only --no-banner std' | WARNING: Backtrace (BB generated script):
| #1: do_compile,

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939,

Quoted 2 lines
Quoted 2 lines

line 175
| #2: main,

/home/lumag/Projects/RPB/build-rpb/tmp-rpb-glibc/work/armv8a-linaro-linux/go-runtime/1.17.5-r0/temp/run.do_compile.2219939,

Quoted 16 lines
Quoted 16 lines

line 185

Quoted 13 lines
---
 meta/classes/go.bbclass                 |  2 +-
 meta/recipes-devtools/go/go-common.inc  |  2 +-
 meta/recipes-devtools/go/go-runtime.inc |  7 ++++++-
 meta/recipes-devtools/go/go-target.inc  | 10 ++++++++++
 4 files changed, 18 insertions(+), 3 deletions(-)
meta/classes/go.bbclass +0 -0
index 5c1fdd7d5f..9c4c92bffd 100644
@@ -67,7 +67,7 @@ GO_INSTALL_FILTEROUT ?= "${GO_IMPORT}/vendor/"
 
Quoted 8 lines
Quoted 8 lines

Review

Quoted 8 lines
meta/classes/go.bbclass +1 -1
 B = "${WORKDIR}/build"
 export GOPATH = "${B}"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 
 python go_do_unpack() {
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-common.inc

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

index 5bbf35b787..83f8db7b39 100644

meta/recipes-devtools/go/go-common.inc +0 -0
@@ -23,7 +23,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
 SSTATE_SCAN_CMD = "true"
 
Quoted 7 lines
Quoted 7 lines

Review

Quoted 7 lines
meta/recipes-devtools/go/go-common.inc +1 -1
 export GOROOT_OVERRIDE = "1"
-export GOTMPDIR ?= "${WORKDIR}/go-tmp"
+export GOTMPDIR ?= "${WORKDIR}/build-tmp"
 GOTMPDIR[vardepvalue] = ""
 export CGO_ENABLED = "1"
 
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-runtime.inc

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

index 617e6b5414..a08d44dd3a 100644

meta/recipes-devtools/go/go-runtime.inc +0 -0
@@ -2,10 +2,15 @@ DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk"
 PROVIDES = "virtual/${TARGET_PREFIX}go-runtime"
 
Quoted 10 lines
Quoted 10 lines

meta/recipes-devtools/go/go-runtime.inc DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"

Quoted 10 lines
meta/recipes-devtools/go/go-runtime.inc +6 -1
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
 export CGO_CFLAGS = "${CFLAGS}"
 export CGO_CPPFLAGS = "${CPPFLAGS}"
 export CGO_CXXFLAGS = "${CXXFLAGS}"
-export CGO_LDFLAGS = "${LDFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}

${SECURITY_LDFLAGS}"

Quoted 4 lines
Quoted 4 lines

Review

Quoted 4 lines
meta/recipes-devtools/go/go-runtime.inc +0 -0
 export GOCACHE = "${B}/.cache"
 
 GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${LDFLAGS}"
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-target.inc

Quoted 6 lines
Quoted 6 lines

meta/recipes-devtools/go/go-target.inc line 2

Quoted 6 lines

index 47b4411d54..51f1b79cc3 100644

meta/recipes-devtools/go/go-target.inc +0 -0
@@ -1,6 +1,16 @@
 DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
 DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk

go-native"

Quoted 10 lines
Quoted 10 lines

meta/recipes-devtools/go/go-target.inc

Quoted 10 lines
meta/recipes-devtools/go/go-target.inc +9 -0
+DEBUG_PREFIX_MAP = "\
+                     -fdebug-prefix-map=${STAGING_DIR_HOST}= \
+                     -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
+"
+
+export CGO_CFLAGS = "${CFLAGS}"
+export CGO_CPPFLAGS = "${CPPFLAGS}"
+export CGO_CXXFLAGS = "${CXXFLAGS}"
+export CGO_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}

${SECURITY_LDFLAGS}"

Quoted 12 lines
Quoted 12 lines
Quoted 10 lines
meta/recipes-devtools/go/go-target.inc +1 -1
+
 export GOCACHE = "${B}/.cache"
 GO_LDFLAGS = ""
 GO_LDFLAGS:class-nativesdk = "-linkmode external"
--

2.20.1

Quoted 3 lines
Quoted 3 lines

--
With best wishes
Dmitry

Quoted 4 lines

--
With best wishes
Dmitry

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#160486):
https://lists.openembedded.org/g/openembedded-core/message/160486
Mute This Topic: https://lists.openembedded.org/mt/88071320/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#11 lore raw

PATCH 4/6 go-runtime.inc: do not make installation set dependent on host

In reply to Alexander Kanavin

This cannot be right: what we install for the target should not depend on what host it's being built on. If this was fixing some problem, there needs to be a different solution.

---
 meta/recipes-devtools/go/go-runtime.inc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta/recipes-devtools/go/go-runtime.inc +2 -4
index a08d44dd3a..106017bd89 100644
@@ -43,10 +43,8 @@ do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
 do_install() {
 	install -d ${D}${libdir}/go/src
 	cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
-	if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
-		rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
-		rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
-	fi
+	rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+	rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
 	rm -rf ${D}${libdir}/go/pkg/tool
 	rm -rf ${D}${libdir}/go/pkg/obj
 	rm -rf ${D}${libdir}/go/pkg/bootstrap
Signature · 1 line
2.20.1
#12 lore raw

Re: [OE-core] [PATCH 4/6] go-runtime.inc: do not make installation set dependent on host

Quoted 4 lines · Alexander Kanavin

This cannot be right: what we install for the target should not depend on what host it's being built on. If this was fixing some problem, there needs to be a different solution.

IIRC, I added this because the go toolchain doesn't really do host/target separation like gcc does. The runtime packages for both host and target get populated during the compilation, and if the target architecture matches the build host's architecture, you'd get just one copy in the tree. And back then, at least, the go-runtime package needed those files, so the check was there to make sure they didn't get deleted just because the two architectures were the same.

That's the way things were 5 years ago, though, and the toolchain has changed a lot since then. It might not be needed any more.

-Matt

Quoted 35 lines
---
 meta/recipes-devtools/go/go-runtime.inc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta/recipes-devtools/go/go-runtime.inc +2 -5
index a08d44dd3a..106017bd89 100644
@@ -43,10 +43,8 @@ do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
 do_install() {
        install -d ${D}${libdir}/go/src
        cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
-       if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
-               rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
-               rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
-       fi
+       rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+       rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
        rm -rf ${D}${libdir}/go/pkg/tool
        rm -rf ${D}${libdir}/go/pkg/obj
        rm -rf ${D}${libdir}/go/pkg/bootstrap
--

2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#160097): https://lists.openembedded.org/g/openembedded-core/message/160097
Mute This Topic: https://lists.openembedded.org/mt/88071321/3618418
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#13 lore raw

Re: [OE-core] [PATCH 4/6] go-runtime.inc: do not make installation set dependent on host

Right, I'll take a closer look at this.

Alex

Quoted 60 lines · Matt Madison
Quoted 4 lines · Alexander Kanavin

This cannot be right: what we install for the target should not depend on what host it's being built on. If this was fixing some problem, there needs to be a different solution.

IIRC, I added this because the go toolchain doesn't really do host/target separation like gcc does. The runtime packages for both host and target get populated during the compilation, and if the target architecture matches the build host's architecture, you'd get just one copy in the tree. And back then, at least, the go-runtime package needed those files, so the check was there to make sure they didn't get deleted just because the two architectures were the same.

That's the way things were 5 years ago, though, and the toolchain has changed a lot since then. It might not be needed any more.

-Matt

Review

Quoted 7 lines
---
 meta/recipes-devtools/go/go-runtime.inc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-runtime.inc

meta/recipes-devtools/go/go-runtime.inc do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin

Quoted 4 lines

index a08d44dd3a..106017bd89 100644

meta/recipes-devtools/go/go-runtime.inc +0 -0
@@ -43,10 +43,8 @@ do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin

${B}/pkg"

Quoted 16 lines
meta/recipes-devtools/go/go-runtime.inc +2 -5
 do_install() {
        install -d ${D}${libdir}/go/src
        cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
-       if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
-               rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
-               rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
-       fi
+       rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+       rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
        rm -rf ${D}${libdir}/go/pkg/tool
        rm -rf ${D}${libdir}/go/pkg/obj
        rm -rf ${D}${libdir}/go/pkg/bootstrap
--

2.20.1

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#160097):

https://lists.openembedded.org/g/openembedded-core/message/160097

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/88071321/3618418
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub

[[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw

Re: [OE-core] [PATCH 4/6] go-runtime.inc: do not make installation set dependent on host

Thanks, I have dropped the patch.

Alex

Quoted 70 lines · Alexander Kanavin via lists.openembedded.org

Right, I'll take a closer look at this.

Alex

Quoted 26 lines · Matt Madison
Quoted 4 lines · Alexander Kanavin

This cannot be right: what we install for the target should not depend on what host it's being built on. If this was fixing some problem, there needs to be a different solution.

IIRC, I added this because the go toolchain doesn't really do host/target separation like gcc does. The runtime packages for both host and target get populated during the compilation, and if the target architecture matches the build host's architecture, you'd get just one copy in the tree. And back then, at least, the go-runtime package needed those files, so the check was there to make sure they didn't get deleted just because the two architectures were the same.

That's the way things were 5 years ago, though, and the toolchain has changed a lot since then. It might not be needed any more.

-Matt

Quoted 6 lines
---
 meta/recipes-devtools/go/go-runtime.inc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Quoted 26 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/meta/recipes-devtools/go/go-runtime.inc

meta/recipes-devtools/go/go-runtime.inc do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin

Quoted 4 lines

index a08d44dd3a..106017bd89 100644

meta/recipes-devtools/go/go-runtime.inc +0 -0
@@ -43,10 +43,8 @@ do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin

${B}/pkg"

Quoted 18 lines
meta/recipes-devtools/go/go-runtime.inc +2 -5
 do_install() {
        install -d ${D}${libdir}/go/src
        cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/
-       if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then
-               rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
-               rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
-       fi
+       rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE}
+       rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE}
        rm -rf ${D}${libdir}/go/pkg/tool
        rm -rf ${D}${libdir}/go/pkg/obj
        rm -rf ${D}${libdir}/go/pkg/bootstrap
--

2.20.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#160105):
https://lists.openembedded.org/g/openembedded-core/message/160105
Mute This Topic: https://lists.openembedded.org/mt/88071321/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ [email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#16 lore raw

PATCH 5/6 go: additional patches to help reproducibility

In reply to Alexander Kanavin
---
 meta/recipes-devtools/go/go-1.17.5.inc        |  2 +
 ...not-write-linker-flags-into-buildids.patch | 41 +++++++++++++++++++
 ...ldgo.go-do-not-hardcode-host-compile.patch | 41 +++++++++++++++++++
 3 files changed, 84 insertions(+)
 create mode 100644 meta/recipes-devtools/go/go-1.17/0001-exec.go-do-not-write-linker-flags-into-buildids.patch
 create mode 100644 meta/recipes-devtools/go/go-1.17/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch
meta/recipes-devtools/go/go-1.17.5.inc +2 -0
index baddd3b215..56957f7c6e 100644
@@ -14,6 +14,8 @@ SRC_URI += "\
     file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
     file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
     file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \
+    file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \
+    file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \
 "
 SRC_URI[main.sha256sum] = "3defb9a09bed042403195e872dcbc8c6fae1485963332279668ec52e80a95a2d"
 
meta/recipes-devtools/go/go-1.17/0001-exec.go-do-not-write-linker-flags-into-buildids.patch new file +41 -0

41 lines not on this page · raw message

meta/recipes-devtools/go/go-1.17/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.20.1
#17 lore raw

PATCH 6/6 selftest/reproducible: drop go items from exception list

In reply to Alexander Kanavin

With this changeset, go becomes reproducible \0/

---
 meta/lib/oeqa/selftest/cases/reproducible.py | 13 -------------
 1 file changed, 13 deletions(-)
meta/lib/oeqa/selftest/cases/reproducible.py +0 -13
index 2e983d2f17..fce48a2943 100644
@@ -17,24 +17,11 @@ import stat
 import os
 import datetime
 
-# For sample packages, see:
-# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20201127-0t7wr_oo/
-# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20201127-4s9ejwyp/
-# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20201127-haiwdlbr/
-# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20201127-hwds3mcl/
-# https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20201203-sua0pzvc/
-# (both packages/ and packages-excluded/)
-
 # ruby-ri-docs, meson:
 #https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20210215-0_td9la2/packages/diff-html/
 # rust-llvm:
 #https://autobuilder.yocto.io/pub/repro-fail/oe-reproducible-20210825-kaihham6/
 exclude_packages = [
-	'glide',
-	'go-helloworld',
-	'go-runtime',
-	'go_',
-	'go-',
 	'ruby-ri-docs',
 	'rust-llvm-liblto',
 	'rust-llvm-staticdev'
Signature · 1 line
2.20.1