Skip to contentSkip to conversation

bitbake.conf: DEBUG_PREFIX_MAP: add -fmacro-prefix-map for STAGING_DIR_NATIVE

RFC PATCH New Martin Jansa 1 participant 1 message Sep 5, 2024

lore
Share & tools
lore
#0 lore raw

RFC PATCH v2 1/1 bitbake.conf: DEBUG_PREFIX_MAP: add -fmacro-prefix-map for STAGING_DIR_NATIVE

* the default STAGING_DIR_NATIVE starts with STAGING_DIR_HOST and the only difference is '-native' suffix at the end

* this can lead into replacing STAGING_DIR_NATIVE path with just "-native" in FILE macros

* I've noticed this by accident in python3-matplotlib where buildpaths
QA warning was triggered only for lib32-python3-matplotlib and it was
because pybind11 path to STAGING_DIR_NATIVE was mapped to only
'-native/<path>' in python3-matplotlib build (which doesn't trigger
buildpaths QA and lib32-python3-matplotlib the macro path wasn't
replaced at all, because of 'lib32-' prefix in:
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/i586-oemllib32-linux/lib32-python3-matplotlib/3.7.2/lib32-recipe-sysroot= \
-fmacro-prefix-map=/OE/build/oe-core/tmp-glibc/work/i586-oemllib32-linux/lib32-python3-matplotlib/3.7.2/lib32-recipe-sysroot= \
-fdebug-prefix-map=/OE/build/oe-core/tmp-glibc/work/i586-oemllib32-linux/lib32-python3-matplotlib/3.7.2/recipe-sysroot-native= \

* more details in meta-python fix for lib32-python3-matplotlib:
https://lists.openembedded.org/g/openembedded-devel/message/112074

* the order of *-prefix-map options still seems to be that the last one matching wins and this works with gcc and clang, see:
https://reviews.llvm.org/D148975?id=516863
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591

* some components might sometimes be built with -coverage and could use -fcoverage-prefix-map:
https://reviews.llvm.org/D148757
or -fprofile-prefix-map:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-fprofile-prefix-map
but will leave that to recipes which actually use -coverage for now

---
v2: the order doesn't need to be changed
tested with gcc and clang by building both
lib32-python3-matplotlib and python3-matplotlib
and checking for buildpaths in tmp-glibc*/work/*/*python3-matplotlib/*/package/usr/lib*/python3.12/site-packages/matplotlib/_tri.cpython-312-*-linux-gnu.so and there were no TMPDIR or '^-native' paths inside (nor buildpaths QA issues triggered with this change)

 meta/conf/bitbake.conf | 1 +
 1 file changed, 1 insertion(+)
meta/conf/bitbake.conf +1 -0
index d8252c5b82..04b288abc1 100644
@@ -656,6 +656,7 @@ DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \
  -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_LEVELFLAG ?= "-g"
 
Signature · 1 line
2.46.0