bazel: builds fail with --cpu=x64_windows_msvc

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

I can’t build any cc_library targets when I pass --cpu=x64_windows_msvc to bazel. The same build target was working before when I was using the built in gcc (i.e. not passing --cpu flag). I have MSVC installed in the default installation directory.

I am getting the following error:

John@terrorvision MSYS /d/diego/progs/c++/die-tk-win-ws/die-tk
$ bazel build --cpu=x64_windows_msvc --verbose_failures :die-tk-base
INFO: Found 1 target...
ERROR: D:/diego/progs/c++/die-tk-win-ws/die-tk/BUILD:1:1: C++ compilation of rule '//die-tk-win-ws/die-tk:die-tk-base' failed: msvc_cl.bat failed: error executing command
  cd C:/tools/msys64/tmp/_bazel_John/yGhqzb7R/execroot/c++
  SET PATH=external/local_config_cc/wrapper/bin
  external/local_config_cc/wrapper/bin/msvc_cl.bat -m64 /D__inline__=__inline /DOS_WINDOWS=OS_WINDOWS /DCOMPILER_MSVC /DNOGDI /DNOMINMAX /DPRAGMA_SUPPORTED /D_WIN32_WINNT=0x0600 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /D_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS /D_USE_MATH_DEFINES /nologo /bigobj /Zm500 /J /Gy /GF /W3 /EHsc /wd4351 /wd4291 /wd4250 /wd4996 /DNDEBUG /Od -Xcompilation-mode=fastbuild /I. /Ibazel-out/vc_14_0_x64-fastbuild/genfiles /Iexternal/bazel_tools /Ibazel-out/vc_14_0_x64-fastbuild/genfiles/external/bazel_tools /Iexternal/bazel_tools/tools/cpp/gcc3 /DEPENDENCY_FILE bazel-out/vc_14_0_x64-fastbuild/bin/die-tk-win-ws/die-tk/_objs/die-tk-base/die-tk-win-ws/die-tk/src/NullCanvas.d /c die-tk-win-ws/die-tk/src/NullCanvas.cpp /Fobazel-out/vc_14_0_x64-fastbuild/bin/die-tk-win-ws/die-tk/_objs/die-tk-base/die-tk-win-ws/die-tk/src/NullCanvas.o --std=c++1y: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
The system cannot find the path specified.

Environment info

  • Operating System: Windows 8.1
BAZEL_SH=c:/tools/msys64/usr/bin/bash.exe
BAZEL_VS=C:/Program Files (x86)/Microsoft Visual Studio 14.0
BAZEL_PYTHON=/d/LING/Python27/
JAVA_HOME=C:/Program Files/Java/jdk1.8.0_25
  • Bazel version (output of bazel info release): release 0.4.2- (@non-git)

  • If bazel info release returns “development version” or “(@non-git)”, please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):

John@terrorvision MSYS /c/bazel-0.4.2
$ git rev-parse HEAD
fatal: Not a git repository (or any of the parent directories): .git

Have you found anything relevant by searching the web? (e.g. GitHub issues, email threads in the bazel-discuss@googlegroups.com archive)

I’ve found other issues and one thread with “msvc_cl.bat failed” message, but the proposed workarounds did not apply for me.

About this issue

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

Most upvoted comments

wow! I’ve installed it with chocolatey and it seems a lot better indeed 😃

also I already installed the latest VC Build Tools and bazel is recognizing it properly

now my issue is only to discover how to enable C++17 for it. here are the errors I am getting when I try to build something using std::optional

bazel build :die-tk-base ____Loading package: ____Found 1 target… ____Building… ERROR: D:/diego/progs/c++/die-tk/BUILD:3:1: C++ compilation of rule ‘//:die-tk-b ase’ failed (Exit 2). C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14. 11.25503\include\optional(15): fatal error C1189: #error: class template option al is only available with C++17. Target //:die-tk-base failed to build Use --verbose_failures to see the command lines of failed build steps. ____Elapsed time: 0.667s, Critical Path: 0.30s

the same errors happen with

bazel build :die-tk-base --cpu=x64_windows_msvc

I also tried to add /std::c++latest in copts, but then I just get this: cl : Command line warning D9002 : ignoring unknown option ‘/std::c++latest’

On Wed, Aug 23, 2017 at 3:59 AM, Marcel Hlopko notifications@github.com wrote:

Oh yeah, Bazel should be leaps better on Windows now than it was in February.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bazelbuild/bazel/issues/2266#issuecomment-324252369, or mute the thread https://github.com/notifications/unsubscribe-auth/ADzqHINVp71gbeUTZq_Uxu9TFNYKr8Qrks5sa9v9gaJpZM4LRfac .

https://github.com/thinlizzy/ http://die-xml.googlecode.com/ - C++11 and C++14 open source wrappers and libraries for various purposes (XML, image, webserver… and even a MTG implementation) http://baudejogos.net - o único site brasileiro decente de jogos!!