bazel: TensorFlow Build issue with Bazel (Error: cycle in dependency graph)

Hi,

I am opening this as a new issue as suggested by damienmg - the same issue has also been reported as a comment in https://github.com/bazelbuild/bazel/issues/587 and also discussed in https://github.com/bazelbuild/bazel/issues/596

I am building TensorFlow from source. I am using commit 916370e (as suggested in https://github.com/bazelbuild/bazel/issues/596) for Bazel build - Bazel build goes fine.

For building TensorFlow, I had to update the WORKSPACE file (attached) to work-around for known proxy issue (as described in https://github.com/bazelbuild/bazel/issues/587 ) to use “local_repository”.

I am using Ubuntu 14.04; From my root (~/tensorflow) I use the following commands to build TensorFlow:

bazel clean --expunge

bazel build -c opt //tensorflow/cc:tutorials_example_trainer

The error that I get from “bazel build …” command is as follows:

$ bazel build -c opt //tensorflow/cc:tutorials_example_trainer
......
ERROR: /home/ssaharo/.cache/bazel/_bazel_ssaharo/64bf5fcc928610d1fc32c86de697b420/external/png_archive/BUILD:23:1: in genrule rule @png_archive//:configure: cycle in dependency graph:
    //tensorflow/cc:tutorials_example_trainer
    //tensorflow/core:tensorflow
    //tensorflow/core:tensorflow_opensource
    //tensorflow/core:core
    //tensorflow/core:core_cpu
    //tensorflow/core:framework
    //tensorflow/core:lib
    //tensorflow/core/platform/default/build_config:platformlib
    @png_archive//:png
  * @png_archive//:configure [self-edge].
ERROR: Loading of target '//tensorflow/cc:tutorials_example_trainer' failed; build aborted.
ERROR: Loading failed; build aborted.
INFO: Elapsed time: 5.852s
============================================

Attached are the WORKSPACE file that I am using, and also png.BUILD and jpeg.BUILD files that I think are somehow related to this issue - both png.BUILD & jpeg.BUILD are original files that come with download of TensorFlow source.

Any help/suggestion would be very much appreciated

Thanks jpeg.BUILD.txt png.BUILD.txt WORKSPACE.txt

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 59 (23 by maintainers)

Most upvoted comments

Summary:

  • download jpeg.BUILD.txt, png.BUILD.txt, and WORKSPACE.txt from @srsaharoy 's message https://github.com/bazelbuild/bazel/issues/623#issuecomment-158151936 . (the 2nd post with attachments) and place these files in the tensorflow lib without the .txt extension instead of the existing files (in my case ~/git/tensorflow/tensorflow).
  • create folder with external source files: ~/git/tensorflow/fix/files/re2 ~/git/tensorflow/fix/files/jpeg-9a/jpeg-9a ~/git/tensorflow/fix/files/gemmlowp ~/git/tensorflow/fix/files/libpng-1.2.53/libpng-1.2.53 ~/git/tensorflow/fix/files/six-1.10.0 Note the dir-in-dir for jpeg-9a and libpng-1.2.53. This is necessary.
  • change paths in WORKSPACE file to match the location of the aux source files
  • bazel shutdown
  • bazel build -c opt //tensorflow/cc:tutorials_example_trainer

EDIT: the path for ‘six’ in WORKSPACE needs to point to the folder that contains six-1.10.0, e.g.: path = “/home/…/git/tensorflow/fix/files” This is because six.BUILD searches the sources in “six-1.10.0/six.py”.

EDIT: (for commit a108da2 16-DEC-2015) download & extract https://bitbucket.org/eigen/eigen/get/3.3-beta1.tar.gz ; change eigen_archive to new_local_repository with path = “/home/…/git/tensorflow/fix/files”

This may be also true for other modules.

If you have ‘/home/ssaharo/jpeg-9a’ as the path, then jutils.c should be at /home/ssaharo/jpeg-9a/jpeg-9a/jutils.c (the new_http_archive calls don’t use strip_prefix, so the .BUILD files expect that second folder).

Bazel loads the external repositories in parallel, so which one it finds first is not deterministic.