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:
built by exporting export CFLAGS and CXXFLAGS to "-Wno-error"
bazel build -c dbg --cxxopt="-Wno-all" --cxxopt="-Wno-error" //tensorflow/python/kernel_tests:sparse_matmul_op_test
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.
I've had the same issue recently. It got solved by adding --copt=-O
and -c opt
to the build command.
Example:
bazel build --copt=-O -c dbg -c opt //tensorflow/python/kernel_tests:sparse_matmul_op_test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With