| Message ID | 20251202075844.3270075-1-skandigraun@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | gcc.bbclass: set -fcanon-prefix-map for class-target only | expand |
On Tue, 2025-12-02 at 08:58 +0100, Gyorgy Sarvari via lists.openembedded.org wrote: > -fcanon-prefix-map is not supported by all host gcc version that is supported > by the Yocto project, which causes build failures when building recipes > for the host machine. > > This flag was supposed to be set for class-target anyway when gcc is the toolchain, > but even when a native target is compiled with gcc, both gcc and gcc-native classes > are loaded, and gcc.bbclass overwrites the DEBUG_PREFIX_MAP_EXTRA value. > > To avoid this, set this variable for only for class-target, explicitly. > > Reported-by: Mingli Yu <mingli.yu@windriver.com> > Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> > --- > meta/classes/toolchain/gcc.bbclass | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meta/classes/toolchain/gcc.bbclass b/meta/classes/toolchain/gcc.bbclass > index 0ed49ba892..5ec98bf7c5 100644 > --- a/meta/classes/toolchain/gcc.bbclass > +++ b/meta/classes/toolchain/gcc.bbclass > @@ -30,6 +30,6 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "gcc-crosss > PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "gcc-crosssdk-${SDK_SYS}" > PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian = "nativesdk-gcc-runtime" > > -DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" > +DEBUG_PREFIX_MAP_EXTRA:class-target = "-fcanon-prefix-map" > > TCOVERRIDE = "toolchain-gcc" Why are DEBUG_PREFIX_MAP being passed to the host gcc? We only use it in target flags or nativesdk flags, both of which would use our cross compiler, not the host gcc. If it is being passed to the host gcc, that is a bug and should be fixed. I appreciate there are some rust bugs in this area but those need to get fixed, we don't want a global workaround we could then never get rid of. Cheers, Richard
On Tue, 2025-12-02 at 08:58 +0100, Gyorgy Sarvari via lists.openembedded.org wrote: > -fcanon-prefix-map is not supported by all host gcc version that is supported > by the Yocto project, which causes build failures when building recipes > for the host machine. > > This flag was supposed to be set for class-target anyway when gcc is the toolchain, > but even when a native target is compiled with gcc, both gcc and gcc-native classes > are loaded, and gcc.bbclass overwrites the DEBUG_PREFIX_MAP_EXTRA value. > > To avoid this, set this variable for only for class-target, explicitly. > > Reported-by: Mingli Yu <mingli.yu@windriver.com> > Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> > --- > meta/classes/toolchain/gcc.bbclass | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meta/classes/toolchain/gcc.bbclass b/meta/classes/toolchain/gcc.bbclass > index 0ed49ba892..5ec98bf7c5 100644 > --- a/meta/classes/toolchain/gcc.bbclass > +++ b/meta/classes/toolchain/gcc.bbclass > @@ -30,6 +30,6 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "gcc-crosss > PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "gcc-crosssdk-${SDK_SYS}" > PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian = "nativesdk-gcc-runtime" > > -DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" > +DEBUG_PREFIX_MAP_EXTRA:class-target = "-fcanon-prefix-map" > > TCOVERRIDE = "toolchain-gcc" Just to be clear, this patch does have other concerns, for example, we should be passing that value to nativesdk too which the above patch also breaks. In some ways the opposite would be better: DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" DEBUG_PREFIX_MAP_EXTRA:class-native = "" however my original concerns stand, we shouldn't be passing this to the host gcc at all in the first place :/. These complexities are really why we need to fix the underlying issue. I did take some hacks into the release since it fixing this properly will take more time than we had available but for master, we do really need to get to the bottom of it. Cheers, Richard
On 12/9/25 13:11, Richard Purdie wrote: > On Tue, 2025-12-02 at 08:58 +0100, Gyorgy Sarvari via lists.openembedded.org wrote: >> -fcanon-prefix-map is not supported by all host gcc version that is supported >> by the Yocto project, which causes build failures when building recipes >> for the host machine. >> >> This flag was supposed to be set for class-target anyway when gcc is the toolchain, >> but even when a native target is compiled with gcc, both gcc and gcc-native classes >> are loaded, and gcc.bbclass overwrites the DEBUG_PREFIX_MAP_EXTRA value. >> >> To avoid this, set this variable for only for class-target, explicitly. >> >> Reported-by: Mingli Yu <mingli.yu@windriver.com> >> Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> >> --- >> meta/classes/toolchain/gcc.bbclass | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/meta/classes/toolchain/gcc.bbclass b/meta/classes/toolchain/gcc.bbclass >> index 0ed49ba892..5ec98bf7c5 100644 >> --- a/meta/classes/toolchain/gcc.bbclass >> +++ b/meta/classes/toolchain/gcc.bbclass >> @@ -30,6 +30,6 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "gcc-crosss >> PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "gcc-crosssdk-${SDK_SYS}" >> PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian = "nativesdk-gcc-runtime" >> >> -DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" >> +DEBUG_PREFIX_MAP_EXTRA:class-target = "-fcanon-prefix-map" >> >> TCOVERRIDE = "toolchain-gcc" > Why are DEBUG_PREFIX_MAP being passed to the host gcc? > > We only use it in target flags or nativesdk flags, both of which would > use our cross compiler, not the host gcc. If it is being passed to the > host gcc, that is a bug and should be fixed. > > I appreciate there are some rust bugs in this area but those need to > get fixed, we don't want a global workaround we could then never get > rid of. Hmmm... looking a bit more into the original issue, I think you are right, and this patch should be indeed dropped. This change was triggered by a (not rust related) build issue reported for a meta-oe recipe, but taking a second look into that recipe, it passes the DEBUG_PREFIX_MAP directly to the compiler when building for class-native, which is most likely triggering the issue in the first place. Sorry for the noise. > Cheers, > > Richard
On Tue, Dec 9, 2025 at 6:22 AM Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> wrote: > On 12/9/25 13:11, Richard Purdie wrote: > > On Tue, 2025-12-02 at 08:58 +0100, Gyorgy Sarvari via > lists.openembedded.org wrote: > >> -fcanon-prefix-map is not supported by all host gcc version that is > supported > >> by the Yocto project, which causes build failures when building recipes > >> for the host machine. > >> > >> This flag was supposed to be set for class-target anyway when gcc is > the toolchain, > >> but even when a native target is compiled with gcc, both gcc and > gcc-native classes > >> are loaded, and gcc.bbclass overwrites the DEBUG_PREFIX_MAP_EXTRA value. > >> > >> To avoid this, set this variable for only for class-target, explicitly. > >> > >> Reported-by: Mingli Yu <mingli.yu@windriver.com> > >> Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> > >> --- > >> meta/classes/toolchain/gcc.bbclass | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/meta/classes/toolchain/gcc.bbclass > b/meta/classes/toolchain/gcc.bbclass > >> index 0ed49ba892..5ec98bf7c5 100644 > >> --- a/meta/classes/toolchain/gcc.bbclass > >> +++ b/meta/classes/toolchain/gcc.bbclass > >> @@ -30,6 +30,6 @@ > PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = > "gcc-crosss > >> PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = > "gcc-crosssdk-${SDK_SYS}" > >> PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian > = "nativesdk-gcc-runtime" > >> > >> -DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" > >> +DEBUG_PREFIX_MAP_EXTRA:class-target = "-fcanon-prefix-map" > >> > >> TCOVERRIDE = "toolchain-gcc" > > Why are DEBUG_PREFIX_MAP being passed to the host gcc? > > > > We only use it in target flags or nativesdk flags, both of which would > > use our cross compiler, not the host gcc. If it is being passed to the > > host gcc, that is a bug and should be fixed. > > > > I appreciate there are some rust bugs in this area but those need to > > get fixed, we don't want a global workaround we could then never get > > rid of. > > Hmmm... looking a bit more into the original issue, I think you are > right, and this patch should be indeed dropped. > This change was triggered by a (not rust related) build issue reported > for a meta-oe recipe, but taking a second look into that recipe, it > passes the DEBUG_PREFIX_MAP directly to the compiler when building for > class-native, which is most likely triggering the issue in the first place. > I think gcc-native.bbclass should clear it perhaps, not the gcc.bbclass > > Sorry for the noise. > > > Cheers, > > > > Richard > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#227440): > https://lists.openembedded.org/g/openembedded-core/message/227440 > Mute This Topic: https://lists.openembedded.org/mt/116573246/1997914 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/meta/classes/toolchain/gcc.bbclass b/meta/classes/toolchain/gcc.bbclass index 0ed49ba892..5ec98bf7c5 100644 --- a/meta/classes/toolchain/gcc.bbclass +++ b/meta/classes/toolchain/gcc.bbclass @@ -30,6 +30,6 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "gcc-crosss PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "gcc-crosssdk-${SDK_SYS}" PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian = "nativesdk-gcc-runtime" -DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" +DEBUG_PREFIX_MAP_EXTRA:class-target = "-fcanon-prefix-map" TCOVERRIDE = "toolchain-gcc"
-fcanon-prefix-map is not supported by all host gcc version that is supported by the Yocto project, which causes build failures when building recipes for the host machine. This flag was supposed to be set for class-target anyway when gcc is the toolchain, but even when a native target is compiled with gcc, both gcc and gcc-native classes are loaded, and gcc.bbclass overwrites the DEBUG_PREFIX_MAP_EXTRA value. To avoid this, set this variable for only for class-target, explicitly. Reported-by: Mingli Yu <mingli.yu@windriver.com> Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> --- meta/classes/toolchain/gcc.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)