Skip to content

Bazel on Windows: improve first-time experience #5254

Closed as not planned
Closed as not planned

Description

@laszlocsomor

In the spirit of #5208, I'd like to collect ideas to improve the experience of first-time Bazel on Windows users. Some ideas may be Windows-specific, some may cover all platforms. I believe the experience is bumpier than it could be.

I'm opening this bug with the intent of collecting these ideas -- mine and everyone else's -- and use it as a burn-down list of improvements. Please feel free to add your ideas. I'll keep updating the list as tasks are completed.


Update(2018-07-03):

Activity

  1. self-assigned this
    on May 24, 2018
  2. laszlocsomor commented on May 24, 2018

    @laszlocsomor
    ContributorAuthor
  3. self-assigned this
    on May 24, 2018
  4. laszlocsomor commented on Jul 3, 2018

    @laszlocsomor
    ContributorAuthor

    Update(2018-07-03):

  5. meteorcloudy commented on Jul 3, 2018

    @meteorcloudy
    Member

    If users don't define BAZEL_VC and BAZEL_VS, Bazel will detect VC installation on the machine, if not found a fake crosstool will be generated. So I guess they are not mandatory, are they?

  6. laszlocsomor commented on Jul 3, 2018

    @laszlocsomor
    ContributorAuthor

    I have a Windows VM on which the auto-detection does not find VC, and I have to manually set the envvar.

  7. meteorcloudy commented on Jul 3, 2018

    @meteorcloudy
    Member

    Just tested on the VM with 0.15.0. If I build a sh_binary, it worked without setting BAZEL_VC or BAZEL_VS. If I build a cc_binary, it threw an error asking me to install VC. This is working as expected.
    But in both case it gives some warning about setting BAZEL_VC, I guess that what we should improve?

    pcloudy@laszlocsomor-windows-testing MSYS ~/workspace/test
    $ vim BUILD
    
    pcloudy@laszlocsomor-windows-testing MSYS ~/workspace/test
    $ vim bin.sh
    
    pcloudy@laszlocsomor-windows-testing MSYS ~/workspace/test
    $ ./bazel-0.15.0-windows-x86_64.exe build :bin
    Loading:
    Loading: 0 packages loaded
    DEBUG: C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
    Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
    DEBUG: C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
    Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables, eg. VS140COMNTOOLS
    DEBUG: C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
    Auto-Configuration Warning: Looking for Visual C++ through registry
    INFO: Analysed target //:bin (4 packages loaded).
    INFO: Found 1 target...
    [0 / 5] [-----] Writing script bin.exe
    Target //:bin up-to-date:
      C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/execroot/__main__/bazel-out/x64_windows-fastbuild/bin/bin
      C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/execroot/__main__/bazel-out/x64_windows-fastbuild/bin/bin.exe
    INFO: Elapsed time: 1.109s, Critical Path: 0.03s
    INFO: 0 processes.
    INFO: Build completed successfully, 5 total actions
    INFO: Build completed successfully, 5 total actions
    
    pcloudy@laszlocsomor-windows-testing MSYS ~/workspace/test
    $ ./bazel-bin/bin
    hallo
    
    pcloudy@laszlocsomor-windows-testing MSYS ~/workspace/test
    $ vim BUILD
    
    pcloudy@laszlocsomor-windows-testing MSYS ~/workspace/test
    $ vim bin.cc
    
    pcloudy@laszlocsomor-windows-testing MSYS ~/workspace/test
    $ ./bazel-0.15.0-windows-x86_64.exe build :bin
    Loading:
    Loading: 0 packages loaded
    DEBUG: C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
    Auto-Configuration Warning: 'BAZEL_VC' is not set, start looking for the latest Visual C++ installed.
    DEBUG: C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
    Auto-Configuration Warning: Looking for VS%VERSION%COMNTOOLS environment variables, eg. VS140COMNTOOLS
    DEBUG: C:/users/pcloudy/_bazel_pcloudy/hyl7dsma/external/bazel_tools/tools/cpp/lib_cc_configure.bzl:115:5:
    Auto-Configuration Warning: Looking for Visual C++ through registry
    INFO: Analysed target //:bin (3 packages loaded).
    INFO: Found 1 target...
    [0 / 4] [-----] BazelWorkspaceStatusAction stable-status.txt
    ERROR: C:/msys64/home/pcloudy/workspace/test/BUILD:1:1: C++ compilation of rule '//:bin' failed (Exit -1)
    
    The target you are compiling requires Visual C++ build tools.
    Bazel couldn't find a valid Visual C++ build tools installation on your machine.
    Please check your installation following https://docs.bazel.build/versions/master/windows.html#using
    
    Target //:bin failed to build
    Use --verbose_failures to see the command lines of failed build steps.
    INFO: Elapsed time: 0.637s, Critical Path: 0.07s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully
    FAILED: Build did NOT complete successfully
    
    
  8. laszlocsomor commented on Jul 3, 2018

    @laszlocsomor
    ContributorAuthor

    Just tested on the VM with 0.15.0.

    Thanks for looking into this!

    If I build a sh_binary, it worked without setting BAZEL_VC or BAZEL_VS.

    For me too. That is WAI.

    If I build a cc_binary, it threw an error asking me to install VC. This is working as expected.

    For me too, and this is my primary concern. Isn't the cc_toolchain supposed to discover where VC is installed?

    But in both case it gives some warning about setting BAZEL_VC, I guess that what we should improve?

    That's an annoyance because it spams the output and the yellow-colored DEBUG messages look like warnings, but this is only my secondary concern.

  9. meteorcloudy commented on Jul 3, 2018

    @meteorcloudy
    Member

    Hmm, I see VS 2017 is installed on the VM, but the registry info is somehow missing. Normally, bazel should be able to detect that through registry by
    reg query HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS
    It worked on my workstation for VS 2017.

  10. laszlocsomor commented on Jul 3, 2018

    @laszlocsomor
    ContributorAuthor

    Could you update cc_configure to fall back on checking the default installation path if the registry key is missing?

  11. meteorcloudy commented on Jul 3, 2018

    @meteorcloudy
    Member

    That's a good idea!

  12. 16 remaining items

  13. added
    P3
    and removed
    untriaged
    on Jul 29, 2019
  14. ofek commented on Apr 1, 2020

    @ofek

    Any update?

  15. philwo commented on Apr 2, 2020

    @philwo
    Member

    @ofek Are you looking for something specific?

    Recently, we've been doing some light improvements for Bazel's Windows port, but are not prioritizing it very highly, because we feel like it's currently working well enough for the known users. But if you have concrete issues that we should address, please let me know here and I'll make sure we look at them!

  16. ofek commented on Apr 2, 2020

    @ofek

    Nothing in particular, just curious if the checklist is current

  17. lucasjinreal commented on Feb 4, 2023

    @lucasjinreal

    Error in fail: BAZEL_SH environment variable is not set

    I cannot bare it anymore in 2023 on windows

  18. github-actions commented on Apr 10, 2024

    @github-actions

    Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

  19. added
    stale
    on Apr 10, 2024
  20. github-actions commented on Jul 9, 2024

    @github-actions

    This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!

  21. ofek commented on Jul 9, 2024

    @ofek

    @bazelbuild/triage

  22. meteorcloudy commented on Jul 9, 2024

    @meteorcloudy
    Member

    I think most of the points in the original issues have been fixed or obsolete. Please file new issue for specific Windows bugs. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area-Windowsstaleteam-OSStype: process

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions