问题描述
我们正在尝试构建带有调试标志的TensorFlow测试用例:
We are trying to build a TensorFlow test case with debug flag:
但是构建失败并出现以下错误:
However the build is failing with below error:
cc1:将所有警告视为错误
cc1: all warnings being treated as errors
目标//tensorflow/python/kernel_tests:sparse_matmul_op_test失败 建立
Target //tensorflow/python/kernel_tests:sparse_matmul_op_test failed to build
我们尝试了以下选项来解决此问题:
We have tried below options to resolve this:
-
通过将导出CFLAGS和CXXFLAGS导出到"-Wno-error"来构建
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
bazel build -c dbg --cxxopt="-Wno-all" --cxxopt="-Wno-error" //tensorflow/python/kernel_tests:sparse_matmul_op_test
尝试注释来自third_party/gpus/crosstool/CROSSTOOL.tpl的compiler_flag
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?
我们正在使用gcc v5.4.0.
We are using gcc v5.4.0.
推荐答案
我最近遇到了同样的问题.通过在构建命令中添加--copt=-O
和-c opt
可以解决此问题.
I've had the same issue recently. It got solved by adding --copt=-O
and -c opt
to the build command.
示例:
bazel build --copt=-O -c dbg -c opt //tensorflow/python/kernel_tests:sparse_matmul_op_test
这篇关于TensorFlow不使用调试模式构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!