| Message ID | 20251119101959.2603691-1-skandigraun@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | bitbake.conf: add canon-prefix-map to DEBUG_PREFIX_MAP | expand |
Le mer. 19 nov. 2025 à 11:20, Gyorgy Sarvari via lists.openembedded.org <skandigraun=gmail.com@lists.openembedded.org> a écrit : > When the debug-prefix-map and macro-prefix-map compiler flags > were change to file-prefix-map[1] the -fcanon-prefix-map > flag was removed, most likely accidentally. > > Due to this the file paths were not canonicalized before > substituting them, so they did not always match the corresponding keys. > > E.g. relative pathes were not converted to absolute ones: > ../../sources/foo.cpp doesn't match ${S}/foo.cpp, and due to > this some debug sources were missed. > > This patch adds back the -fcanon-prefix-map flag. > > [1]: > https://git.openembedded.org/openembedded-core/commit/?id=ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0 This patch does fix a bug I filed yesterday : https://bugzilla.yoctoproject.org/show_bug.cgi?id=16069 Awesome, thanks! For the out-of-tree kernel module case: Tested-by: Yoann Congal <yoann.congal@smile.fr> > Cc: Khem Raj <raj.khem@gmail.com> > Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> > --- > meta/conf/bitbake.conf | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf > index 52ceb76bbb..f789b8e326 100644 > --- a/meta/conf/bitbake.conf > +++ b/meta/conf/bitbake.conf > @@ -650,7 +650,7 @@ EXTRA_OEMAKE:prepend:task-install = > "${PARALLEL_MAKEINST} " > ################################################################## > TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}" > # Beware: applied last to first > -DEBUG_PREFIX_MAP ?= "\ > +DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \ > -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \ > -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \ > -ffile-prefix-map=${STAGING_DIR_HOST}= \ > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#226545): > https://lists.openembedded.org/g/openembedded-core/message/226545 > Mute This Topic: https://lists.openembedded.org/mt/116371356/4316185 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > yoann.congal@smile.fr] > -=-=-=-=-=-=-=-=-=-=-=- > >
Hmm, I just noticed that this flag wasn't omitted accidentally at all, but because clang doesn't support it. Please ignore this patch, will try to come up with some conditional patch or something like that. On 11/19/25 11:19, Gyorgy Sarvari wrote: > When the debug-prefix-map and macro-prefix-map compiler flags > were change to file-prefix-map[1] the -fcanon-prefix-map > flag was removed, most likely accidentally. > > Due to this the file paths were not canonicalized before > substituting them, so they did not always match the corresponding keys. > > E.g. relative pathes were not converted to absolute ones: > ../../sources/foo.cpp doesn't match ${S}/foo.cpp, and due to > this some debug sources were missed. > > This patch adds back the -fcanon-prefix-map flag. > > [1]: https://git.openembedded.org/openembedded-core/commit/?id=ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0 > > Cc: Khem Raj <raj.khem@gmail.com> > Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> > --- > meta/conf/bitbake.conf | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf > index 52ceb76bbb..f789b8e326 100644 > --- a/meta/conf/bitbake.conf > +++ b/meta/conf/bitbake.conf > @@ -650,7 +650,7 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} " > ################################################################## > TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}" > # Beware: applied last to first > -DEBUG_PREFIX_MAP ?= "\ > +DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \ > -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \ > -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \ > -ffile-prefix-map=${STAGING_DIR_HOST}= \
On Wed, Nov 19, 2025 at 9:20 AM Gyorgy Sarvari <skandigraun@gmail.com> wrote: > Hmm, I just noticed that this flag wasn't omitted accidentally at all, > but because clang doesn't support it. > > Please ignore this patch, will try to come up with some conditional > patch or something like that. > Right, the intention was to keep the DEBUG_PREFIX_MAP to be generic and I was hoping that packages won't need -fcanon-prefix-map but that's not the case. In any case I think we now have toolchain classes and these options are compiler specific so we could either move the whole assignment out of bitbake.conf and into toolchain classes or define addon variable in gcc.bbclass DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" and prepend it to DEBUG_PREFIX_MAP in bitbake.conf That will allow it to be overridden cleanly in recipes if needed. Third option is to keep it as such and add DEBUG_PREFIX_MAP =+ "-fcanon-prefix-map" meta/classes/toolchain/gcc.bbclass also keep in mind that this option is only available in gcc-13+ so DEBUG_PREFIX_MAP if used on native recipes might fail for hosts with gcc < 13 > > On 11/19/25 11:19, Gyorgy Sarvari wrote: > > When the debug-prefix-map and macro-prefix-map compiler flags > > were change to file-prefix-map[1] the -fcanon-prefix-map > > flag was removed, most likely accidentally. > > > > Due to this the file paths were not canonicalized before > > substituting them, so they did not always match the corresponding keys. > > > > E.g. relative pathes were not converted to absolute ones: > > ../../sources/foo.cpp doesn't match ${S}/foo.cpp, and due to > > this some debug sources were missed. > > > > This patch adds back the -fcanon-prefix-map flag. > > > > [1]: > https://git.openembedded.org/openembedded-core/commit/?id=ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0 > > > > Cc: Khem Raj <raj.khem@gmail.com> > > Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> > > --- > > meta/conf/bitbake.conf | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf > > index 52ceb76bbb..f789b8e326 100644 > > --- a/meta/conf/bitbake.conf > > +++ b/meta/conf/bitbake.conf > > @@ -650,7 +650,7 @@ EXTRA_OEMAKE:prepend:task-install = > "${PARALLEL_MAKEINST} " > > ################################################################## > > TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}" > > # Beware: applied last to first > > -DEBUG_PREFIX_MAP ?= "\ > > +DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \ > > -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \ > > -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \ > > -ffile-prefix-map=${STAGING_DIR_HOST}= \ > >
On Wed, 2025-11-19 at 09:29 -0800, Khem Raj via lists.openembedded.org wrote: > On Wed, Nov 19, 2025 at 9:20 AM Gyorgy Sarvari <skandigraun@gmail.com> wrote: > > Hmm, I just noticed that this flag wasn't omitted accidentally at all, > > but because clang doesn't support it. > > > > Please ignore this patch, will try to come up with some conditional > > patch or something like that. > > > > > > Right, the intention was to keep the DEBUG_PREFIX_MAP to be generic > and I was hoping that packages won't need -fcanon-prefix-map but that's > not the case. In any case I think we now have toolchain classes and these > options are compiler specific so we could either move the whole > assignment out of bitbake.conf and into toolchain classes > or define addon variable in gcc.bbclass > > DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" > > and prepend it to DEBUG_PREFIX_MAP in bitbake.conf > > That will allow it to be overridden cleanly in recipes if needed. > > Third option is to keep it as such and add > > DEBUG_PREFIX_MAP =+ "-fcanon-prefix-map" meta/classes/toolchain/gcc.bbclass > > also keep in mind that this option is only available in gcc-13+ > so DEBUG_PREFIX_MAP if used on native recipes might fail for hosts with > gcc < 13 > There is an additional issue in rust too, e.g.: https://autobuilder.yoctoproject.org/valkyrie/#/builders/22/builds/2773 Cheers, Richard
On Wed, Nov 19, 2025 at 10:17 AM Richard Purdie < richard.purdie@linuxfoundation.org> wrote: > On Wed, 2025-11-19 at 09:29 -0800, Khem Raj via lists.openembedded.org > wrote: > > On Wed, Nov 19, 2025 at 9:20 AM Gyorgy Sarvari <skandigraun@gmail.com> > wrote: > > > Hmm, I just noticed that this flag wasn't omitted accidentally at all, > > > but because clang doesn't support it. > > > > > > Please ignore this patch, will try to come up with some conditional > > > patch or something like that. > > > > > > > > > > > Right, the intention was to keep the DEBUG_PREFIX_MAP to be generic > > and I was hoping that packages won't need -fcanon-prefix-map but that's > > not the case. In any case I think we now have toolchain classes and these > > options are compiler specific so we could either move the whole > > assignment out of bitbake.conf and into toolchain classes > > or define addon variable in gcc.bbclass > > > > DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" > > > > and prepend it to DEBUG_PREFIX_MAP in bitbake.conf > > > > That will allow it to be overridden cleanly in recipes if needed. > > > > Third option is to keep it as such and add > > > > DEBUG_PREFIX_MAP =+ > "-fcanon-prefix-map" meta/classes/toolchain/gcc.bbclass > > > > also keep in mind that this option is only available in gcc-13+ > > so DEBUG_PREFIX_MAP if used on native recipes might fail for hosts with > > gcc < 13 > > > > There is an additional issue in rust too, e.g.: > > https://autobuilder.yoctoproject.org/valkyrie/#/builders/22/builds/2773 > > Right, as I noted above in my reply, ibuild host is running debian-12 and the gcc version on debian-12 is GCC-12 which does not have this option implemented. We need atleast gcc 13. Perhaps we should follow option 2 or 3, that will address the provlem surgically. > Cheers, > > Richard >
On 11/20/25 03:40, Khem Raj wrote: > > > On Wed, Nov 19, 2025 at 10:17 AM Richard Purdie > <richard.purdie@linuxfoundation.org> wrote: > > On Wed, 2025-11-19 at 09:29 -0800, Khem Raj via > lists.openembedded.org <http://lists.openembedded.org> wrote: > > On Wed, Nov 19, 2025 at 9:20 AM Gyorgy Sarvari > <skandigraun@gmail.com> wrote: > > > Hmm, I just noticed that this flag wasn't omitted accidentally > at all, > > > but because clang doesn't support it. > > > > > > Please ignore this patch, will try to come up with some > conditional > > > patch or something like that. > > > > > > > > > > > Right, the intention was to keep the DEBUG_PREFIX_MAP to be generic > > and I was hoping that packages won't need -fcanon-prefix-map but > that's > > not the case. In any case I think we now have toolchain classes > and these > > options are compiler specific so we could either move the whole > > assignment out of bitbake.conf and into toolchain classes > > or define addon variable in gcc.bbclass > > > > DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" > > > > and prepend it to DEBUG_PREFIX_MAP in bitbake.conf > > > > That will allow it to be overridden cleanly in recipes if needed. > > > > Third option is to keep it as such and add > > > > DEBUG_PREFIX_MAP =+ > "-fcanon-prefix-map" meta/classes/toolchain/gcc.bbclass > > > > also keep in mind that this option is only available in gcc-13+ > > so DEBUG_PREFIX_MAP if used on native recipes might fail for > hosts with > > gcc < 13 > > > > There is an additional issue in rust too, e.g.: > > https://autobuilder.yoctoproject.org/valkyrie/#/builders/22/builds/2773 > > > Right, as I noted above in my reply, ibuild host is running debian-12 > and the gcc version on debian-12 is GCC-12 which does not > have this option implemented. We need atleast gcc 13. Perhaps we > should follow option 2 or 3, that will address the provlem > surgically. Yes, but I believe that we are also hitting this bug: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15976 This log corroborates with this - bootstrapping is building some crates for the host, it uses the host's compiler, but it adds the target flags to it: "HOST_CFLAGS" uses no prefix-maps as prepared by oe_cargo_fix_env(), but the failing call uses them. (And the failing crate has cc-rs as a build dependency...) This is getting into a rabbit hole :) Will stare at this a bit more. > > > Cheers, > > Richard >
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 52ceb76bbb..f789b8e326 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -650,7 +650,7 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} " ################################################################## TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}" # Beware: applied last to first -DEBUG_PREFIX_MAP ?= "\ +DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \ -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \ -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \ -ffile-prefix-map=${STAGING_DIR_HOST}= \
When the debug-prefix-map and macro-prefix-map compiler flags were change to file-prefix-map[1] the -fcanon-prefix-map flag was removed, most likely accidentally. Due to this the file paths were not canonicalized before substituting them, so they did not always match the corresponding keys. E.g. relative pathes were not converted to absolute ones: ../../sources/foo.cpp doesn't match ${S}/foo.cpp, and due to this some debug sources were missed. This patch adds back the -fcanon-prefix-map flag. [1]: https://git.openembedded.org/openembedded-core/commit/?id=ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0 Cc: Khem Raj <raj.khem@gmail.com> Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> --- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)