* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
[not found] <187F32821D48D4AA.919836@lists.openembedded.org>
@ 2025-12-08 9:18 ` Changqing Li
2025-12-08 10:39 ` Alexander Kanavin
0 siblings, 1 reply; 9+ messages in thread
From: Changqing Li @ 2025-12-08 9:18 UTC (permalink / raw)
To: alex; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 4366 bytes --]
On 12/8/25 17:11, Changqing Li via lists.openembedded.org wrote:
> From: Changqing Li<changqing.li@windriver.com>
>
> The Go toolchain writes temporary source files under GOTMPDIR and
> compiles them there. To support reproducibility, Go passes options such
> as -ffile-prefix-map=$WORK/b387=/tmp/go-build to the GCC instance it
> invokes. The variable WORK is a temporary directory created under
> GOTMPDIR, refer this example:
>
> WORK=/build/tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/build-tmp/go-build377321751
> cd $WORK/b387
> TERM='dumb' x86_64-wrs-linux-gcc -m64 -march=x86-64-v3 -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/recipe-sysroot -I /tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/sources/buildah-1.41.5/src/github.com/containers/buildah/vendor/github.com/proglottis/gpgme -fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=$WORK/b387=/tmp/go-build -gno-record-gcc-switches -v -D_FILE_OFFSET_BITS=64 -I $WORK/b387/ -O2 -g -ffile-prefix-map=/tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/sources/buildah-1.41.5=/usr/src/debug/buildah/1.41.5 -ffile-prefix-map=/tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/build=/usr/src/debug/buildah/1.41.5 -ffile-prefix-map=/tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/recipe-sysroot= -ffile-prefix-map=/tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/recipe-sysroot-native= -pipe -v -ffile-prefix-map=/tmp/work/x86-64-v3-wrs-linux/buildah/1.41.5/sources/buildah-1.41.5/src/github.com/containers/buildah/vendor=/_/vendor -frandom-seed=TZkSPVSBUvDMjg4wKjWS -o $WORK/b387/_x004.o -c unset_agent_info.cgo2.c
>
> OE also passes its own DEBUG_PREFIX_MAP to GCC(finally by CGO_CFLAGS),
> including -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR}, where B is
> ${WORKDIR}/build. Because GOTMPDIR defaults to ${WORKDIR}/build-tmp, the
> Go temporary directory looks like ${WORKDIR}/build-tmp/go-buildXYZ. Its
> prefix therefore begins with ${WORKDIR}/build, so GCC matches the
> DEBUG_PREFIX_MAP entry for ${B} first.
>
> As a result, a path such as ${WORKDIR}/build-tmp/go-buildXYZ is
> rewritten to ${TARGET_DBGSRC_DIR}-tmp/go-buildXYZ. This breaks the
> -ffile-prefix-map option that Go itself adds, because the original WORK
> path no longer matches the value Go expects. Since Go creates
> go-buildXYZ directories randomly and internally, this causes the build
> non-reproducible.
>
> This patch changes GOTMPDIR from ${WORKDIR}/build-tmp to
> ${WORKDIR}/go-build-tmp so that the path no longer matches ${B}. This
> prevents unintended replacements by OE's DEBUG_PREFIX_MAP and
> restores reproducibility.
>
> Signed-off-by: Changqing Li<changqing.li@windriver.com>
> ---
> meta/classes-recipe/go.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes-recipe/go.bbclass b/meta/classes-recipe/go.bbclass
> index e0f667373e..ed986ff5d4 100644
> --- a/meta/classes-recipe/go.bbclass
> +++ b/meta/classes-recipe/go.bbclass
> @@ -79,7 +79,7 @@ B = "${WORKDIR}/build"
> export GOPATH = "${B}"
> export GOENV = "off"
> export GOPROXY ??="https://proxy.golang.org,direct"
> -export GOTMPDIR ?= "${WORKDIR}/build-tmp"
> +export GOTMPDIR ?= "${WORKDIR}/go-build-tmp"
Hi, Alex
In the following patch, you said "Additionally, the top level build
directory cannot be named 'go-something'."
https://git.openembedded.org/openembedded-core/commit/?id=9985b17a30bb9b9f1bc82a44662687db5cead66e
Can you help to explain why it cannot be named 'go-something'?
"go-build-tmp" works well in my env. if it cannot be named
as "go-something", how about "gobuild-tmp"?
Thanks
Changqing
> GOTMPDIR[vardepvalue] = ""
>
> GO_SRCURI_DESTSUFFIX ="${@os.path.join(os.path.basename(d.getVar('S')), 'src',
> d.getVar('GO_IMPORT')) + '/'}"
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#227380):https://lists.openembedded.org/g/openembedded-core/message/227380
> Mute This Topic:https://lists.openembedded.org/mt/116673066/3616873
> Group Owner:openembedded-core+owner@lists.openembedded.org
> Unsubscribe:https://lists.openembedded.org/g/openembedded-core/unsub [changqing.li@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
[-- Attachment #2: Type: text/html, Size: 6227 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-08 9:18 ` [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility Changqing Li
@ 2025-12-08 10:39 ` Alexander Kanavin
2025-12-09 9:49 ` Changqing Li
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2025-12-08 10:39 UTC (permalink / raw)
To: changqing.li; +Cc: OE-core
On Mon, 8 Dec 2025 at 10:18, Changqing Li via lists.openembedded.org
<changqing.li=windriver.com@lists.openembedded.org> wrote:
> In the following patch, you said "Additionally, the top level build directory cannot be named 'go-something'."
>
> https://git.openembedded.org/openembedded-core/commit/?id=9985b17a30bb9b9f1bc82a44662687db5cead66e
>
> Can you help to explain why it cannot be named 'go-something'? "go-build-tmp" works well in my env. if it cannot be named
>
> as "go-something", how about "gobuild-tmp"?
This was 4 years ago and honestly I don't remember anything about the
patch, other than it was a pain to find the particular settings that
work. You can probably set up a yocto build from the revision just
before the patch and apply parts of it to see why 'go-something'
didn't work at that point.
We should be careful with further tweaks.
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-08 9:11 changqing.li
@ 2025-12-08 10:41 ` Alexander Kanavin
2025-12-09 2:37 ` Changqing Li
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2025-12-08 10:41 UTC (permalink / raw)
To: changqing.li; +Cc: openembedded-core
On Mon, 8 Dec 2025 at 10:11, Changqing Li via lists.openembedded.org
<changqing.li=windriver.com@lists.openembedded.org> wrote:
> This patch changes GOTMPDIR from ${WORKDIR}/build-tmp to
> ${WORKDIR}/go-build-tmp so that the path no longer matches ${B}. This
> prevents unintended replacements by OE's DEBUG_PREFIX_MAP and
> restores reproducibility.
Wait. Go does not have reproducibility problems right now: it is a
part of reproducibility test, and not in the exclusion list. So how
can the issues that this patch set aims to fix be observed?
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-08 10:41 ` [OE-core] " Alexander Kanavin
@ 2025-12-09 2:37 ` Changqing Li
2025-12-09 9:39 ` Alexander Kanavin
0 siblings, 1 reply; 9+ messages in thread
From: Changqing Li @ 2025-12-09 2:37 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]
On 12/8/25 18:41, Alexander Kanavin wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Mon, 8 Dec 2025 at 10:11, Changqing Li via lists.openembedded.org
> <changqing.li=windriver.com@lists.openembedded.org> wrote:
>
>> This patch changes GOTMPDIR from ${WORKDIR}/build-tmp to
>> ${WORKDIR}/go-build-tmp so that the path no longer matches ${B}. This
>> prevents unintended replacements by OE's DEBUG_PREFIX_MAP and
>> restores reproducibility.
> Wait. Go does not have reproducibility problems right now: it is a
> part of reproducibility test, and not in the exclusion list. So how
> can the issues that this patch set aims to fix be observed?
I checked autobuilder configs, although we have reproducible test, but
only test with openembeded-core
and layers under meta-openembeded, and there is no recipe inherit
go.bbclass(except etcd under meta-oe, but already skipped)
So actually, we don't have reproducible test for recipes that compile
with go.
And I tested with this step:
on a host, with build path ra, and another build path rb-extend,
bitbake buildah under both project,
the rpm of ra, and rb-extend is different, and with these 2 patches,
the rpm will be the same.
//Changqing
>
> Alex
[-- Attachment #2: Type: text/html, Size: 2349 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-09 2:37 ` Changqing Li
@ 2025-12-09 9:39 ` Alexander Kanavin
2025-12-09 10:12 ` Changqing Li
0 siblings, 1 reply; 9+ messages in thread
From: Alexander Kanavin @ 2025-12-09 9:39 UTC (permalink / raw)
To: Changqing Li; +Cc: openembedded-core
On Tue, 9 Dec 2025 at 03:37, Changqing Li <changqing.li@windriver.com> wrote:
> Wait. Go does not have reproducibility problems right now: it is a
> part of reproducibility test, and not in the exclusion list. So how
> can the issues that this patch set aims to fix be observed?
>
> I checked autobuilder configs, although we have reproducible test, but only test with openembeded-core
>
> and layers under meta-openembeded, and there is no recipe inherit go.bbclass(except etcd under meta-oe, but already skipped)
>
> So actually, we don't have reproducible test for recipes that compile with go.
I see. I was confused and thought this fixes the go toolchain somehow.
There is one recipe on oe-core that does inherit go class
(go-helloworld), can you check why reproducibility issues don't happen
there? It would be good to have a reproducibility test for things
written in go in core, so this doesn't again regress quietly.
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-08 10:39 ` Alexander Kanavin
@ 2025-12-09 9:49 ` Changqing Li
0 siblings, 0 replies; 9+ messages in thread
From: Changqing Li @ 2025-12-09 9:49 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: OE-core
[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]
On 12/8/25 18:39, Alexander Kanavin wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Mon, 8 Dec 2025 at 10:18, Changqing Li via lists.openembedded.org
> <changqing.li=windriver.com@lists.openembedded.org> wrote:
>> In the following patch, you said "Additionally, the top level build directory cannot be named 'go-something'."
>> https://git.openembedded.org/openembedded-core/commit/?id=9985b17a30bb9b9f1bc82a44662687db5cead66e
>> Can you help to explain why it cannot be named 'go-something'? "go-build-tmp" works well in my env. if it cannot be named
>>
>> as "go-something", how about "gobuild-tmp"?
> This was 4 years ago and honestly I don't remember anything about the
> patch, other than it was a pain to find the particular settings that
> work. You can probably set up a yocto build from the revision just
> before the patch and apply parts of it to see why 'go-something'
> didn't work at that point.
>
> We should be careful with further tweaks.
Understand, thanks. I tried with kirkstone branch, and set GOTMPDIR
to go-tmp, then bitbake buildah, build successfully.
But maybe I should set it to "tmp-go-build" to avoid possible regression.
//Changqing
>
> Alex
[-- Attachment #2: Type: text/html, Size: 2460 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-09 9:39 ` Alexander Kanavin
@ 2025-12-09 10:12 ` Changqing Li
2025-12-09 10:19 ` Alexander Kanavin
2025-12-15 18:06 ` Alexander Kanavin
0 siblings, 2 replies; 9+ messages in thread
From: Changqing Li @ 2025-12-09 10:12 UTC (permalink / raw)
To: Alexander Kanavin; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1489 bytes --]
On 12/9/25 17:39, Alexander Kanavin wrote:
> CAUTION: This email comes from a non Wind River email account!
> Do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On Tue, 9 Dec 2025 at 03:37, Changqing Li<changqing.li@windriver.com> wrote:
>> Wait. Go does not have reproducibility problems right now: it is a
>> part of reproducibility test, and not in the exclusion list. So how
>> can the issues that this patch set aims to fix be observed?
>>
>> I checked autobuilder configs, although we have reproducible test, but only test with openembeded-core
>>
>> and layers under meta-openembeded, and there is no recipe inherit go.bbclass(except etcd under meta-oe, but already skipped)
>>
>> So actually, we don't have reproducible test for recipes that compile with go.
> I see. I was confused and thought this fixes the go toolchain somehow.
>
> There is one recipe on oe-core that does inherit go class
> (go-helloworld), can you check why reproducibility issues don't happen
> there? It would be good to have a reproducibility test for things
> written in go in core, so this doesn't again regress quietly.
This issue reproduced when cgo is enabled, and go internally add
--ffile-prefix-map="WorkDir"=/tmp/go-build" to gcc
to tell gcc not include workdir in object file. for go-helloworld, it
should be pure go, does not include the "C", so it will not met this
issue.
//Changqing
> Alex
[-- Attachment #2: Type: text/html, Size: 2333 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-09 10:12 ` Changqing Li
@ 2025-12-09 10:19 ` Alexander Kanavin
2025-12-15 18:06 ` Alexander Kanavin
1 sibling, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2025-12-09 10:19 UTC (permalink / raw)
To: Changqing Li; +Cc: openembedded-core
On Tue, 9 Dec 2025 at 11:13, Changqing Li <changqing.li@windriver.com> wrote:
> This issue reproduced when cgo is enabled, and go internally add --ffile-prefix-map="WorkDir"=/tmp/go-build" to gcc
>
> to tell gcc not include workdir in object file. for go-helloworld, it should be pure go, does not include the "C", so it will not met this issue.
Alright. The patches are ok then, please summarize these points in v2
commit messages.
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility
2025-12-09 10:12 ` Changqing Li
2025-12-09 10:19 ` Alexander Kanavin
@ 2025-12-15 18:06 ` Alexander Kanavin
1 sibling, 0 replies; 9+ messages in thread
From: Alexander Kanavin @ 2025-12-15 18:06 UTC (permalink / raw)
To: Changqing Li; +Cc: openembedded-core
On Tue, 9 Dec 2025 at 11:13, Changqing Li <changqing.li@windriver.com> wrote:
> There is one recipe on oe-core that does inherit go class
> (go-helloworld), can you check why reproducibility issues don't happen
> there? It would be good to have a reproducibility test for things
> written in go in core, so this doesn't again regress quietly.
>
> This issue reproduced when cgo is enabled, and go internally add --ffile-prefix-map="WorkDir"=/tmp/go-build" to gcc
>
> to tell gcc not include workdir in object file. for go-helloworld, it should be pure go, does not include the "C", so it will not met this issue.
I have filed a bugzilla ticket for the missong cgo reproducibility
testing: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16100
If you have ideas how to address it (with something minimal) in
oe-core, that would be welcome.
Alex
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-12-15 18:06 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <187F32821D48D4AA.919836@lists.openembedded.org>
2025-12-08 9:18 ` [OE-core] [PATCH 1/2] go.bbclass: change GOTMPDIR to improve reproducibility Changqing Li
2025-12-08 10:39 ` Alexander Kanavin
2025-12-09 9:49 ` Changqing Li
2025-12-08 9:11 changqing.li
2025-12-08 10:41 ` [OE-core] " Alexander Kanavin
2025-12-09 2:37 ` Changqing Li
2025-12-09 9:39 ` Alexander Kanavin
2025-12-09 10:12 ` Changqing Li
2025-12-09 10:19 ` Alexander Kanavin
2025-12-15 18:06 ` Alexander Kanavin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.