Skip to contentSkip to conversation

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

PATCH In review Peter Kjellerstedt 4 participants 6 messages Oct 13, 2022

lore
Share & tools
lore
#0 lore raw

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

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.

---
 .../0002-gcc-poison-system-directories.patch  | 36 +++++++++----------
 1 file changed, 18 insertions(+), 18 deletions(-)
meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +18 -18
index bfec4477c1..5aa635b3d4 100644
@@ -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 <[email protected]>
 Date: Mon, 8 Mar 2021 16:04:20 -0800
 Subject: [PATCH] gcc: poison-system-directories
@@ -20,12 +20,12 @@ Signed-off-by: Khem Raj <[email protected]>
  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 @@
#1 lore raw

Whilst this is a good fix, I’m horrified to ask why you need it…

Ross

Quoted 150 lines · Peter Kjellerstedt via lists.openembedded.org

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.

---
.../0002-gcc-poison-system-directories.patch | 36 +++++++++----------

1 file changed, 18 insertions(+), 18 deletions(-)
meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +1 -1
index bfec4477c1..5aa635b3d4 100644
@@ -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 <[email protected]>
Date: Mon, 8 Mar 2021 16:04:20 -0800
Subject: [PATCH] gcc: poison-system-directories

meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +2 -2
@@ -20,12 +20,12 @@ Signed-off-by: Khem Raj <[email protected]>
 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(-)
 
gcc/common.opt +1 -1
-index 8a0dafc522d..0357868e22c 100644
+index 8a0dafc52..0357868e2 100644
gcc/common.opt +0 -0
@@ -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.
gcc/config.in +1 -1
-index 64c27c9cfac..a693cb8a886 100644
+index 64c27c9cf..a693cb8a8 100644
gcc/config.in +0 -0
@@ -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. */
gcc/configure +1 -1
-index 5ce0557719a..dc2d59701ad 100755
+index 2b83acfb0..8bb97578c 100755
gcc/configure +1 -1
@@ -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
 
 
gcc/configure.ac +1 -1
-index 23bee7010a3..36ce78924de 100644
+index daf2a708c..6155b83a7 100644
gcc/configure.ac +1 -1
-@@ -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)
gcc/doc/invoke.texi +1 -1
-index 07b440190c3..b2de464798a 100644
+index ff6c338be..a8ebfa59a 100644
gcc/doc/invoke.texi +0 -0
@@ -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
gcc/gcc.cc +1 -1
-index bb07cc244e3..ce161d3c853 100644
+index beefde7f6..4e6557b3c 100644
gcc/gcc.cc +14 -8
-@@ -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()} "
gcc/incpath.cc +1 -1
-index bd2a97938eb..c80f100f476 100644
+index 622204a38..5ac03c086 100644
gcc/incpath.cc +0 -1
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw
Quoted 10 lines

-----Original Message-----
From: Ross Burton <[email protected]>
Sent: den 13 oktober 2022 16:05
To: Peter Kjellerstedt <[email protected]>
Cc: Patches and discussions about the oe-core layer <openembedded- [email protected]>
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

Quoted 166 lines

Ross

Quoted 1 line

On 13 Oct 2022, at 14:29, Peter Kjellerstedt via lists.openembedded.org

Review

Quoted 11 lines · <[email protected]> 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.

---
.../0002-gcc-poison-system-directories.patch | 36 +++++++++----------

1 file changed, 18 insertions(+), 18 deletions(-)
(quoted diff) +0 -0

directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system- directories.patch

Quoted 2 lines

index bfec4477c1..5aa635b3d4 100644
--- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-

directories.patch

Quoted 1 line

+++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-

directories.patch

Quoted 32 lines
meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +1 -1
@@ -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 <[email protected]>
Date: Mon, 8 Mar 2021 16:04:20 -0800
Subject: [PATCH] gcc: poison-system-directories

meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +2 -2
@@ -20,12 +20,12 @@ Signed-off-by: Khem Raj <[email protected]>
 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(-)
 
gcc/common.opt +1 -1
-index 8a0dafc522d..0357868e22c 100644
+index 8a0dafc52..0357868e2 100644
gcc/common.opt +0 -0
@@ -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.
gcc/config.in +1 -1
-index 64c27c9cfac..a693cb8a886 100644
+index 64c27c9cf..a693cb8a8 100644
gcc/config.in +0 -0
@@ -230,6 +230,16 @@

gcc/config.in index 64c27c9cfac..a693cb8a886 100644 · line 61

Quoted 1 line
gcc/config.in +0 -0
@@ -61,7 +61,7 @@ index 64c27c9cfac..a693cb8a886 100644
    optimizer and back end) to be checked for dynamic type safety at

runtime.

gcc/configure index 5ce0557719a..dc2d59701ad 100755 · line 84

Quoted 12 lines
gcc/config.in +0 -0
    This is quite expensive. */
gcc/configure +1 -1
-index 5ce0557719a..dc2d59701ad 100755
+index 2b83acfb0..8bb97578c 100755
gcc/configure +0 -1
@@ -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 :

gcc/configure index 5ce0557719a..dc2d59701ad 100755 · line 84

Quoted 1 line
gcc/configure +1 -0
+@@ -31996,6 +31999,22 @@ if test

"${enable_version_specific_runtime_libs+set}" = set; then :

Quoted 39 lines
gcc/configure +0 -0
 fi
 
 
@@ -105,10 +105,10 @@ index 5ce0557719a..dc2d59701ad 100755
 
 
gcc/configure.ac +1 -1
-index 23bee7010a3..36ce78924de 100644
+index daf2a708c..6155b83a7 100644
gcc/configure.ac +1 -1
-@@ -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)
gcc/doc/invoke.texi +1 -1
-index 07b440190c3..b2de464798a 100644
+index ff6c338be..a8ebfa59a 100644
gcc/doc/invoke.texi +0 -0
@@ -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
gcc/gcc.cc +1 -1
-index bb07cc244e3..ce161d3c853 100644
+index beefde7f6..4e6557b3c 100644
gcc/gcc.cc +1 -1
-@@ -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}}} \

gcc/gcc.cc index bb07cc244e3..ce161d3c853 100644 · line 176

Quoted 7 lines
gcc/gcc.cc +1 -1
@@ -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}\

gcc/gcc.cc index bb07cc244e3..ce161d3c853 100644 · line 181

Quoted 7 lines
gcc/gcc.cc +3 -2
  %{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}"

Quoted 5 lines
gcc/gcc.cc +2 -0
+#endif
+ " %{undef} %{save-temps*:-fpch-preprocess}";
 
 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
 

gcc/gcc.cc index bb07cc244e3..ce161d3c853 100644 · line 193

Quoted 10 lines
gcc/gcc.cc +4 -3
-@@ -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}"

Quoted 14 lines
gcc/gcc.cc +3 -1
+#endif
+  ;
-
+
 static const char *asm_options =
 "%{-target-help:%:print-asm-header()} "
gcc/incpath.cc +1 -1
-index bd2a97938eb..c80f100f476 100644
+index 622204a38..5ac03c086 100644
gcc/incpath.cc +0 -1
@@ -26,6 +26,7 @@
 
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 2 lines

Links: You receive all messages sent to this group. View/Reply Online (#171703):

https://lists.openembedded.org/g/openembedded-core/message/171703

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/94303421/6875888
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub

[[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
Quoted 21 lines · Peter Kjellerstedt
Quoted 11 lines

-----Original Message-----
From: Ross Burton <[email protected]>
Sent: den 13 oktober 2022 16:05
To: Peter Kjellerstedt <[email protected]>
Cc: Patches and discussions about the oe-core layer <openembedded- [email protected]>
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.

Quoted 8 lines

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.

Quoted 171 lines

//Peter

Quoted 143 lines

Ross

Quoted 1 line

On 13 Oct 2022, at 14:29, Peter Kjellerstedt via lists.openembedded.org

Review

Quoted 11 lines · <[email protected]> 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.

---
.../0002-gcc-poison-system-directories.patch | 36 +++++++++----------

1 file changed, 18 insertions(+), 18 deletions(-)
(quoted diff) +0 -0

directories.patch b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system- directories.patch

Quoted 2 lines

index bfec4477c1..5aa635b3d4 100644
--- a/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-

directories.patch

Quoted 1 line

+++ b/meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-

directories.patch

Quoted 32 lines
meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +1 -1
@@ -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 <[email protected]>
Date: Mon, 8 Mar 2021 16:04:20 -0800
Subject: [PATCH] gcc: poison-system-directories

meta/recipes-devtools/gcc/gcc/0002-gcc-poison-system-directories.patch +2 -2
@@ -20,12 +20,12 @@ Signed-off-by: Khem Raj <[email protected]>
 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(-)
 
gcc/common.opt +1 -1
-index 8a0dafc522d..0357868e22c 100644
+index 8a0dafc52..0357868e2 100644
gcc/common.opt +0 -0
@@ -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.
gcc/config.in +1 -1
-index 64c27c9cfac..a693cb8a886 100644
+index 64c27c9cf..a693cb8a8 100644
gcc/config.in +0 -0
@@ -230,6 +230,16 @@

gcc/config.in index 64c27c9cfac..a693cb8a886 100644 · line 61

Quoted 1 line
gcc/config.in +0 -0
@@ -61,7 +61,7 @@ index 64c27c9cfac..a693cb8a886 100644
    optimizer and back end) to be checked for dynamic type safety at

runtime.

gcc/configure index 5ce0557719a..dc2d59701ad 100755 · line 84

Quoted 12 lines
gcc/config.in +0 -0
    This is quite expensive. */
gcc/configure +1 -1
-index 5ce0557719a..dc2d59701ad 100755
+index 2b83acfb0..8bb97578c 100755
gcc/configure +0 -1
@@ -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 :

gcc/configure index 5ce0557719a..dc2d59701ad 100755 · line 84

Quoted 1 line
gcc/configure +1 -0
+@@ -31996,6 +31999,22 @@ if test

"${enable_version_specific_runtime_libs+set}" = set; then :

Quoted 39 lines
gcc/configure +0 -0
 fi
 
 
@@ -105,10 +105,10 @@ index 5ce0557719a..dc2d59701ad 100755
 
 
gcc/configure.ac +1 -1
-index 23bee7010a3..36ce78924de 100644
+index daf2a708c..6155b83a7 100644
gcc/configure.ac +1 -1
-@@ -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)
gcc/doc/invoke.texi +1 -1
-index 07b440190c3..b2de464798a 100644
+index ff6c338be..a8ebfa59a 100644
gcc/doc/invoke.texi +0 -0
@@ -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
gcc/gcc.cc +1 -1
-index bb07cc244e3..ce161d3c853 100644
+index beefde7f6..4e6557b3c 100644
gcc/gcc.cc +1 -1
-@@ -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}}} \

gcc/gcc.cc index bb07cc244e3..ce161d3c853 100644 · line 176

Quoted 7 lines
gcc/gcc.cc +1 -1
@@ -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}\

gcc/gcc.cc index bb07cc244e3..ce161d3c853 100644 · line 181

Quoted 7 lines
gcc/gcc.cc +3 -2
  %{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}"

Quoted 5 lines
gcc/gcc.cc +2 -0
+#endif
+ " %{undef} %{save-temps*:-fpch-preprocess}";
 
 /* Pass -d* flags, possibly modifying -dumpdir, -dumpbase et al.
 

gcc/gcc.cc index bb07cc244e3..ce161d3c853 100644 · line 193

Quoted 10 lines
gcc/gcc.cc +4 -3
-@@ -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}"

Quoted 15 lines
Quoted 12 lines
gcc/gcc.cc +3 -1
+#endif
+  ;
-
+
 static const char *asm_options =
 "%{-target-help:%:print-asm-header()} "
gcc/incpath.cc +1 -1
-index bd2a97938eb..c80f100f476 100644
+index 622204a38..5ac03c086 100644

gcc/incpath.cc line 28

Quoted 3 lines
gcc/incpath.cc +0 -0
@@ -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: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
Quoted 31 lines

-----Original Message-----
From: Khem Raj <[email protected]>
Sent: den 13 oktober 2022 17:41
To: Peter Kjellerstedt <[email protected]>
Cc: Ross Burton <[email protected]>; Patches and discussions about the oe-core layer <[email protected]>
Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system- directories to take effect

Quoted 21 lines · Peter Kjellerstedt
Quoted 11 lines

-----Original Message-----
From: Ross Burton <[email protected]>
Sent: den 13 oktober 2022 16:05
To: Peter Kjellerstedt <[email protected]>
Cc: Patches and discussions about the oe-core layer <openembedded- [email protected]>
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.

Quoted 11 lines
Quoted 8 lines

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.

Quoted 2 lines

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.

Quoted 3 lines
Quoted 3 lines

//Peter

Quoted 1 line

Ross

//Peter

#5 lore raw
Quoted 44 lines · Peter Kjellerstedt
Quoted 32 lines

-----Original Message-----
From: Khem Raj <[email protected]>
Sent: den 13 oktober 2022 17:41
To: Peter Kjellerstedt <[email protected]>
Cc: Ross Burton <[email protected]>; Patches and discussions about the oe-core layer <[email protected]>
Subject: Re: [OE-core] [PATCH] gcc: Allow -Wno-error=poison-system- directories to take effect

Quoted 21 lines · Peter Kjellerstedt
Quoted 11 lines

-----Original Message-----
From: Ross Burton <[email protected]>
Sent: den 13 oktober 2022 16:05
To: Peter Kjellerstedt <[email protected]>
Cc: Patches and discussions about the oe-core layer <openembedded- [email protected]>
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.

Quoted 11 lines
Quoted 8 lines

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

Quoted 5 lines

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.

Quoted 12 lines
Quoted 3 lines

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.

Quoted 3 lines
Quoted 3 lines

//Peter

Quoted 1 line

Ross

//Peter