Closed Honya2000 closed 3 years ago
First, please see the Bazel install instructions on Windows. Bazelisk is the recommended (and the easiest) way to make sure you have the right Bazel version.
Windows support is experimental. TFRT should build and pass most test cases, but not everything works yet. Here's a list of known issues
According to readme file bazel sould be at least verion 4.0.0.
I'm using version 4.2.1:
Build label: 4.2.1 Build target: bazel-out/x64_windows-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Mon Aug 30 15:19:20 2021 (1630336760) Build timestamp: 1630336760 Build timestamp as int: 1630336760
And yes, i checked those issues.... But noone reports it is not compilable on windows at all?
That;s why i'm asking, what i'm doing wrong. There is no any instructions how to compile it on windows.
So is command: bazel build //tools:bef_executor suppose to work on windows after bazel installation? Or should i do something additional?
Are you able to build any other C++ projects with Bazel, on the same machine? (try https://github.com/bazelbuild/examples/tree/main/cpp-tutorial or Abseil C++)
The only project where I used bazel - was WebRTC. But … First - WebRTC used special depot toolsets. And second - it didn’t compile anything but just generated visual studio project. Compilation happened inside visual studio..
In TFRT it tries to compile the project and fails, because cannot find visual studio compiler. How to specify the path to visual studio for bazel?
Ok, just found how to tell bazel visual studio location
set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC
Will try tomorrow…
Once you can verify that you can build simple C++ apps with Bazel, the instructions for building on Windows are fairly straightforward:
conda create -n tfrt python=3.8
)pip install clang==11.0
bazel --noworkspace_rc clean --expunge
bazel build //tools:bef_executor
bazel build //tools:tfrt_translate
bazel test -c dbg //mlir_tests/bef_executor/...
Still not able to build. Tried to set BAZEL_VC=C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC
But seems like it is ignored by bazel. ERROR: C:/users/andrey/_bazel_andrey/o2svxzdq/external/llvm-project/llvm/BUILD.bazel:170:11: Compiling llvm/lib/Support/TypeSize.cpp [for host] failed: (Exit 2): cl.exe failed: error executing command C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 ... (remaining 45 argument(s) skipped) external/llvm-project/llvm/include\llvm/Support/Compiler.h(88): fatal error C1189: #error: LLVM requires at least MSVC 2017.ERROR: C:/users/andrey/_bazel_andrey/o2svxzdq/external/llvm-project/llvm/BUILD.bazel:170:11: Compiling llvm/lib/Support/TypeSize.cpp [for host] failed: (Exit 2): cl.exe failed: error executing command C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/cl.exe /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 ... (remaining 45 argument(s) skipped) external/llvm-project/llvm/include\llvm/Support/Compiler.h(88): fatal error C1189: #error: LLVM requires at least MSVC 2017.
Not sure why bazel tries to use old visual studio.
Ok, finally was able to build bef_executor. An it took over 7000 secs. )
I'm glad to hear that you're able to work out the Bazel / MSVC setup problem. What was the solution?
Regarding build times, it's a known issue that optimized builds take a long time (it used to be even worse, see https://github.com/tensorflow/runtime/issues/65). During development, debug builds (-c dbg
) are much faster.
Thanks a lot Leonard for helping out!
@Honya2000, it would be great if you could post here what you changed to make it work. Thanks!
Is there way to compile TFRT using windows toolsets? For example VS 2019 compiler? I tried to run this from command prompt: bazel build //tools:bef_executor
But it throws error that at least VS 2017 is required. I have VS 2019 installed but seems like bazel doesn't recognize it.