We are trying to build a TensorFlow test case with debug flag:

> 
> bazel build -c dbg
>  //tensorflow/python/kernel\_tests:sparse\_matmul\_op\_test
> 
> 
> 

However the build is failing with below error:

> 
> /usr/include/features.h:330:4: error: #warning \_FORTIFY\_SOURCE
>  requires compiling with optimization (-O) [-Werror=cpp]  
> 
>  warning \_FORTIFY\_SOURCE requires compiling with optimization (-O)
> 
> 
> cc1: all warnings being treated as errors
> 
> 
> Target //tensorflow/python/kernel\_tests:sparse\_matmul\_op\_test failed
>  to build
> 
> 
> 

We have tried below options to resolve this: 

1. built by exporting export CFLAGS and CXXFLAGS to "-Wno-error"
2. bazel build -c dbg --cxxopt="-Wno-all" --cxxopt="-Wno-error" //tensorflow/python/kernel\_tests:sparse\_matmul\_op\_test
3. Tried commenting compiler\_flag from third\_party/gpus/crosstool/CROSSTOOL.tpl

What is the correct way to suppress these warnings for the build to proceed?

We are using gcc v5.4.0.