G:\src\test_projects\bazel_tutorial>bazel info release
release 0.5.0
G:\src\test_projects\bazel_tutorial>set bazel_vs
BAZEL_VS=C:\Program Files (x86)\Microsoft Visual Studio 10.0
G:\src\test_projects\bazel_tutorial>bazel build main:hello-world --verbose_failures
...
external/local_config_cc/wrapper/bin/msvc_cl.bat /nologo -Wl,-S /OUT:bazel-out/msvc_x64-fastbuild/bin/main/hello-world.exe /MACH
INE:X64 /SUBSYSTEM:CONSOLE -Xcompilation-mode=fastbuild -Wl,@bazel-out/msvc_x64-fastbuild/bin/main/hello-world.exe-2.params /DEFAU
LTLIB:libcmt.lib /DEBUG:FASTLINK /INCREMENTAL:NO: com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with
status 1117.
LINK : fatal error LNK1117: syntax error in option 'DEBUG:FASTLINK'
As far as I can tell, cl.exe supports /DEBUG:FASTLINK only in versions 2015 or later. In the earlier versions, it's only /DEBUG. I didn't see a list of supported VS versions, e. g. on the Using Bazel on Windows page.
@laszlocsomor any update on this? I'm hitting this as well. I have VS 2010 professional and I can't create any binaries because of this. Please advise on a possible workaround. Thanks.
@sbilkoloft : Here's a workaround:
bazel build //src:bazel.exeThanks for the help @laszlocsomor. I tried the solution and seems like it's beyond redemption:
C:\msys64\tmp_bazel_sbilkoloft\qagro95y\execroot\io_bazel\src/main/cpp/util/port.h(19) : fatal error C1083: Cannot open include file: 'cinttypes': No such file or directory
Target //src:bazel.exe failed to build
Seems like they just didn't fix it.
@sbilkoloft : You're welcome! I'm sorry to hear it didn't work. Can you install a newer version? Bazel supports the VC++ Build Tools 2017, see our "Getting started" guide.
Meanwhile I realized that my step (3) would require you have a patched Bazel already. But I think you could avoid that by building Bazel from source:
Although if the compiler is missing a file, there's not much left to do.
@sbilkoloft I suspect cinttypes might doesn't exist in older version of MSVC, since port.h depends on it, it's unlikely we can build Bazel with it.
But, what you can do is using an existing Bazel binary with a custom CROSSTOOL,
Here's one you can use easily, https://github.com/meteorcloudy/windows-crosstool
Download the repo, and use the local_repository rule to use this CROSSTOOL.
Then you can modify the CROSSTOOL without rebuilding Bazel itself.
@laszlocsomor @meteorcloudy thanks for the help. I went with VS 2017 community. Seems like my original 2017 installation had problems so I thought to give my 2010 a try.
And things work with 2017 now btw.
I'll update the docs to say we need VS 2015 or older.
VS 2012 and 2013 might work too, I don't know and can't test.
@laszlocsomor The error you got from your local machine in https://github.com/bazelbuild/bazel/issues/4240 is caused by this bug.
We should fix the CROSSTOOL and auto configuration to make it work with older version of VC
Most helpful comment
And things work with 2017 now btw.