tensorflow: "HOST_CFG" is not defined on bazel clean

During the ./configure step of my build from source, I encounter a bazel error when trying to download

The main error seems to be


ERROR: /home/kamal/.cache/bazel/_bazel_kamal/f9ae4eca457b390bb2ebe780caca64e0/external/protobuf/protobuf.bzl:91:19: name 'HOST_CFG' is not defined.

Building with CUDA 8.0, cuDNN 5.1.5, GTX 1060

Full stack:

~/tensorflow ~/tensorflow
Please specify the location of python. [Default is /usr/bin/python]: 
Do you wish to build TensorFlow with Google Cloud Platform support? [y/N] n
No Google Cloud Platform support will be enabled for TensorFlow
Found possible Python library paths:
  /usr/local/lib/python2.7/dist-packages
  /usr/lib/python2.7/dist-packages
Please input the desired Python library path to use.  Default is [/usr/local/lib/python2.7/dist-packages]

/usr/local/lib/python2.7/dist-packages
Do you wish to build TensorFlow with GPU support? [y/N] y
GPU support will be enabled for TensorFlow
Please specify which gcc should be used by nvcc as the host compiler. [Default is /usr/bin/gcc]: 
Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 8.0
Please specify the location where CUDA 8.0 toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda-8.0
Please specify the Cudnn version you want to use. [Leave empty to use system default]: 5.1.5
Please specify the location where cuDNN 5.1.5 library is installed. Refer to README.md for more details. [Default is /usr/local/cuda-8.0]: 
Please specify a list of comma-separated Cuda compute capabilities you want to build with.
You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus.
Please note that each additional compute capability significantly increases your build time and binary size.
[Default is: "3.5,5.2"]: 6.1
INFO: Starting clean (this may take a while). Consider using --expunge_async if the clean takes more than several minutes.
.
ERROR: /home/kamal/.cache/bazel/_bazel_kamal/f9ae4eca457b390bb2ebe780caca64e0/external/protobuf/protobuf.bzl:91:19: name 'HOST_CFG' is not defined.
ERROR: package contains errors: tensorflow/contrib/metrics.
ERROR: error loading package 'tensorflow/contrib/metrics': Extension 'protobuf.bzl' has errors.
Configuration finished

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

@xpe I was able to trace the error. It was in the bazel workplace installation file and it pulled an older archive of protobuf. This old version had HOST_CFG instead of “host”.

To fix this, I replaced the lines

native.http_archive(
    name = "protobuf",
    url = "http://github.com/google/protobuf/archive/v3.0.2.tar.gz",
    sha256 = "b700647e11556b643ccddffd1f41d8cb7704ed02090af54cc517d44d912d11c1",
    strip_prefix = "protobuf-3.0.2",
  )

with

  native.git_repository(
      name = "protobuf",
      remote = "https://github.com/google/protobuf/",
      commit = "a289d43"
  )

@xpe I tried installing bazel from source from your repository and it still didn’t work, same error. I think it might have something to do with bazel fetching protobuf from github.

However, this is really confusing because protobuf fixed their cfg flags, and they don’t have any HOST_CFG in their code base anymore. So I don’t see why bazel would get a version of protobuf.bzl that has HOST_CFG in it. Maybe it’s not pulling from the most recent github version?

To make this clearer, look at the file where the error occurs, for me it is: /home/kamal/.cache/bazel/_bazel_kamal/f9ae4eca457b390bb2ebe780caca64e0/external/protobuf/protobuf.bzl for you it seems to be (at least in your most recent posted error message): /home/xpe/.cache/bazel/_bazel_xpe/641dfc594d651643762f515addd22118/external/protobuf/protobuf.bzl

This file contains the cfg = HOST_CFG, while the protobuf.bzl in the head of protobuf contains “host”

Am i getting something wrong? Why isn’t bazel downloading from master/head? if it says it’s cloning it.