tensorflow: Error building from source

Hi all,

I’m trying to build TF from source so that I can run it in development mode and be able to expand the functionality of some of the modules, but am running into some snags with the bazel building.

Environment info

Operating System:

Mac OSX Yosemite

If installed from source, provide

  1. The commit hash (git rev-parse HEAD)

    ec7f37e40fedb23435bfb7e28668e5fa63ff52f3

  2. The output of bazel version

    Build label: 0.3.2-2016-10-22 (@088bbc6) Build target: bazel-out/local- opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Sun Oct 23 00:04:18 2016 (1477181058) Build timestamp: 1477181058 Build timestamp as int: 1477181058

Running: bazel build -c opt //tensorflow/tools/pip_package:build_pip_package --verbose_failures gives

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.
ERROR: /Users/mihaileric/Documents/Research/tensorflow/tensorflow/python/BUILD:1806:1: in cc_library rule //tensorflow/python:tf_session_helper: non-test target '//tensorflow/python:tf_session_helper' depends on testonly target '//tensorflow/python:construction_fails_op' and doesn't have testonly attribute set.
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted.
INFO: Elapsed time: 0.848s

I’m having a lot of difficulty interpreting these error messages and am not finding too much on Stack Overflow or other TF git threads. Any help would be greatly appreciated!

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 18 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@drpngx Ok, it works with a more recent version than v0.11.0 RC2 (I used SHA 9d045888a3b565e856287381b581eed02750f976). It also compiles in v0.11.0 RC2 by just commenting out “testonly = 1” in tensorflow/python/BUILD like you did it in your branch a few posts above.

@mihail911 : Thanks for the error report. There indeed seems to be an error in the BUILD file, where the //tensorflow/python:tf_session_helper target has a dependency on a library meant only for tests. That dependency shouldn’t exist and I’ll try to clear that up.

Amusingly though, this was not an error till very very recently. Since you’re using bazel built from source, it includes the change https://github.com/bazelbuild/bazel/commit/5f026f96118e76c8a6357c61e5710e0bd1bf0f54 , which makes this an error.

As a short term workaround for you, can you use the release version of bazel (0.3.2?) instead of from head. I’m going to try to fix the TensorFlow BUILD file regardless

For me, deleting testonly=1 from BUILD fixed the problem.