diff mbox series

[walnascar,3/3] bitbake.conf: Switch prefix mapping to use -ffile-prefix-map

Message ID 1a8f58b2e7c2005757fcf1a5d4b57f7239925133.1755005205.git.steve@sakoman.com
State Deferred
Delegated to: Steve Sakoman
Headers show
Series [walnascar,1/3] dropbear: patch CVE-2025-47203 | expand

Commit Message

Steve Sakoman Aug. 12, 2025, 1:29 p.m. UTC
From: Khem Raj <raj.khem@gmail.com>

-ffile-prefix map is more comprehensive when it comes to reproducible
builds and its superset of all prefix-mapping options in compilers

(From OE-Core rev: ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
 meta/conf/bitbake.conf                             | 14 +++++---------
 meta/lib/oe/package.py                             |  2 +-
 meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
 .../python/python3-maturin_1.8.3.bb                |  2 +-
 meta/recipes-devtools/rust/cargo_1.84.1.bb         |  2 +-
 6 files changed, 11 insertions(+), 17 deletions(-)

Comments

Gyorgy Sarvari Aug. 13, 2025, 4:11 p.m. UTC | #1
Is this more than cosmetic in walnascar? If it isn't, than should this
really go into a stable branch? In my understanding this will require a
brand new sstate cache.

On 8/12/25 15:29, Steve Sakoman via lists.openembedded.org wrote:
> From: Khem Raj <raj.khem@gmail.com>
>
> -ffile-prefix map is more comprehensive when it comes to reproducible
> builds and its superset of all prefix-mapping options in compilers
>
> (From OE-Core rev: ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0)
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
> Signed-off-by: Steve Sakoman <steve@sakoman.com>
> ---
>  meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
>  meta/conf/bitbake.conf                             | 14 +++++---------
>  meta/lib/oe/package.py                             |  2 +-
>  meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
>  .../python/python3-maturin_1.8.3.bb                |  2 +-
>  meta/recipes-devtools/rust/cargo_1.84.1.bb         |  2 +-
>  6 files changed, 11 insertions(+), 17 deletions(-)
>
> diff --git a/meta/classes-recipe/kernel-arch.bbclass b/meta/classes-recipe/kernel-arch.bbclass
> index 36a6e0a60a..749a266ea3 100644
> --- a/meta/classes-recipe/kernel-arch.bbclass
> +++ b/meta/classes-recipe/kernel-arch.bbclass
> @@ -73,10 +73,8 @@ HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}"
>  
>  KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
>   -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
> - -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> - -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> - -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> - -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> + -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> + -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
>  "
>  KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
>  KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 501808204e..b1dae17267 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -652,15 +652,11 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
>  ##################################################################
>  TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
>  # Beware: applied last to first
> -DEBUG_PREFIX_MAP ?= "-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 ?= "\
> + -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
> + -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
> + -ffile-prefix-map=${STAGING_DIR_HOST}= \
> + -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
>  "
>  DEBUG_LEVELFLAG ?= "-g"
>  
> diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> index 0db14f2164..0bcc04ea54 100644
> --- a/meta/lib/oe/package.py
> +++ b/meta/lib/oe/package.py
> @@ -991,7 +991,7 @@ def copydebugsources(debugsrcdir, sources, d):
>  
>          prefixmap = {}
>          for flag in cflags.split():
> -            if not flag.startswith("-fdebug-prefix-map"):
> +            if not flag.startswith("-ffile-prefix-map"):
>                  continue
>              if "recipe-sysroot" in flag:
>                  continue
> diff --git a/meta/recipes-devtools/gcc/libgfortran.inc b/meta/recipes-devtools/gcc/libgfortran.inc
> index 4560421ed1..fa6aecaaa3 100644
> --- a/meta/recipes-devtools/gcc/libgfortran.inc
> +++ b/meta/recipes-devtools/gcc/libgfortran.inc
> @@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
>  # An arm hard float target like raspberrypi4 won't build
>  # as CFLAGS don't make it to the fortran compiler otherwise
>  # (the configure script sets FC to $GFORTRAN unconditionally)
> -export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
> +export GFORTRAN = "${FC} -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
>  
>  do_configure () {
>  	for target in libbacktrace libgfortran
> diff --git a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> index 17c8fb7083..ad61aac856 100644
> --- a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> +++ b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> @@ -9,7 +9,7 @@ SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015
>  
>  S = "${WORKDIR}/maturin-${PV}"
>  
> -CFLAGS += "-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
> +CFLAGS += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
>  
>  DEPENDS += "\
>      python3-setuptools-rust-native \
> diff --git a/meta/recipes-devtools/rust/cargo_1.84.1.bb b/meta/recipes-devtools/rust/cargo_1.84.1.bb
> index db18ecfda9..150c2d2b80 100644
> --- a/meta/recipes-devtools/rust/cargo_1.84.1.bb
> +++ b/meta/recipes-devtools/rust/cargo_1.84.1.bb
> @@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
>  
>  inherit cargo pkgconfig
>  
> -DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
> +DEBUG_PREFIX_MAP += "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
>  
>  do_cargo_setup_snapshot () {
>  	${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
>
Steve Sakoman Aug. 13, 2025, 4:13 p.m. UTC | #2
On Wed, Aug 13, 2025 at 9:11 AM Gyorgy Sarvari <skandigraun@gmail.com> wrote:
>
> Is this more than cosmetic in walnascar? If it isn't, than should this
> really go into a stable branch? In my understanding this will require a
> brand new sstate cache.

Khem,

Can you comment on this?

Thanks!

Steve

>
> On 8/12/25 15:29, Steve Sakoman via lists.openembedded.org wrote:
> > From: Khem Raj <raj.khem@gmail.com>
> >
> > -ffile-prefix map is more comprehensive when it comes to reproducible
> > builds and its superset of all prefix-mapping options in compilers
> >
> > (From OE-Core rev: ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0)
> >
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
> > Signed-off-by: Steve Sakoman <steve@sakoman.com>
> > ---
> >  meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
> >  meta/conf/bitbake.conf                             | 14 +++++---------
> >  meta/lib/oe/package.py                             |  2 +-
> >  meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
> >  .../python/python3-maturin_1.8.3.bb                |  2 +-
> >  meta/recipes-devtools/rust/cargo_1.84.1.bb         |  2 +-
> >  6 files changed, 11 insertions(+), 17 deletions(-)
> >
> > diff --git a/meta/classes-recipe/kernel-arch.bbclass b/meta/classes-recipe/kernel-arch.bbclass
> > index 36a6e0a60a..749a266ea3 100644
> > --- a/meta/classes-recipe/kernel-arch.bbclass
> > +++ b/meta/classes-recipe/kernel-arch.bbclass
> > @@ -73,10 +73,8 @@ HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}"
> >
> >  KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
> >   -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
> > - -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> > - -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> > - -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> > - -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> > + -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> > + -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> >  "
> >  KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
> >  KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index 501808204e..b1dae17267 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -652,15 +652,11 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
> >  ##################################################################
> >  TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
> >  # Beware: applied last to first
> > -DEBUG_PREFIX_MAP ?= "-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 ?= "\
> > + -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
> > + -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
> > + -ffile-prefix-map=${STAGING_DIR_HOST}= \
> > + -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
> >  "
> >  DEBUG_LEVELFLAG ?= "-g"
> >
> > diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> > index 0db14f2164..0bcc04ea54 100644
> > --- a/meta/lib/oe/package.py
> > +++ b/meta/lib/oe/package.py
> > @@ -991,7 +991,7 @@ def copydebugsources(debugsrcdir, sources, d):
> >
> >          prefixmap = {}
> >          for flag in cflags.split():
> > -            if not flag.startswith("-fdebug-prefix-map"):
> > +            if not flag.startswith("-ffile-prefix-map"):
> >                  continue
> >              if "recipe-sysroot" in flag:
> >                  continue
> > diff --git a/meta/recipes-devtools/gcc/libgfortran.inc b/meta/recipes-devtools/gcc/libgfortran.inc
> > index 4560421ed1..fa6aecaaa3 100644
> > --- a/meta/recipes-devtools/gcc/libgfortran.inc
> > +++ b/meta/recipes-devtools/gcc/libgfortran.inc
> > @@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
> >  # An arm hard float target like raspberrypi4 won't build
> >  # as CFLAGS don't make it to the fortran compiler otherwise
> >  # (the configure script sets FC to $GFORTRAN unconditionally)
> > -export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
> > +export GFORTRAN = "${FC} -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
> >
> >  do_configure () {
> >       for target in libbacktrace libgfortran
> > diff --git a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> > index 17c8fb7083..ad61aac856 100644
> > --- a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> > +++ b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> > @@ -9,7 +9,7 @@ SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015
> >
> >  S = "${WORKDIR}/maturin-${PV}"
> >
> > -CFLAGS += "-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
> > +CFLAGS += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
> >
> >  DEPENDS += "\
> >      python3-setuptools-rust-native \
> > diff --git a/meta/recipes-devtools/rust/cargo_1.84.1.bb b/meta/recipes-devtools/rust/cargo_1.84.1.bb
> > index db18ecfda9..150c2d2b80 100644
> > --- a/meta/recipes-devtools/rust/cargo_1.84.1.bb
> > +++ b/meta/recipes-devtools/rust/cargo_1.84.1.bb
> > @@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
> >
> >  inherit cargo pkgconfig
> >
> > -DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
> > +DEBUG_PREFIX_MAP += "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
> >
> >  do_cargo_setup_snapshot () {
> >       ${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
> >
>
Khem Raj Aug. 13, 2025, 9:21 p.m. UTC | #3
On Wed, Aug 13, 2025 at 9:14 AM Steve Sakoman <steve@sakoman.com> wrote:
>
> On Wed, Aug 13, 2025 at 9:11 AM Gyorgy Sarvari <skandigraun@gmail.com> wrote:
> >
> > Is this more than cosmetic in walnascar? If it isn't, than should this
> > really go into a stable branch? In my understanding this will require a
> > brand new sstate cache.
>
> Khem,
>
> Can you comment on this?
>

Hi Steve,

I think there are patches in other layers which will be required to
backported as well. While its possible, I think
it could be some work to get it going, I would suggest to hold it back
and let folks use october release to use it
where it is soaked better.

> Thanks!
>
> Steve
>
> >
> > On 8/12/25 15:29, Steve Sakoman via lists.openembedded.org wrote:
> > > From: Khem Raj <raj.khem@gmail.com>
> > >
> > > -ffile-prefix map is more comprehensive when it comes to reproducible
> > > builds and its superset of all prefix-mapping options in compilers
> > >
> > > (From OE-Core rev: ff73fa7ef7666a6dbe34f15515bc3ab6e574c5b0)
> > >
> > > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > > Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
> > > Signed-off-by: Steve Sakoman <steve@sakoman.com>
> > > ---
> > >  meta/classes-recipe/kernel-arch.bbclass            |  6 ++----
> > >  meta/conf/bitbake.conf                             | 14 +++++---------
> > >  meta/lib/oe/package.py                             |  2 +-
> > >  meta/recipes-devtools/gcc/libgfortran.inc          |  2 +-
> > >  .../python/python3-maturin_1.8.3.bb                |  2 +-
> > >  meta/recipes-devtools/rust/cargo_1.84.1.bb         |  2 +-
> > >  6 files changed, 11 insertions(+), 17 deletions(-)
> > >
> > > diff --git a/meta/classes-recipe/kernel-arch.bbclass b/meta/classes-recipe/kernel-arch.bbclass
> > > index 36a6e0a60a..749a266ea3 100644
> > > --- a/meta/classes-recipe/kernel-arch.bbclass
> > > +++ b/meta/classes-recipe/kernel-arch.bbclass
> > > @@ -73,10 +73,8 @@ HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}"
> > >
> > >  KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
> > >   -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
> > > - -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> > > - -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> > > - -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> > > - -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> > > + -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
> > > + -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
> > >  "
> > >  KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
> > >  KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
> > > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > > index 501808204e..b1dae17267 100644
> > > --- a/meta/conf/bitbake.conf
> > > +++ b/meta/conf/bitbake.conf
> > > @@ -652,15 +652,11 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
> > >  ##################################################################
> > >  TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
> > >  # Beware: applied last to first
> > > -DEBUG_PREFIX_MAP ?= "-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 ?= "\
> > > + -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
> > > + -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
> > > + -ffile-prefix-map=${STAGING_DIR_HOST}= \
> > > + -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
> > >  "
> > >  DEBUG_LEVELFLAG ?= "-g"
> > >
> > > diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
> > > index 0db14f2164..0bcc04ea54 100644
> > > --- a/meta/lib/oe/package.py
> > > +++ b/meta/lib/oe/package.py
> > > @@ -991,7 +991,7 @@ def copydebugsources(debugsrcdir, sources, d):
> > >
> > >          prefixmap = {}
> > >          for flag in cflags.split():
> > > -            if not flag.startswith("-fdebug-prefix-map"):
> > > +            if not flag.startswith("-ffile-prefix-map"):
> > >                  continue
> > >              if "recipe-sysroot" in flag:
> > >                  continue
> > > diff --git a/meta/recipes-devtools/gcc/libgfortran.inc b/meta/recipes-devtools/gcc/libgfortran.inc
> > > index 4560421ed1..fa6aecaaa3 100644
> > > --- a/meta/recipes-devtools/gcc/libgfortran.inc
> > > +++ b/meta/recipes-devtools/gcc/libgfortran.inc
> > > @@ -8,7 +8,7 @@ EXTRA_OECONF_PATHS = "\
> > >  # An arm hard float target like raspberrypi4 won't build
> > >  # as CFLAGS don't make it to the fortran compiler otherwise
> > >  # (the configure script sets FC to $GFORTRAN unconditionally)
> > > -export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
> > > +export GFORTRAN = "${FC} -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
> > >
> > >  do_configure () {
> > >       for target in libbacktrace libgfortran
> > > diff --git a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> > > index 17c8fb7083..ad61aac856 100644
> > > --- a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> > > +++ b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
> > > @@ -9,7 +9,7 @@ SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015
> > >
> > >  S = "${WORKDIR}/maturin-${PV}"
> > >
> > > -CFLAGS += "-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
> > > +CFLAGS += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
> > >
> > >  DEPENDS += "\
> > >      python3-setuptools-rust-native \
> > > diff --git a/meta/recipes-devtools/rust/cargo_1.84.1.bb b/meta/recipes-devtools/rust/cargo_1.84.1.bb
> > > index db18ecfda9..150c2d2b80 100644
> > > --- a/meta/recipes-devtools/rust/cargo_1.84.1.bb
> > > +++ b/meta/recipes-devtools/rust/cargo_1.84.1.bb
> > > @@ -19,7 +19,7 @@ CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
> > >
> > >  inherit cargo pkgconfig
> > >
> > > -DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
> > > +DEBUG_PREFIX_MAP += "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
> > >
> > >  do_cargo_setup_snapshot () {
> > >       ${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig
> > >
> >
Steve Sakoman Aug. 15, 2025, 4:03 p.m. UTC | #4
On Wed, Aug 13, 2025 at 9:14 AM Steve Sakoman via
lists.openembedded.org <steve=sakoman.com@lists.openembedded.org>
wrote:
>
> On Wed, Aug 13, 2025 at 9:11 AM Gyorgy Sarvari <skandigraun@gmail.com> wrote:
> >
> > Is this more than cosmetic in walnascar? If it isn't, than should this
> > really go into a stable branch? In my understanding this will require a
> > brand new sstate cache.
>
> Khem,
>
> Can you comment on this?

I need to wrap up the changeset for the walnascar release, so I'm
going to remove these two patches until we reach some consensus on the
need for them.

Steve
Khem Raj Aug. 15, 2025, 6:42 p.m. UTC | #5
On Fri, Aug 15, 2025 at 9:03 AM Steve Sakoman <steve@sakoman.com> wrote:
>
> On Wed, Aug 13, 2025 at 9:14 AM Steve Sakoman via
> lists.openembedded.org <steve=sakoman.com@lists.openembedded.org>
> wrote:
> >
> > On Wed, Aug 13, 2025 at 9:11 AM Gyorgy Sarvari <skandigraun@gmail.com> wrote:
> > >
> > > Is this more than cosmetic in walnascar? If it isn't, than should this
> > > really go into a stable branch? In my understanding this will require a
> > > brand new sstate cache.
> >
> > Khem,
> >
> > Can you comment on this?
>
> I need to wrap up the changeset for the walnascar release, so I'm
> going to remove these two patches until we reach some consensus on the
> need for them.

Please drop.

>
> Steve
Deepesh Varatharajan Sept. 3, 2025, 11:49 a.m. UTC | #6
Hi Khem,

We backported this patch due to a specific use case on our end. We set the TMPDIR
path length to 399 characters (just under the 400-character limit) and attempted
to build lib32-gcc. While this works fine on the master branch, we encountered the
following error on the walnascar branch:

make: /bin/bash: Argument list too long
make: *** [Makefile:4701: all-gcc] Error 127
ERROR: oe_runmake failed

Upon comparing the logs between the master and walnascar branches, we noticed that
in walnascar, the following flags were passed multiple times:

-fmacro-prefix-map
-fdebug-prefix-map
-fcanon-prefix-map

Since our TMPDIR path is quite long, passing it repeatedly via these flags seems
to be the root cause of the issue.

In the master branch, these were replaced with the more concise "-ffile-prefix-map"
flag, significantly reducing the number of times the long TMPDIR path is passed to
the compiler. This change resolved the error, which is why we backported the patch
to walnascar.

So, can we backport this for walnascar branch in future or do you suggest us to wait for
october release.

Regards,
Deepesh
Khem Raj Sept. 8, 2025, 3:55 p.m. UTC | #7
On Wed, Sep 3, 2025 at 4:49 AM Varatharajan, Deepesh via
lists.openembedded.org
<deepesh.varatharajan=windriver.com@lists.openembedded.org> wrote:
>
> Hi Khem,
>
> We backported this patch due to a specific use case on our end. We set the TMPDIR
> path length to 399 characters (just under the 400-character limit) and attempted
> to build lib32-gcc. While this works fine on the master branch, we encountered the
> following error on the walnascar branch:
>
> make: /bin/bash: Argument list too long
> make: *** [Makefile:4701: all-gcc] Error 127
> ERROR: oe_runmake failed
>
> Upon comparing the logs between the master and walnascar branches, we noticed that
> in walnascar, the following flags were passed multiple times:
>
> -fmacro-prefix-map
> -fdebug-prefix-map
> -fcanon-prefix-map
>
> Since our TMPDIR path is quite long, passing it repeatedly via these flags seems
> to be the root cause of the issue.
>
> In the master branch, these were replaced with the more concise "-ffile-prefix-map"
> flag, significantly reducing the number of times the long TMPDIR path is passed to
> the compiler. This change resolved the error, which is why we backported the patch
> to walnascar.
>
> So, can we backport this for walnascar branch in future or do you suggest us to wait for
> october release.
>

these fixes also needed fixed in other layers so they will need to
backport needed patches
as well. I can speak for meta-oe layers but I am sure there are more,
so I would think it
is not an easy cherry-pick,

The issue of duplicate options is at the root of it, perhaps finding
that out and trying to solve
is a good fix even for master. Backporting this is just a workaround
to overcome the real issue.

> Regards,
> Deepesh
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#222856): https://lists.openembedded.org/g/openembedded-core/message/222856
> Mute This Topic: https://lists.openembedded.org/mt/114665450/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/meta/classes-recipe/kernel-arch.bbclass b/meta/classes-recipe/kernel-arch.bbclass
index 36a6e0a60a..749a266ea3 100644
--- a/meta/classes-recipe/kernel-arch.bbclass
+++ b/meta/classes-recipe/kernel-arch.bbclass
@@ -73,10 +73,8 @@  HOST_OBJCOPY_KERNEL_ARCH ?= "${TARGET_OBJCOPY_KERNEL_ARCH}"
 
 KERNEL_CC = "${CCACHE}${HOST_PREFIX}gcc ${HOST_CC_KERNEL_ARCH} \
  -fuse-ld=bfd ${DEBUG_PREFIX_MAP} \
- -fdebug-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
- -fdebug-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
- -fmacro-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_DIR}=${KERNEL_SRC_PATH} \
+ -ffile-prefix-map=${STAGING_KERNEL_BUILDDIR}=${KERNEL_SRC_PATH} \
 "
 KERNEL_LD = "${HOST_PREFIX}ld.bfd ${HOST_LD_KERNEL_ARCH}"
 KERNEL_AR = "${HOST_PREFIX}ar ${HOST_AR_KERNEL_ARCH}"
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 501808204e..b1dae17267 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -652,15 +652,11 @@  EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} "
 ##################################################################
 TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}"
 # Beware: applied last to first
-DEBUG_PREFIX_MAP ?= "-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 ?= "\
+ -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \
+ -ffile-prefix-map=${STAGING_DIR_HOST}= \
+ -ffile-prefix-map=${STAGING_DIR_NATIVE}= \
 "
 DEBUG_LEVELFLAG ?= "-g"
 
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 0db14f2164..0bcc04ea54 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -991,7 +991,7 @@  def copydebugsources(debugsrcdir, sources, d):
 
         prefixmap = {}
         for flag in cflags.split():
-            if not flag.startswith("-fdebug-prefix-map"):
+            if not flag.startswith("-ffile-prefix-map"):
                 continue
             if "recipe-sysroot" in flag:
                 continue
diff --git a/meta/recipes-devtools/gcc/libgfortran.inc b/meta/recipes-devtools/gcc/libgfortran.inc
index 4560421ed1..fa6aecaaa3 100644
--- a/meta/recipes-devtools/gcc/libgfortran.inc
+++ b/meta/recipes-devtools/gcc/libgfortran.inc
@@ -8,7 +8,7 @@  EXTRA_OECONF_PATHS = "\
 # An arm hard float target like raspberrypi4 won't build
 # as CFLAGS don't make it to the fortran compiler otherwise
 # (the configure script sets FC to $GFORTRAN unconditionally)
-export GFORTRAN = "${FC} -fcanon-prefix-map -fdebug-prefix-map=${S}=${TARGET_DBGSRC_DIR} -fdebug-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
+export GFORTRAN = "${FC} -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} -gno-record-gcc-switches"
 
 do_configure () {
 	for target in libbacktrace libgfortran
diff --git a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
index 17c8fb7083..ad61aac856 100644
--- a/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
+++ b/meta/recipes-devtools/python/python3-maturin_1.8.3.bb
@@ -9,7 +9,7 @@  SRC_URI[sha256sum] = "304762f86fd53a8031b1bf006d12572a2aa0a5235485031113195cc015
 
 S = "${WORKDIR}/maturin-${PV}"
 
-CFLAGS += "-fdebug-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
+CFLAGS += "-ffile-prefix-map=${CARGO_HOME}=${TARGET_DBGSRC_DIR}/cargo_home"
 
 DEPENDS += "\
     python3-setuptools-rust-native \
diff --git a/meta/recipes-devtools/rust/cargo_1.84.1.bb b/meta/recipes-devtools/rust/cargo_1.84.1.bb
index db18ecfda9..150c2d2b80 100644
--- a/meta/recipes-devtools/rust/cargo_1.84.1.bb
+++ b/meta/recipes-devtools/rust/cargo_1.84.1.bb
@@ -19,7 +19,7 @@  CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
 
 inherit cargo pkgconfig
 
-DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
+DEBUG_PREFIX_MAP += "-ffile-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}"
 
 do_cargo_setup_snapshot () {
 	${UNPACKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig