c++windowsvisual-c++bazel

Why Bazel does not find Visual C++ Build Tools?


I`m working myself through a Tensorflow installation session (each one is a unique experience) and I'm trying to understand what is going wrong with the Bazel build tool.

For that, I have followed the example here after downloading everything mentioned in the guide. I also added the environment variable appropriately:

After trying to build an example I get:

The target you are compiling requires Visual C++ build tools.
Bazel couldn't find a valid Visual C++ build tools installation on your machine.

Visual C++ build tools seems to be installed at C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC
But Bazel can't find the following tools:
    VCVARSALL.BAT, cl.exe, link.exe, lib.exe, ml64.exe

which does not make sense. I checked that cl.exe, link.exe and ml64.exe can be found in this directory. My another suspicion was that I might need administrator rights, so I did run the build with admin rights too, but it did not make a difference.

My suspicion is that the VCVARSALL.bat might be missing, but I dont know what I would need to install to get that file.


Solution

  • Okay, so the problem could be solved by renaming the Visual Studio directory to 2017, due to the fact that the 0.24.1 version of the Bazel I`m using does not seem to work with the toolchain layout of the 2019 version of the Build Tools.

    More can be found about reading this github issue. Naturally, the corresponding environment variables has to be also changed. Another (better) solution would probably be to use the 2017 install of the Build Tools or a more recent version of the Bazel, but this is the one that is recommended in TFs current installation guide.