From fbe9786fdd6dafaf3de346783cce2678972605d0 Mon Sep 17 00:00:00 2001 From: Lubosz Sarnecki Date: Sat, 4 Oct 2025 08:44:37 +0200 Subject: [PATCH] build.sh: Don't use -Werror as default. While being a good practice to use during development, enabling -Werror by default for deployment and user builds is a guarantee for failed builds. It is not feasible for development to keep up with all warnings in all compiler versions, especially ones from the future. To avoid the build being broken, this patch sets -Werror being disabled as default behavior. This mimics the behavior of CMake being invoked directly without the build.sh script. While a zero warning policy is good, and -Werror should also be enabled by default on the CI, it is a bad practice for deployment. https://embeddedartistry.com/blog/2017/05/22/werror-is-not-your-friend/ --- build/build.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/build.sh b/build/build.sh index 952833dc1e4..0894dc20141 100755 --- a/build/build.sh +++ b/build/build.sh @@ -57,7 +57,7 @@ usage() echo "[-opt] Build optimized library only (default)" echo "[-edge] Build edge of x64. Turns off opt and dbg" echo "[-hip] Enable hip bindings" - echo "[-disable-werror] Disable compilation with warnings as error" + echo "[-enable-werror] Enable compilation with warnings as error" echo "[-nocmake] Skip CMake call" echo "[-noert] Do not treat missing ERT FW as a build error" echo "[-noinit] Do not initialize Git submodules" @@ -111,7 +111,7 @@ noert=0 static_boost="" ertbsp="" ertfw="" -werror=1 +werror=0 alveo_build=0 npu_build=0 base_build=0 @@ -194,8 +194,8 @@ while [ $# -gt 0 ]; do noctest=1 shift ;; - -disable-werror|--disable-werror) - werror=0 + -enable-werror|--enable-werror) + werror=1 shift ;; -j) @@ -274,9 +274,9 @@ fi debug_dir=${DEBUG_DIR:-Debug} release_dir=${REL_DIR:-Release} -# By default compile with warnings as errors. +# By default compile without warnings as errors. # Update every time CMake is generating makefiles. -# Disable with '-disable-werror' option. +# Enable with '-enable-werror' option. cmake_flags+=" -DXRT_ENABLE_WERROR=$werror" # set CMAKE_INSTALL_PREFIX