从源代码编译tensorflow:对tensorflow :: functor :: FillFunctor的未定义引用

时间:2016-02-09 11:31:02

标签: tensorflow

在使用GPU支持从源代码编译tensorflow时,我得到:

bazel build -c opt --config=cuda --verbose_failures //tensorflow/cc:tutorials_example_trainer
WARNING: Output base '/auto/homes/.cache/bazel/_bazel_/bd4752ce1a89280ab0ba7ef21866f7b1' is on NFS. This may lead to surprising failures and undetermined behavior.
WARNING: Sandboxed execution is not supported on your system and thus hermeticity of actions cannot be guaranteed. See http://bazel.io/docs/bazel-user-manual.html#sandboxing for more information. You can turn off this warning via --ignore_unsupported_sandboxing.
INFO: Found 1 target...
INFO: From Linking tensorflow/cc/tutorials_example_trainer:
bazel-out/local_linux-opt/bin/tensorflow/core/libkernels.lo(constant_op.o): In function `tensorflow::ZerosLikeOp<Eigen::GpuDevice, bool>::Compute(tensorflow::OpKernelContext*)':
constant_op.cc:(.text._ZN10tensorflow11ZerosLikeOpIN5Eigen9GpuDeviceEbE7ComputeEPNS_15OpKernelContextE[_ZN10tensorflow11ZerosLikeOpIN5Eigen9GpuDeviceEbE7ComputeEPNS_15OpKernelContextE]+0x181): undefined reference to `tensorflow::functor::FillFunctor<Eigen::GpuDevice, bool>::operator()(Eigen::GpuDevice const&, Eigen::TensorMap<Eigen::Tensor<bool, 1, 1, long>, 16>, Eigen::TensorMap<Eigen::TensorFixedSize<bool const, Eigen::Sizes<>, 1, long>, 16>)'
collect2: error: ld returned 1 exit status

我尝试了不同的bazel版本(0.1.1和0.1.4),但我得到了同样的错误。有什么想法吗?

2 个答案:

答案 0 :(得分:0)

我不确定导致问题的原因,但从Ubuntu 12.04升级到14.04已将其删除。

答案 1 :(得分:0)

这很可能是由于拥有旧版本的c编译器。通过升级你的Ubuntu,你也升级了gcc,这允许TensorFlow用bazel构建。

对于那些无法升级编译器的人,您可以尝试使用本地gcc,请参阅此处: https://github.com/bazelbuild/bazel/issues/649