diff mbox series

gcc: Allow -Wno-error=poison-system-directories to take effect

Message ID 20221013132926.2771530-1-pkj@axis.com
State Accepted, archived
Commit 1cb0245539f7d5277fae4e9abc7f2a0130d0caa8
Headers show
Series gcc: Allow -Wno-error=poison-system-directories to take effect | expand

Commit Message

Peter Kjellerstedt Oct. 13, 2022, 1:29 p.m. UTC
The change in commit e903b29f (gcc-cross: pass
-Werror=poison-system-directories to compiler stages) made it impossible
to disable the error using -Wno-error=poison-system-directories.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 .../0002-gcc-poison-system-directories.patch  | 36 +++++++++----------
 1 file changed, 18 insertions(+), 18 deletions(-)

Comments

Ross Burton Oct. 13, 2022, 2:05 p.m. UTC | #1
Whilst this is a good fix, I’m horrified to ask why you need it…

Ross

> On 13 Oct 2022, at 14:29, Peter Kjellerstedt via lists.openembedded.org <peter.kjellerstedt=axis.com@lists.openembedded.org> wrote:
> 
> The change in commit e903b29f (gcc-cross: pass
> -Werror=poison-system-directories to compiler stages) made it impossible
> to disable the error using -Wno-error=poison-system-directories.
> 
> Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> ---
> .../0002-gcc-poison-system-directories.patch  | 36 +++++++++----------
> 1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
> index bfec4477c1..5aa635b3d4 100644
> --- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
> +++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
> @@ -1,4 +1,4 @@
> -From e1dbdcd0ea667bab4b551294354e04c6fe288ab6 Mon Sep 17 00:00:00 2001
> +From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001
> From: Khem Raj <raj.khem@gmail.com>
> Date: Mon, 8 Mar 2021 16:04:20 -0800
> Subject: [PATCH] gcc: poison-system-directories
> @@ -20,12 +20,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
>  gcc/configure       | 19 +++++++++++++++++++
>  gcc/configure.ac    | 16 ++++++++++++++++
>  gcc/doc/invoke.texi |  9 +++++++++
> - gcc/gcc.cc          |  9 +++++++--
> + gcc/gcc.cc          | 15 ++++++++++++---
>  gcc/incpath.cc      | 21 +++++++++++++++++++++
> - 7 files changed, 86 insertions(+), 2 deletions(-)
> + 7 files changed, 91 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/common.opt b/gcc/common.opt
> -index 8a0dafc522d..0357868e22c 100644
> +index 8a0dafc52..0357868e2 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -710,6 +710,10 @@ Wreturn-local-addr
> @@ -40,7 +40,7 @@ index 8a0dafc522d..0357868e22c 100644
>  Common Var(warn_shadow) Warning
>  Warn when one variable shadows another.  Same as -Wshadow=global.
> diff --git a/gcc/config.in b/gcc/config.in
> -index 64c27c9cfac..a693cb8a886 100644
> +index 64c27c9cf..a693cb8a8 100644
> --- a/gcc/config.in
> +++ b/gcc/config.in
> @@ -230,6 +230,16 @@
> @@ -61,7 +61,7 @@ index 64c27c9cfac..a693cb8a886 100644
>     optimizer and back end) to be checked for dynamic type safety at runtime.
>     This is quite expensive. */
> diff --git a/gcc/configure b/gcc/configure
> -index 5ce0557719a..dc2d59701ad 100755
> +index 2b83acfb0..8bb97578c 100755
> --- a/gcc/configure
> +++ b/gcc/configure
> @@ -1023,6 +1023,7 @@ enable_maintainer_mode
> @@ -81,7 +81,7 @@ index 5ce0557719a..dc2d59701ad 100755
>    --enable-plugin         enable plugin support
>    --enable-host-shared    build host code as shared libraries
>    --disable-libquadmath-support
> -@@ -31982,6 +31985,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
> +@@ -31996,6 +31999,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
>  fi
> 
> 
> @@ -105,10 +105,10 @@ index 5ce0557719a..dc2d59701ad 100755
> 
> 
> diff --git a/gcc/configure.ac b/gcc/configure.ac
> -index 23bee7010a3..36ce78924de 100644
> +index daf2a708c..6155b83a7 100644
> --- a/gcc/configure.ac
> +++ b/gcc/configure.ac
> -@@ -7421,6 +7421,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
> +@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
>                  [specify that runtime libraries should be
>                   installed in a compiler-specific directory])])
> 
> @@ -132,7 +132,7 @@ index 23bee7010a3..36ce78924de 100644
>  AC_SUBST(subdirs)
>  AC_SUBST(srcdir)
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> -index 07b440190c3..b2de464798a 100644
> +index ff6c338be..a8ebfa59a 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}.
> @@ -159,10 +159,10 @@ index 07b440190c3..b2de464798a 100644
>  @opindex Wfloat-equal
>  @opindex Wno-float-equal
> diff --git a/gcc/gcc.cc b/gcc/gcc.cc
> -index bb07cc244e3..ce161d3c853 100644
> +index beefde7f6..4e6557b3c 100644
> --- a/gcc/gcc.cc
> +++ b/gcc/gcc.cc
> -@@ -1159,6 +1159,8 @@ proper position among the other output files.  */
> +@@ -1162,6 +1162,8 @@ proper position among the other output files.  */
>     "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
>     "%X %{o*} %{e*} %{N} %{n} %{r}\
>      %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
> @@ -171,7 +171,7 @@ index bb07cc244e3..ce161d3c853 100644
>      %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
>      VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
>      %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
> -@@ -1254,8 +1256,11 @@ static const char *cpp_unique_options =
> +@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options =
>  static const char *cpp_options =
>  "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
>   %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
> @@ -179,27 +179,27 @@ index bb07cc244e3..ce161d3c853 100644
> - %{undef} %{save-temps*:-fpch-preprocess}";
> + %{!fno-working-directory:-fworking-directory}}} %{O*}"
> +#ifdef POISON_BY_DEFAULT
> -+ " -Werror=poison-system-directories"
> ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
> +#endif
> + " %{undef} %{save-temps*:-fpch-preprocess}";
> 
>  /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
> 
> -@@ -1265,7 +1270,11 @@ static const char *cc1_options =
> +@@ -1287,7 +1292,11 @@ static const char *cc1_options =
>   %{coverage:-fprofile-arcs -ftest-coverage}\
>   %{fprofile-arcs|fprofile-generate*|coverage:\
>     %{!fprofile-update=single:\
> -     %{pthread:-fprofile-update=prefer-atomic}}}";
> +     %{pthread:-fprofile-update=prefer-atomic}}}"
> +#ifdef POISON_BY_DEFAULT
> -+ " -Werror=poison-system-directories"
> ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
> +#endif
> +  ;
> -
> + 
>  static const char *asm_options =
>  "%{-target-help:%:print-asm-header()} "
> diff --git a/gcc/incpath.cc b/gcc/incpath.cc
> -index bd2a97938eb..c80f100f476 100644
> +index 622204a38..5ac03c086 100644
> --- a/gcc/incpath.cc
> +++ b/gcc/incpath.cc
> @@ -26,6 +26,7 @@
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#171703): https://lists.openembedded.org/g/openembedded-core/message/171703
> Mute This Topic: https://lists.openembedded.org/mt/94303421/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Peter Kjellerstedt Oct. 13, 2022, 2:38 p.m. UTC | #2
> -----Original Message-----
> From: Ross Burton <Ross.Burton@arm.com>
> Sent: den 13 oktober 2022 16:05
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> Cc: Patches and discussions about the oe-core layer <openembedded-
> core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system-
> directories to take effect
> 
> Whilst this is a good fix, I’m horrified to ask why you need it…

We have a recipe for skia. Somewhere in that mess of a build 
system it uses (gn), something adds -I/usr/include/freetype2, 
which results in an error with -Werror=poison-system-directories 
enabled (as it should). Now, to work around that problem, the 
recipe currently adds -I=/usr/include/freetype2, which means we 
know that the correct path is used. However, since the original 
-I/usr/include/freetype2 is still in the list of options, the 
error still triggers.

Now, to fix the problem properly, skias's build files should be 
patched, but that is not my job. What I am working on is to get 
our recipes to build with Langdale. This means I can cut some 
corners and, e.g., disable errors and then hand off to the 
responsible team to fix the underlying problem at a time that 
suits them. Thus in this case I wanted to add 
-Wno-error=poison-system-directories for skia, which I then, to 
my surprise, noticed had no effect...

//Peter

> 
> Ross
> 
> > On 13 Oct 2022, at 14:29, Peter Kjellerstedt via lists.openembedded.org
> <peter.kjellerstedt=axis.com@lists.openembedded.org> wrote:
> >
> > The change in commit e903b29f (gcc-cross: pass
> > -Werror=poison-system-directories to compiler stages) made it impossible
> > to disable the error using -Wno-error=poison-system-directories.
> >
> > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > ---
> > .../0002-gcc-poison-system-directories.patch  | 36 +++++++++----------
> > 1 file changed, 18 insertions(+), 18 deletions(-)
> >
> > diff --git a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> directories.patch
> > index bfec4477c1..5aa635b3d4 100644
> > --- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> directories.patch
> > +++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> directories.patch
> > @@ -1,4 +1,4 @@
> > -From e1dbdcd0ea667bab4b551294354e04c6fe288ab6 Mon Sep 17 00:00:00 2001
> > +From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001
> > From: Khem Raj <raj.khem@gmail.com>
> > Date: Mon, 8 Mar 2021 16:04:20 -0800
> > Subject: [PATCH] gcc: poison-system-directories
> > @@ -20,12 +20,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >  gcc/configure       | 19 +++++++++++++++++++
> >  gcc/configure.ac    | 16 ++++++++++++++++
> >  gcc/doc/invoke.texi |  9 +++++++++
> > - gcc/gcc.cc          |  9 +++++++--
> > + gcc/gcc.cc          | 15 ++++++++++++---
> >  gcc/incpath.cc      | 21 +++++++++++++++++++++
> > - 7 files changed, 86 insertions(+), 2 deletions(-)
> > + 7 files changed, 91 insertions(+), 3 deletions(-)
> >
> > diff --git a/gcc/common.opt b/gcc/common.opt
> > -index 8a0dafc522d..0357868e22c 100644
> > +index 8a0dafc52..0357868e2 100644
> > --- a/gcc/common.opt
> > +++ b/gcc/common.opt
> > @@ -710,6 +710,10 @@ Wreturn-local-addr
> > @@ -40,7 +40,7 @@ index 8a0dafc522d..0357868e22c 100644
> >  Common Var(warn_shadow) Warning
> >  Warn when one variable shadows another.  Same as -Wshadow=global.
> > diff --git a/gcc/config.in b/gcc/config.in
> > -index 64c27c9cfac..a693cb8a886 100644
> > +index 64c27c9cf..a693cb8a8 100644
> > --- a/gcc/config.in
> > +++ b/gcc/config.in
> > @@ -230,6 +230,16 @@
> > @@ -61,7 +61,7 @@ index 64c27c9cfac..a693cb8a886 100644
> >     optimizer and back end) to be checked for dynamic type safety at
> runtime.
> >     This is quite expensive. */
> > diff --git a/gcc/configure b/gcc/configure
> > -index 5ce0557719a..dc2d59701ad 100755
> > +index 2b83acfb0..8bb97578c 100755
> > --- a/gcc/configure
> > +++ b/gcc/configure
> > @@ -1023,6 +1023,7 @@ enable_maintainer_mode
> > @@ -81,7 +81,7 @@ index 5ce0557719a..dc2d59701ad 100755
> >    --enable-plugin         enable plugin support
> >    --enable-host-shared    build host code as shared libraries
> >    --disable-libquadmath-support
> > -@@ -31982,6 +31985,22 @@ if test
> "${enable_version_specific_runtime_libs+set}" = set; then :
> > +@@ -31996,6 +31999,22 @@ if test
> "${enable_version_specific_runtime_libs+set}" = set; then :
> >  fi
> >
> >
> > @@ -105,10 +105,10 @@ index 5ce0557719a..dc2d59701ad 100755
> >
> >
> > diff --git a/gcc/configure.ac b/gcc/configure.ac
> > -index 23bee7010a3..36ce78924de 100644
> > +index daf2a708c..6155b83a7 100644
> > --- a/gcc/configure.ac
> > +++ b/gcc/configure.ac
> > -@@ -7421,6 +7421,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
> > +@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
> >                  [specify that runtime libraries should be
> >                   installed in a compiler-specific directory])])
> >
> > @@ -132,7 +132,7 @@ index 23bee7010a3..36ce78924de 100644
> >  AC_SUBST(subdirs)
> >  AC_SUBST(srcdir)
> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> > -index 07b440190c3..b2de464798a 100644
> > +index ff6c338be..a8ebfa59a 100644
> > --- a/gcc/doc/invoke.texi
> > +++ b/gcc/doc/invoke.texi
> > @@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}.
> > @@ -159,10 +159,10 @@ index 07b440190c3..b2de464798a 100644
> >  @opindex Wfloat-equal
> >  @opindex Wno-float-equal
> > diff --git a/gcc/gcc.cc b/gcc/gcc.cc
> > -index bb07cc244e3..ce161d3c853 100644
> > +index beefde7f6..4e6557b3c 100644
> > --- a/gcc/gcc.cc
> > +++ b/gcc/gcc.cc
> > -@@ -1159,6 +1159,8 @@ proper position among the other output files.  */
> > +@@ -1162,6 +1162,8 @@ proper position among the other output files.  */
> >     "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
> >     "%X %{o*} %{e*} %{N} %{n} %{r}\
> >      %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
> > @@ -171,7 +171,7 @@ index bb07cc244e3..ce161d3c853 100644
> >      %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
> >      VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
> >      %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
> > -@@ -1254,8 +1256,11 @@ static const char *cpp_unique_options =
> > +@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options =
> >  static const char *cpp_options =
> >  "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*}
> %{w}\
> >   %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
> > @@ -179,27 +179,27 @@ index bb07cc244e3..ce161d3c853 100644
> > - %{undef} %{save-temps*:-fpch-preprocess}";
> > + %{!fno-working-directory:-fworking-directory}}} %{O*}"
> > +#ifdef POISON_BY_DEFAULT
> > -+ " -Werror=poison-system-directories"
> > ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-
> directories}"
> > +#endif
> > + " %{undef} %{save-temps*:-fpch-preprocess}";
> >
> >  /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
> >
> > -@@ -1265,7 +1270,11 @@ static const char *cc1_options =
> > +@@ -1287,7 +1292,11 @@ static const char *cc1_options =
> >   %{coverage:-fprofile-arcs -ftest-coverage}\
> >   %{fprofile-arcs|fprofile-generate*|coverage:\
> >     %{!fprofile-update=single:\
> > -     %{pthread:-fprofile-update=prefer-atomic}}}";
> > +     %{pthread:-fprofile-update=prefer-atomic}}}"
> > +#ifdef POISON_BY_DEFAULT
> > -+ " -Werror=poison-system-directories"
> > ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-
> directories}"
> > +#endif
> > +  ;
> > -
> > +
> >  static const char *asm_options =
> >  "%{-target-help:%:print-asm-header()} "
> > diff --git a/gcc/incpath.cc b/gcc/incpath.cc
> > -index bd2a97938eb..c80f100f476 100644
> > +index 622204a38..5ac03c086 100644
> > --- a/gcc/incpath.cc
> > +++ b/gcc/incpath.cc
> > @@ -26,6 +26,7 @@
> >
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#171703):
> https://lists.openembedded.org/g/openembedded-core/message/171703
> > Mute This Topic: https://lists.openembedded.org/mt/94303421/6875888
> > Group Owner: openembedded-core+owner@lists.openembedded.org
> > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
> [ross.burton@arm.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Khem Raj Oct. 13, 2022, 3:41 p.m. UTC | #3
On Thu, Oct 13, 2022 at 7:38 AM Peter Kjellerstedt
<peter.kjellerstedt@axis.com> wrote:
>
> > -----Original Message-----
> > From: Ross Burton <Ross.Burton@arm.com>
> > Sent: den 13 oktober 2022 16:05
> > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > Cc: Patches and discussions about the oe-core layer <openembedded-
> > core@lists.openembedded.org>
> > Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system-
> > directories to take effect
> >
> > Whilst this is a good fix, I’m horrified to ask why you need it…
>
> We have a recipe for skia. Somewhere in that mess of a build
> system it uses (gn), something adds -I/usr/include/freetype2,
> which results in an error with -Werror=poison-system-directories
> enabled (as it should). Now, to work around that problem, the
> recipe currently adds -I=/usr/include/freetype2, which means we
> know that the correct path is used. However, since the original
> -I/usr/include/freetype2 is still in the list of options, the
> error still triggers.
>
> Now, to fix the problem properly, skias's build files should be
> patched, but that is not my job. What I am working on is to get
> our recipes to build with Langdale. This means I can cut some
> corners and, e.g., disable errors and then hand off to the
> responsible team to fix the underlying problem at a time that
> suits them. Thus in this case I wanted to add
> -Wno-error=poison-system-directories for skia, which I then, to
> my surprise, noticed had no effect...

from gcc recipe point of view, this fix is fine. however your use of
this seems to be a workaround that perhaps is better fixed in skia
because = syntax for sysroot works with gcc but may not work with
clang e.g. so you are being lucky here.

>
> //Peter
>
> >
> > Ross
> >
> > > On 13 Oct 2022, at 14:29, Peter Kjellerstedt via lists.openembedded.org
> > <peter.kjellerstedt=axis.com@lists.openembedded.org> wrote:
> > >
> > > The change in commit e903b29f (gcc-cross: pass
> > > -Werror=poison-system-directories to compiler stages) made it impossible
> > > to disable the error using -Wno-error=poison-system-directories.
> > >
> > > Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > > ---
> > > .../0002-gcc-poison-system-directories.patch  | 36 +++++++++----------
> > > 1 file changed, 18 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> > directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> > directories.patch
> > > index bfec4477c1..5aa635b3d4 100644
> > > --- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> > directories.patch
> > > +++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-
> > directories.patch
> > > @@ -1,4 +1,4 @@
> > > -From e1dbdcd0ea667bab4b551294354e04c6fe288ab6 Mon Sep 17 00:00:00 2001
> > > +From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001
> > > From: Khem Raj <raj.khem@gmail.com>
> > > Date: Mon, 8 Mar 2021 16:04:20 -0800
> > > Subject: [PATCH] gcc: poison-system-directories
> > > @@ -20,12 +20,12 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > >  gcc/configure       | 19 +++++++++++++++++++
> > >  gcc/configure.ac    | 16 ++++++++++++++++
> > >  gcc/doc/invoke.texi |  9 +++++++++
> > > - gcc/gcc.cc          |  9 +++++++--
> > > + gcc/gcc.cc          | 15 ++++++++++++---
> > >  gcc/incpath.cc      | 21 +++++++++++++++++++++
> > > - 7 files changed, 86 insertions(+), 2 deletions(-)
> > > + 7 files changed, 91 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/gcc/common.opt b/gcc/common.opt
> > > -index 8a0dafc522d..0357868e22c 100644
> > > +index 8a0dafc52..0357868e2 100644
> > > --- a/gcc/common.opt
> > > +++ b/gcc/common.opt
> > > @@ -710,6 +710,10 @@ Wreturn-local-addr
> > > @@ -40,7 +40,7 @@ index 8a0dafc522d..0357868e22c 100644
> > >  Common Var(warn_shadow) Warning
> > >  Warn when one variable shadows another.  Same as -Wshadow=global.
> > > diff --git a/gcc/config.in b/gcc/config.in
> > > -index 64c27c9cfac..a693cb8a886 100644
> > > +index 64c27c9cf..a693cb8a8 100644
> > > --- a/gcc/config.in
> > > +++ b/gcc/config.in
> > > @@ -230,6 +230,16 @@
> > > @@ -61,7 +61,7 @@ index 64c27c9cfac..a693cb8a886 100644
> > >     optimizer and back end) to be checked for dynamic type safety at
> > runtime.
> > >     This is quite expensive. */
> > > diff --git a/gcc/configure b/gcc/configure
> > > -index 5ce0557719a..dc2d59701ad 100755
> > > +index 2b83acfb0..8bb97578c 100755
> > > --- a/gcc/configure
> > > +++ b/gcc/configure
> > > @@ -1023,6 +1023,7 @@ enable_maintainer_mode
> > > @@ -81,7 +81,7 @@ index 5ce0557719a..dc2d59701ad 100755
> > >    --enable-plugin         enable plugin support
> > >    --enable-host-shared    build host code as shared libraries
> > >    --disable-libquadmath-support
> > > -@@ -31982,6 +31985,22 @@ if test
> > "${enable_version_specific_runtime_libs+set}" = set; then :
> > > +@@ -31996,6 +31999,22 @@ if test
> > "${enable_version_specific_runtime_libs+set}" = set; then :
> > >  fi
> > >
> > >
> > > @@ -105,10 +105,10 @@ index 5ce0557719a..dc2d59701ad 100755
> > >
> > >
> > > diff --git a/gcc/configure.ac b/gcc/configure.ac
> > > -index 23bee7010a3..36ce78924de 100644
> > > +index daf2a708c..6155b83a7 100644
> > > --- a/gcc/configure.ac
> > > +++ b/gcc/configure.ac
> > > -@@ -7421,6 +7421,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
> > > +@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
> > >                  [specify that runtime libraries should be
> > >                   installed in a compiler-specific directory])])
> > >
> > > @@ -132,7 +132,7 @@ index 23bee7010a3..36ce78924de 100644
> > >  AC_SUBST(subdirs)
> > >  AC_SUBST(srcdir)
> > > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> > > -index 07b440190c3..b2de464798a 100644
> > > +index ff6c338be..a8ebfa59a 100644
> > > --- a/gcc/doc/invoke.texi
> > > +++ b/gcc/doc/invoke.texi
> > > @@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}.
> > > @@ -159,10 +159,10 @@ index 07b440190c3..b2de464798a 100644
> > >  @opindex Wfloat-equal
> > >  @opindex Wno-float-equal
> > > diff --git a/gcc/gcc.cc b/gcc/gcc.cc
> > > -index bb07cc244e3..ce161d3c853 100644
> > > +index beefde7f6..4e6557b3c 100644
> > > --- a/gcc/gcc.cc
> > > +++ b/gcc/gcc.cc
> > > -@@ -1159,6 +1159,8 @@ proper position among the other output files.  */
> > > +@@ -1162,6 +1162,8 @@ proper position among the other output files.  */
> > >     "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
> > >     "%X %{o*} %{e*} %{N} %{n} %{r}\
> > >      %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
> > > @@ -171,7 +171,7 @@ index bb07cc244e3..ce161d3c853 100644
> > >      %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
> > >      VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
> > >      %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
> > > -@@ -1254,8 +1256,11 @@ static const char *cpp_unique_options =
> > > +@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options =
> > >  static const char *cpp_options =
> > >  "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*}
> > %{w}\
> > >   %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
> > > @@ -179,27 +179,27 @@ index bb07cc244e3..ce161d3c853 100644
> > > - %{undef} %{save-temps*:-fpch-preprocess}";
> > > + %{!fno-working-directory:-fworking-directory}}} %{O*}"
> > > +#ifdef POISON_BY_DEFAULT
> > > -+ " -Werror=poison-system-directories"
> > > ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-
> > directories}"
> > > +#endif
> > > + " %{undef} %{save-temps*:-fpch-preprocess}";
> > >
> > >  /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
> > >
> > > -@@ -1265,7 +1270,11 @@ static const char *cc1_options =
> > > +@@ -1287,7 +1292,11 @@ static const char *cc1_options =
> > >   %{coverage:-fprofile-arcs -ftest-coverage}\
> > >   %{fprofile-arcs|fprofile-generate*|coverage:\
> > >     %{!fprofile-update=single:\
> > > -     %{pthread:-fprofile-update=prefer-atomic}}}";
> > > +     %{pthread:-fprofile-update=prefer-atomic}}}"
> > > +#ifdef POISON_BY_DEFAULT
> > > -+ " -Werror=poison-system-directories"
> > > ++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-
> > directories}"
> > > +#endif
> > > +  ;
> > > -
> > > +
> > >  static const char *asm_options =
> > >  "%{-target-help:%:print-asm-header()} "
> > > diff --git a/gcc/incpath.cc b/gcc/incpath.cc
> > > -index bd2a97938eb..c80f100f476 100644
> > > +index 622204a38..5ac03c086 100644
> > > --- a/gcc/incpath.cc
> > > +++ b/gcc/incpath.cc
> > > @@ -26,6 +26,7 @@
> > >
> > >
> > >
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#171706): https://lists.openembedded.org/g/openembedded-core/message/171706
> Mute This Topic: https://lists.openembedded.org/mt/94303421/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Peter Kjellerstedt Oct. 13, 2022, 9:21 p.m. UTC | #4
> -----Original Message-----
> From: Khem Raj <raj.khem@gmail.com>
> Sent: den 13 oktober 2022 17:41
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> Cc: Ross Burton <Ross.Burton@arm.com>; Patches and discussions about the
> oe-core layer <openembedded-core@lists.openembedded.org>
> Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system-
> directories to take effect
> 
> On Thu, Oct 13, 2022 at 7:38 AM Peter Kjellerstedt <peter.kjellerstedt@axis.com> wrote:
> >
> > > -----Original Message-----
> > > From: Ross Burton <Ross.Burton@arm.com>
> > > Sent: den 13 oktober 2022 16:05
> > > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > > Cc: Patches and discussions about the oe-core layer <openembedded-
> > > core@lists.openembedded.org>
> > > Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system-
> > > directories to take effect
> > >
> > > Whilst this is a good fix, I’m horrified to ask why you need it…
> >
> > We have a recipe for skia. Somewhere in that mess of a build
> > system it uses (gn), something adds -I/usr/include/freetype2,
> > which results in an error with -Werror=poison-system-directories
> > enabled (as it should). Now, to work around that problem, the
> > recipe currently adds -I=/usr/include/freetype2, which means we
> > know that the correct path is used. However, since the original
> > -I/usr/include/freetype2 is still in the list of options, the
> > error still triggers.
> >
> > Now, to fix the problem properly, skias's build files should be
> > patched, but that is not my job. What I am working on is to get
> > our recipes to build with Langdale. This means I can cut some
> > corners and, e.g., disable errors and then hand off to the
> > responsible team to fix the underlying problem at a time that
> > suits them. Thus in this case I wanted to add
> > -Wno-error=poison-system-directories for skia, which I then, to
> > my surprise, noticed had no effect...
> 
> from gcc recipe point of view, this fix is fine. however your use of
> this seems to be a workaround that perhaps is better fixed in skia

Oh, I'm well aware of that. As I said, my job at this stage is to get 
everything building with Langdale. And to achieve that, it is perfectly 
fine for me to, e.g., disable compiler errors. Once the platform 
builds, the respective code owners have the responsibility to actually 
correct their code to not generate the errors in the first place.

> because = syntax for sysroot works with gcc but may not work with
> clang e.g. so you are being lucky here.

We don't use clang so that is not a problem for us.

> > //Peter
> >
> > > Ross

//Peter
Khem Raj Oct. 13, 2022, 10:40 p.m. UTC | #5
On Thu, Oct 13, 2022 at 2:21 PM Peter Kjellerstedt
<peter.kjellerstedt@axis.com> wrote:
>
> > -----Original Message-----
> > From: Khem Raj <raj.khem@gmail.com>
> > Sent: den 13 oktober 2022 17:41
> > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > Cc: Ross Burton <Ross.Burton@arm.com>; Patches and discussions about the
> > oe-core layer <openembedded-core@lists.openembedded.org>
> > Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system-
> > directories to take effect
> >
> > On Thu, Oct 13, 2022 at 7:38 AM Peter Kjellerstedt <peter.kjellerstedt@axis.com> wrote:
> > >
> > > > -----Original Message-----
> > > > From: Ross Burton <Ross.Burton@arm.com>
> > > > Sent: den 13 oktober 2022 16:05
> > > > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
> > > > Cc: Patches and discussions about the oe-core layer <openembedded-
> > > > core@lists.openembedded.org>
> > > > Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system-
> > > > directories to take effect
> > > >
> > > > Whilst this is a good fix, I’m horrified to ask why you need it…
> > >
> > > We have a recipe for skia. Somewhere in that mess of a build
> > > system it uses (gn), something adds -I/usr/include/freetype2,
> > > which results in an error with -Werror=poison-system-directories
> > > enabled (as it should). Now, to work around that problem, the
> > > recipe currently adds -I=/usr/include/freetype2, which means we
> > > know that the correct path is used. However, since the original
> > > -I/usr/include/freetype2 is still in the list of options, the
> > > error still triggers.
> > >
> > > Now, to fix the problem properly, skias's build files should be
> > > patched, but that is not my job. What I am working on is to get
> > > our recipes to build with Langdale. This means I can cut some
> > > corners and, e.g., disable errors and then hand off to the
> > > responsible team to fix the underlying problem at a time that
> > > suits them. Thus in this case I wanted to add
> > > -Wno-error=poison-system-directories for skia, which I then, to
> > > my surprise, noticed had no effect...
> >
> > from gcc recipe point of view, this fix is fine. however your use of
> > this seems to be a workaround that perhaps is better fixed in skia
>
> Oh, I'm well aware of that. As I said, my job at this stage is to get
> everything building with Langdale. And to achieve that, it is perfectly
> fine for me to, e.g., disable compiler errors. Once the platform
> builds, the respective code owners have the responsibility to actually
> correct their code to not generate the errors in the first place.

I hope you will inform the responsible and ask them to fix the problem.

>
> > because = syntax for sysroot works with gcc but may not work with
> > clang e.g. so you are being lucky here.
>
> We don't use clang so that is not a problem for us.
>
> > > //Peter
> > >
> > > > Ross
>
> //Peter
>
diff mbox series

Patch

diff --git a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
index bfec4477c1..5aa635b3d4 100644
--- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
+++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch
@@ -1,4 +1,4 @@ 
-From e1dbdcd0ea667bab4b551294354e04c6fe288ab6 Mon Sep 17 00:00:00 2001
+From 99f1e61b2957226254a116fde7fd73bf07034012 Mon Sep 17 00:00:00 2001
 From: Khem Raj <raj.khem@gmail.com>
 Date: Mon, 8 Mar 2021 16:04:20 -0800
 Subject: [PATCH] gcc: poison-system-directories
@@ -20,12 +20,12 @@  Signed-off-by: Khem Raj <raj.khem@gmail.com>
  gcc/configure       | 19 +++++++++++++++++++
  gcc/configure.ac    | 16 ++++++++++++++++
  gcc/doc/invoke.texi |  9 +++++++++
- gcc/gcc.cc          |  9 +++++++--
+ gcc/gcc.cc          | 15 ++++++++++++---
  gcc/incpath.cc      | 21 +++++++++++++++++++++
- 7 files changed, 86 insertions(+), 2 deletions(-)
+ 7 files changed, 91 insertions(+), 3 deletions(-)
 
 diff --git a/gcc/common.opt b/gcc/common.opt
-index 8a0dafc522d..0357868e22c 100644
+index 8a0dafc52..0357868e2 100644
 --- a/gcc/common.opt
 +++ b/gcc/common.opt
 @@ -710,6 +710,10 @@ Wreturn-local-addr
@@ -40,7 +40,7 @@  index 8a0dafc522d..0357868e22c 100644
  Common Var(warn_shadow) Warning
  Warn when one variable shadows another.  Same as -Wshadow=global.
 diff --git a/gcc/config.in b/gcc/config.in
-index 64c27c9cfac..a693cb8a886 100644
+index 64c27c9cf..a693cb8a8 100644
 --- a/gcc/config.in
 +++ b/gcc/config.in
 @@ -230,6 +230,16 @@
@@ -61,7 +61,7 @@  index 64c27c9cfac..a693cb8a886 100644
     optimizer and back end) to be checked for dynamic type safety at runtime.
     This is quite expensive. */
 diff --git a/gcc/configure b/gcc/configure
-index 5ce0557719a..dc2d59701ad 100755
+index 2b83acfb0..8bb97578c 100755
 --- a/gcc/configure
 +++ b/gcc/configure
 @@ -1023,6 +1023,7 @@ enable_maintainer_mode
@@ -81,7 +81,7 @@  index 5ce0557719a..dc2d59701ad 100755
    --enable-plugin         enable plugin support
    --enable-host-shared    build host code as shared libraries
    --disable-libquadmath-support
-@@ -31982,6 +31985,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
+@@ -31996,6 +31999,22 @@ if test "${enable_version_specific_runtime_libs+set}" = set; then :
  fi
  
  
@@ -105,10 +105,10 @@  index 5ce0557719a..dc2d59701ad 100755
  
  
 diff --git a/gcc/configure.ac b/gcc/configure.ac
-index 23bee7010a3..36ce78924de 100644
+index daf2a708c..6155b83a7 100644
 --- a/gcc/configure.ac
 +++ b/gcc/configure.ac
-@@ -7421,6 +7421,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
+@@ -7435,6 +7435,22 @@ AC_ARG_ENABLE(version-specific-runtime-libs,
                  [specify that runtime libraries should be
                   installed in a compiler-specific directory])])
  
@@ -132,7 +132,7 @@  index 23bee7010a3..36ce78924de 100644
  AC_SUBST(subdirs)
  AC_SUBST(srcdir)
 diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
-index 07b440190c3..b2de464798a 100644
+index ff6c338be..a8ebfa59a 100644
 --- a/gcc/doc/invoke.texi
 +++ b/gcc/doc/invoke.texi
 @@ -379,6 +379,7 @@ Objective-C and Objective-C++ Dialects}.
@@ -159,10 +159,10 @@  index 07b440190c3..b2de464798a 100644
  @opindex Wfloat-equal
  @opindex Wno-float-equal
 diff --git a/gcc/gcc.cc b/gcc/gcc.cc
-index bb07cc244e3..ce161d3c853 100644
+index beefde7f6..4e6557b3c 100644
 --- a/gcc/gcc.cc
 +++ b/gcc/gcc.cc
-@@ -1159,6 +1159,8 @@ proper position among the other output files.  */
+@@ -1162,6 +1162,8 @@ proper position among the other output files.  */
     "%{fuse-ld=*:-fuse-ld=%*} " LINK_COMPRESS_DEBUG_SPEC \
     "%X %{o*} %{e*} %{N} %{n} %{r}\
      %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!r:%{!nostartfiles:%S}}} \
@@ -171,7 +171,7 @@  index bb07cc244e3..ce161d3c853 100644
      %{static|no-pie|static-pie:} %@{L*} %(mfwrap) %(link_libgcc) " \
      VTABLE_VERIFICATION_SPEC " " SANITIZER_EARLY_SPEC " %o "" \
      %{fopenacc|fopenmp|%:gt(%{ftree-parallelize-loops=*:%*} 1):\
-@@ -1254,8 +1256,11 @@ static const char *cpp_unique_options =
+@@ -1257,8 +1259,11 @@ static const char *cpp_unique_options =
  static const char *cpp_options =
  "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
   %{f*} %{g*:%{%:debug-level-gt(0):%{g*}\
@@ -179,27 +179,27 @@  index bb07cc244e3..ce161d3c853 100644
 - %{undef} %{save-temps*:-fpch-preprocess}";
 + %{!fno-working-directory:-fworking-directory}}} %{O*}"
 +#ifdef POISON_BY_DEFAULT
-+ " -Werror=poison-system-directories"
++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
 +#endif
 + " %{undef} %{save-temps*:-fpch-preprocess}";
  
  /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
  
-@@ -1265,7 +1270,11 @@ static const char *cc1_options =
+@@ -1287,7 +1292,11 @@ static const char *cc1_options =
   %{coverage:-fprofile-arcs -ftest-coverage}\
   %{fprofile-arcs|fprofile-generate*|coverage:\
     %{!fprofile-update=single:\
 -     %{pthread:-fprofile-update=prefer-atomic}}}";
 +     %{pthread:-fprofile-update=prefer-atomic}}}"
 +#ifdef POISON_BY_DEFAULT
-+ " -Werror=poison-system-directories"
++ " %{!Wno-error=poison-system-directories:-Werror=poison-system-directories}"
 +#endif
 +  ;
-
+ 
  static const char *asm_options =
  "%{-target-help:%:print-asm-header()} "
 diff --git a/gcc/incpath.cc b/gcc/incpath.cc
-index bd2a97938eb..c80f100f476 100644
+index 622204a38..5ac03c086 100644
 --- a/gcc/incpath.cc
 +++ b/gcc/incpath.cc
 @@ -26,6 +26,7 @@