Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TensorFlow doesnt build with debug mode

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.

like image 608
NamrataB Avatar asked Nov 10 '16 04:11

NamrataB


1 Answers

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
like image 141
BernardoGO Avatar answered Sep 20 '22 04:09

BernardoGO