bitbake.conf: drop ${PE} and ${PR} from -f{file,macro,debug}-prefix-map
PATCH v4 1/12 bitbake.conf: drop ${PE} and ${PR} from -f{file,macro,debug}-prefix-map
* ${EXTENDPE} and ${PR} was already dropped from ${WORKDIR} in:
https://lists.openembedded.org/g/openembedded-core/message/185818
adjust -fmacro-prefix-map and -fdebug-prefix-map similarly. As we don't depend on PR in WORKDIR maybe we don't need it in /usr/src/debug paths as well anymore.
* add TARGET_DBGSRC_DIR variable with "/usr/src/debug/${PN}/${PV}" because there is quite a few places where this location is being used in various recipes
* The interesting side-effect of this is that for DISTROs which still use PR (e.g. webOS OSE), the difference in -fdebug-prefix-map causes all binaries to be slightly different when rebuilt with different PR (due to this path, even when otherwise they are binary reproducible) and when the number of digits in PR changes (e.g. from r9 to r10) it also results in slightly bigger binaries (and more unnecessary changes in buildhistory diffs).
For example this foo binary, the difference between "new" and "old" is extra patch applied in SRC_URI (which doesn't affect the foo binary, but was the reason for PR bump).
And the binary is bigger with r10, identical with r6 and slightly different due to debug-prefix-map between r6 and r7:
$ ls -la 1.0.0-175-*/image/usr/sbin/foo -rwxr-xr-x 1 bitbake bitbake 30182460 Nov 8 08:29 1.0.0-175-new-r10/image/usr/sbin/foo -rwxr-xr-x 1 bitbake bitbake 30182224 Nov 8 08:02 1.0.0-175-new-r6/image/usr/sbin/foo -rwxr-xr-x 1 bitbake bitbake 30182224 Nov 8 07:49 1.0.0-175-new-r7/image/usr/sbin/foo -rwxr-xr-x 1 bitbake bitbake 30182224 Nov 8 07:39 1.0.0-175-old-r6/image/usr/sbin/foo
$ md5sum 1.0.0-175-*/image/usr/sbin/foo 8e3ab67d596f8cc2f9c6320dab10af01 1.0.0-175-new-r10/image/usr/sbin/foo f6ff1e64fe6affb9ba0d8f278cf7ed79 1.0.0-175-new-r6/image/usr/sbin/foo 6469a0b10aac233911e63c5ea97b03c0 1.0.0-175-new-r7/image/usr/sbin/foo f6ff1e64fe6affb9ba0d8f278cf7ed79 1.0.0-175-old-r6/image/usr/sbin/foo
---
v4: add TARGET_DBGSRC_DIR variable
meta/conf/bitbake.conf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
meta/conf/bitbake.conf +5 -4
@@ -646,12 +646,13 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} " ################################################################## # Optimization flags. ################################################################## +TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}" # Beware: applied last to first DEBUG_PREFIX_MAP ?= "-fcanon-prefix-map \ - -fmacro-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ - -fdebug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ - -fmacro-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ - -fdebug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ + -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}= \
Signature · 1 line
2.42.1
PATCH v2 2/12 ovmf: drop PE, PR from /usr/src/debug paths
--- meta/recipes-core/ovmf/ovmf_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/ovmf/ovmf_git.bb +1 -1
@@ -122,7 +122,7 @@ fix_toolchain:append:class-native() { # --debug-prefix-map to nasm (we carry a patch to nasm for this). The # tools definitions are built by ovmf-native so we need to pass this in # at target build time when we know the right values. -export NASM_PREFIX_MAP = "--debug-prefix-map=${WORKDIR}=/usr/src/debug/ovmf/${EXTENDPE}${PV}-${PR}" +export NASM_PREFIX_MAP = "--debug-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}" export GCC_PREFIX_MAP = "${DEBUG_PREFIX_MAP} -Wno-stringop-overflow -Wno-maybe-uninitialized" GCC_VER="$(${CC} -v 2>&1 | tail -n1 | awk '{print $3}')"
Signature · 1 line
2.42.1
PATCH v2 3/12 go-cross-canadian.inc: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/recipes-devtools/go/go-cross-canadian.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-devtools/go/go-cross-canadian.inc +1 -1
@@ -8,7 +8,7 @@ PN = "go-cross-canadian-${TRANSLATED_TARGET_ARCH}" # it uses gcc on build machine during go-cross-canadian bootstrap, but # the gcc version may be old and not support option '-fmacro-prefix-map' # which is one of default values of DEBUG_PREFIX_MAP -DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \ +DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR} \ -fdebug-prefix-map=${STAGING_DIR_HOST}= \ -fdebug-prefix-map=${STAGING_DIR_NATIVE}= \ "
Signature · 1 line
2.42.1
PATCH v2 4/12 acpica: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/recipes-extended/acpica/acpica_20230628.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-extended/acpica/acpica_20230628.bb +1 -1
@@ -36,7 +36,7 @@ EXTRA_OEMAKE = "CC='${CC}' \ INSTALLDIR=${bindir} \ INSTALLFLAGS= \ YACC=bison \ - YFLAGS='-y --file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}' \ + YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \ " do_install() {
Signature · 1 line
2.42.1
PATCH v2 5/12 libjpeg-turbo: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/recipes-graphics/jpeg/libjpeg-turbo_3.0.1.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/jpeg/libjpeg-turbo_3.0.1.bb +1 -1
@@ -24,7 +24,7 @@ RCONFLICTS:${PN} += "jpeg" inherit cmake pkgconfig -export NASMENV = "--reproducible --debug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" +export NASMENV = "--reproducible --debug-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}" # Add nasm-native dependency consistently for all build arches is hard EXTRA_OECMAKE:append:class-native = " -DWITH_SIMD=False"
Signature · 1 line
2.42.1
PATCH v2 6/12 ffmpeg: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/recipes-multimedia/ffmpeg/ffmpeg_6.0.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-multimedia/ffmpeg/ffmpeg_6.0.bb +1 -1
@@ -151,7 +151,7 @@ do_configure() { export TMPDIR="${B}/tmp" mkdir -p ${B}/tmp ${S}/configure ${EXTRA_OECONF} - sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} --debug-prefix-map=${B}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR},g" ${B}/ffbuild/config.mak + sed -i -e "s,^X86ASMFLAGS=.*,& --debug-prefix-map=${S}=${TARGET_DBGSRC_DIR} --debug-prefix-map=${B}=${TARGET_DBGSRC_DIR},g" ${B}/ffbuild/config.mak } # patch out build host paths for reproducibility
Signature · 1 line
2.42.1
PATCH v2 7/12 perf: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/recipes-kernel/perf/perf.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-kernel/perf/perf.bb +2 -2
@@ -98,7 +98,7 @@ EXTRA_OEMAKE = '\ AR="${AR}" \ LD="${LD}" \ EXTRA_CFLAGS="-ldw -I${S}" \ - YFLAGS='-y --file-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}' \ + YFLAGS='-y --file-prefix-map=${WORKDIR}=${TARGET_DBGSRC_DIR}' \ EXTRA_LDFLAGS="${PERF_EXTRA_LDFLAGS}" \ perfexecdir=${libexecdir} \ NO_GTK2=1 \
@@ -405,7 +405,7 @@ PACKAGESPLITFUNCS =+ "perf_fix_sources" perf_fix_sources () { for f in util/parse-events-flex.h util/parse-events-flex.c util/pmu-flex.c \ util/pmu-flex.h util/expr-flex.h util/expr-flex.c; do - f=${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/$f + f=${PKGD}${TARGET_DBGSRC_DIR}/$f if [ -e $f ]; then sed -i -e 's#${S}/##g' $f fi
Signature · 1 line
2.42.1
PATCH v2 8/12 rust: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/classes-recipe/rust-common.bbclass | 2 +- meta/recipes-devtools/rust/cargo_1.70.0.bb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
meta/classes-recipe/rust-common.bbclass +1 -1
@@ -14,7 +14,7 @@ FILES:${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta" FILES:${PN}-dbg += "${rustlibdir}/.debug" RUSTLIB = "-L ${STAGING_DIR_HOST}${rustlibdir}" -RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" +RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=${TARGET_DBGSRC_DIR}" RUSTFLAGS += "${RUSTLIB} ${RUST_DEBUG_REMAP}" RUSTLIB_DEP ?= "libstd-rs" RUST_PANIC_STRATEGY ?= "unwind"
meta/recipes-devtools/rust/cargo_1.70.0.bb +1 -1
@@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" inherit cargo pkgconfig -DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" +DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}" do_cargo_setup_snapshot () { ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
Signature · 1 line
2.42.1
PATCH v2 9/12 vulkan-samples: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- .../0001-vulkan-samples-Fix-reproducibility-issue.patch | 2 +- meta/recipes-graphics/vulkan/vulkan-samples_git.bb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-graphics/vulkan/vulkan-samples/0001-vulkan-samples-Fix-reproducibility-issue.patch +1 -1
@@ -9,7 +9,7 @@ in the debug source remapping from CFLAGS We export the right path to use in the recipe with: -EXTRA_OECMAKE = "-DCMAKE_DEBUG_SRCDIR=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/" +EXTRA_OECMAKE = "-DCMAKE_DEBUG_SRCDIR=${TARGET_DBGSRC_DIR}/" and we then patch this into the code instead of the broken use of CMAKE_SOURCE_DIR since __FILENAME__ will match our path prefix
meta/recipes-graphics/vulkan/vulkan-samples_git.bb +1 -1
@@ -29,7 +29,7 @@ FILES:${PN} += "${datadir}" # used for logging with LOGE in the code. We need to make this match the value we use # in the debug source remapping from CFLAGS # -EXTRA_OECMAKE += "-DCMAKE_DEBUG_SRCDIR=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/" +EXTRA_OECMAKE += "-DCMAKE_DEBUG_SRCDIR=${TARGET_DBGSRC_DIR}/" # Binaries built with PCH enabled don't appear reproducible, differing results were seen # from some builds depending on the point the PCH was compiled. Disable it to be # deterministic
Signature · 1 line
2.42.1
PATCH v2 10/12 valgrind: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/recipes-devtools/valgrind/valgrind_3.21.0.bb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
meta/recipes-devtools/valgrind/valgrind_3.21.0.bb +2 -2
@@ -239,8 +239,8 @@ do_install_ptest() { # As the binary isn't stripped or debug-splitted, the source file isn't fetched # via dwarfsrcfiles either, so it needs to be installed manually. - mkdir -p ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/none/tests/ - install ${S}/none/tests/tls.c ${D}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/none/tests/ + mkdir -p ${D}${TARGET_DBGSRC_DIR}/none/tests/ + install ${S}/none/tests/tls.c ${D}${TARGET_DBGSRC_DIR}/none/tests/ } do_install_ptest:append:x86-64 () {
Signature · 1 line
2.42.1
PATCH v2 11/12 python3-cython: drop PE, PR from /usr/src/debug paths
In reply to Martin Jansa--- .../python/python3-cython_0.29.36.bb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
meta/recipes-devtools/python/python3-cython_0.29.36.bb +9 -9
@@ -20,17 +20,17 @@ do_install:append() { PACKAGESPLITFUNCS =+ "cython_fix_sources" cython_fix_sources () { - for f in ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/FlowControl.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/FusedNode.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/Scanning.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Compiler/Visitor.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Plex/Actions.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Plex/Scanners.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Runtime/refnanny.c \ - ${PKGD}/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}/Cython/Tempita/_tempita.c \ + for f in ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Compiler/FlowControl.c \ + ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Compiler/FusedNode.c \ + ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Compiler/Scanning.c \ + ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Compiler/Visitor.c \ + ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Plex/Actions.c \ + ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Plex/Scanners.c \ + ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Runtime/refnanny.c \ + ${PKGD}${TARGET_DBGSRC_DIR}/Cython/Tempita/_tempita.c \ ${PKGD}${libdir}/${PYTHON_DIR}/site-packages/Cython*/SOURCES.txt; do if [ -e $f ]; then - sed -i -e 's#${WORKDIR}/Cython-${PV}#/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}#g' $f + sed -i -e 's#${WORKDIR}/Cython-${PV}#${TARGET_DBGSRC_DIR}#g' $f fi done }
Signature · 1 line
2.42.1
PATCH v2 12/12 igt-gpu-tools: drop PR from /usr/src/debug paths
In reply to Martin Jansa--- meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-graphics/igt-gpu-tools/igt-gpu-tools_git.bb +1 -1
@@ -24,7 +24,7 @@ PACKAGE_BEFORE_PN = "${PN}-benchmarks ${PN}-tests" PACKAGECONFIG[chamelium] = "-Dchamelium=enabled,-Dchamelium=disabled,gsl xmlrpc-c" -EXTRA_OEMESON = "-Ddocs=disabled -Drunner=enabled -Dsrcdir=/usr/src/debug/${PN}/${PV}-${PR}/git/ -Dversion_hash=${PV}" +EXTRA_OEMESON = "-Ddocs=disabled -Drunner=enabled -Dsrcdir=${TARGET_DBGSRC_DIR}/git/ -Dversion_hash=${PV}" COMPATIBLE_HOST = "(x86_64.*|i.86.*|arm.*|aarch64).*-linux" COMPATIBLE_HOST:libc-musl:class-target = "null" SECURITY_LDFLAGS = "${SECURITY_X_LDFLAGS}"
Signature · 1 line
2.42.1