Hello,
Thanks for the quick reply. Let me provide some details of my findings:
So the original DEBUG_PREFIX_MAP variable is a list of space separated values:
```
builder@bc2576acfe0e:/build/tmp/work/core2-64-oe-linux/python3/3.13.2$
bitbake-getvar DEBUG_PREFIX_MAP -r python3
#
# $DEBUG_PREFIX_MAP
# set? /build/../work/openembedded-core/meta/conf/bitbake.conf:666
# "-fcanon-prefix-map -fmacro-prefix-map=${S}=${TARGET_DBGSRC_DIR}
-fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR}
-fmacro-prefix-map=${B}=${TARGET_DBGSRC_DIR}
-fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR}
-fdebug-prefix-map=${STAGING_DIR_HOST}=
-fmacro-prefix-map=${STAGING_DIR_HOST}=
-fdebug-prefix-map=${STAGING_DIR_NATIVE}=
-fmacro-prefix-map=${STAGING_DIR_NATIVE}= "
DEBUG_PREFIX_MAP="-fcanon-prefix-map
-fmacro-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/Python-3.13.2=/usr/src/debug/python3/3.13.2
-fdebug-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/Python-3.13.2=/usr/src/debug/python3/3.13.2
-fmacro-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/build=/usr/src/debug/python3/3.13.2
-fdebug-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/build=/usr/src/debug/python3/3.13.2
-fdebug-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/recipe-sysroot=
-fmacro-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/recipe-sysroot=
-fdebug-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/recipe-sysroot-native=
-fmacro-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/recipe-sysroot-native=
"
```
Before replacing the buildpaths with `py_package_preprocess` we get this as
line separated entries:
```
builder@bc2576acfe0e:/build/tmp/work/core2-64-oe-linux/python3/3.13.2$ grep
'prefix-map' ./image/usr/lib/python-sysconfigdata/_sysconfigdata.py
'-fcanon-prefix-map '
'-fmacro-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/Python-3.13.2=/usr/src/debug/python3/3.13.2
'
'-fdebug-prefix-map=/build/tmp/work/core2-64-oe-linux/python3/3.13.2/Python-3.13.2=/usr/src/debug/python3/3.13.2
'
'-fmacro-prefix-map=/build/path/unavailable/=/usr/src/debug/python3/3.13.2 '
...
```
Some paths of the original contents of DEBUG_PREFIX_MAP are updated. However,
what is really being applied is the sed expression `-e
's:${BASE_WORKDIR}/${MULTIMACH_TARGET_SYS}::g'` . The actual values from
DEBUG_PREFIX_MAP are still there. That's why the host paths leaking checks are
not failing. The original code is trying to fully replace the full
DEBUG_PREFIX_MAP variable:
```
builder@bc2576acfe0e:/build/tmp/work/core2-64-oe-linux/python3/3.13.2$ grep
'prefix-map'
./package/usr/lib/python3.13/_sysconfigdata__linux_x86_64-linux-gnu.py
'-fcanon-prefix-map '
'-fmacro-prefix-map=/python3/3.13.2/Python-3.13.2=/usr/src/debug/python3/3.13.2
'
'-fdebug-prefix-map=/python3/3.13.2/Python-3.13.2=/usr/src/debug/python3/3.13.2
'
'-fmacro-prefix-map=/build/path/unavailable/=/usr/src/debug/python3/3.13.2 '
...
```
The reason I found this is beacause I was trying to do something that required
building python extensions on a host were the compilation flag
`-fcanon-prefix-map` was invalid as that was introduced with gcc13. However,
looking a bit deeper I realized that the sed expression is actually not doing
what it is meant to when removing DEBUG_PREFIX_MAP.
Regards,
Jorge
________________________________________
De: Alexander Kanavin <[email protected]>
Enviado: miércoles, 19 de febrero de 2025 14:28
Para: Sanjuán García, Jorge
Cc: [email protected]
Asunto: Re: [OE-core] [PATCH] python3: Remove DEBUG_PREFIX_MAP from
sysconfigdata
[No suele recibir correo electrónico de [email protected]. Descubra por
qué esto es importante en https://aka.ms/LearnAboutSenderIdentification ]
We're not seeing the problem on the autobuilder (which has checks for
host paths leaking into target installations). And I'm not seeing it
in my local build.
Can you show an example of this happening? So that it's clear what
isn't being correctly removed without this fix.
Alex
On Wed, 19 Feb 2025 at 14:03, Sanjuán García, Jorge via
lists.openembedded.org
<[email protected]> wrote:
>
> Paths in DEBUG_PREFIX_MAP are not being removed from sysconfigdata
> files correctly as they are split into line separated values. Update
> the sed command so that it uses any matching patern from
> DEBUG_PREFIX_MAP instead an exact match of the full variable.
>
> Signed-off-by: Jorge Sanjuan Garcia <[email protected]>
> ---
> meta/recipes-devtools/python/python3_3.13.2.bb | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/meta/recipes-devtools/python/python3_3.13.2.bb
> b/meta/recipes-devtools/python/python3_3.13.2.bb
> index 52fac76c00..656a73f501 100644
> --- a/meta/recipes-devtools/python/python3_3.13.2.bb
> +++ b/meta/recipes-devtools/python/python3_3.13.2.bb
> @@ -291,10 +291,12 @@ SSTATE_HASHEQUIV_FILEMAP = " \
> "
> PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"
>
> +DEBUG_PREFIX_MAP_REGEX =
> "${@'\\|'.join(d.getVar('DEBUG_PREFIX_MAP').split())}"
> +
> py_package_preprocess () {
> # Remove references to buildmachine paths in target Makefile and
> _sysconfigdata
> sed -i -e 's:--sysroot=${STAGING_DIR_TARGET}::g' -e
> s:'--with-libtool-sysroot=${STAGING_DIR_TARGET}'::g \
> - -e 's|${DEBUG_PREFIX_MAP}||g' \
> + -e 's:${DEBUG_PREFIX_MAP_REGEX}::g' \
> -e 's:${HOSTTOOLS_DIR}/::g' \
> -e 's:${RECIPE_SYSROOT_NATIVE}::g' \
> -e 's:${RECIPE_SYSROOT}::g' \
> --
> 2.43.0
>
>
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#211754):
https://lists.openembedded.org/g/openembedded-core/message/211754
Mute This Topic: https://lists.openembedded.org/mt/111268642/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-