[libcamera-devel] [PATCH] meson: Don't set _FORTIFY_SOURCE for ChromeOS

George Burgess IV gbiv at google.com
Thu Sep 7 18:12:59 CEST 2023


ChromeOS is moving to a platform default of `_FORTIFY_SOURCE=3`, and
this definition conflicts with that:

```
<command line>:4:9: error: '_FORTIFY_SOURCE' macro redefined
[-Werror,-Wmacro-redefined]
```

Rather than adding logic to keep up with their local configuration, it
seems best to leave setting _FORTIFY_SOURCE on ChromeOS up to ChromeOS.

Signed-off-by: George Burgess IV <gbiv at google.com>
---
 meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 7959b538..109923ac 100644
--- a/meson.build
+++ b/meson.build
@@ -101,7 +101,8 @@ if cc.get_id() == 'clang'
 
     # Turn _FORTIFY_SOURCE by default on optimised builds (as it requires -O1
     # or higher). This is needed on clang only as gcc enables it by default.
-    if get_option('optimization') != '0'
+    # CrOS sets their preferred FORTIFY level in platform-level CFLAGS.
+    if get_option('optimization') != '0' and get_option('android_platform') != 'cros'
         common_arguments += [
             '-D_FORTIFY_SOURCE=2',
         ]
-- 
2.42.0.283.g2d96d420d3-goog



More information about the libcamera-devel mailing list