diff mbox series

[RFC,v2] bitbake.conf: DEBUG_PREFIX_MAP: add -fmacro-prefix-map for STAGING_DIR_NATIVE

Message ID 20240905091617.3580787-1-martin.jansa@gmail.com
State Accepted, archived
Commit 90dea34cb624af744a7d5deabdd5cbfb3c10db87
Headers show
Series [RFC,v2] bitbake.conf: DEBUG_PREFIX_MAP: add -fmacro-prefix-map for STAGING_DIR_NATIVE | expand

Commit Message

Martin Jansa Sept. 5, 2024, 9:16 a.m. UTC
* 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

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
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(+)
diff mbox series

Patch

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index d8252c5b82..04b288abc1 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -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"