Open fpgauserdude opened 1 year ago
Hi @fpgauserdude, Seems you issue is related to https://github.com/bazelbuild/bazel/issues/18592, if yes, please follow the respective issue for further details.
If no, Could you please help us with details issue and minimal steps to reproduce the issue? Also, please specify which bazel, VS and OS version you are using?
@Pavank1992 @fpgauserdude I think you should be using windows powershell
Setting temporary variables in the cmd terminal and in powershell is different In the cmd terminal set BAZEL_VC="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC" In the windows powershell $env:BAZEL_VC="C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC"
After that, you'll see a success message,in cpp-tutorial\stage1.
PS D:\code\test\demo01\examples\cpp-tutorial\stage1> bazel build ... INFO: Analyzed target //main:hello-world (1 packages loaded, 31 targets configured). INFO: Found 1 target... Target //main:hello-world up-to-date: bazel-bin/main/hello-world.exe INFO: Elapsed time: 2.412s, Critical Path: 0.89s INFO: 4 processes: 2 internal, 2 local. INFO: Build completed successfully, 4 total actions
Now you can close your issue.
Thanks for the responses. @Pavank1992, yes, I think that is my issue. @cctv130, running in PowerShell resulted in the same problem.
PS D:\path\verible> echo $env:BAZEL_VC C:\Program Files\Microsoft Visual Studio\2022\Professional\VC PS D:\path\verible> echo $env:BAZEL_VC_FULL_VERSION 14.36.32532 PS D:\path\verible> bazel build -c opt //... INFO: Analyzed 1898 targets (0 packages loaded, 0 targets configured). INFO: Found 1898 targets... ERROR: C:/users/path/gigcqpgm/external/com_google_googletest/BUILD.bazel:80:11: Compiling googlemock/src/gmock.cc failed: (Exit 1): vc_installation_error_x64.bat failed: error executing command (from target @com_google_googletest//:gtest) external\local_config_cc\vc_installation_error_x64.bat /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 ... (remaining 34 arguments skipped)
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\Microsoft Visual Studio\2022\Professional\VC But Bazel can't find the following tools: VCVARSALL.BAT, cl.exe, link.exe, lib.exe, ml64.exe for x64 target architecture
Please check your installation following https://bazel.build/docs/windows#using
INFO: Elapsed time: 0.450s, Critical Path: 0.16s INFO: 16 processes: 16 internal. FAILED: Build did NOT complete successfully
Thanks for the responses. @Pavank1992, yes, I think that is my issue. @cctv130, running in PowerShell resulted in the same problem.
PS D:\path\verible> echo $env:BAZEL_VC C:\Program Files\Microsoft Visual Studio\2022\Professional\VC PS D:\path\verible> echo $env:BAZEL_VC_FULL_VERSION 14.36.32532 PS D:\path\verible> bazel build -c opt //... INFO: Analyzed 1898 targets (0 packages loaded, 0 targets configured). INFO: Found 1898 targets... ERROR: C:/users/path/gigcqpgm/external/com_google_googletest/BUILD.bazel:80:11: Compiling googlemock/src/gmock.cc failed: (Exit 1): vc_installation_error_x64.bat failed: error executing command (from target @com_google_googletest//:gtest) external\local_config_cc\vc_installation_error_x64.bat /nologo /DCOMPILER_MSVC /DNOMINMAX /D_WIN32_WINNT=0x0601 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /bigobj /Zm500 /EHsc /wd4351 /wd4291 ... (remaining 34 arguments skipped)
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\Microsoft Visual Studio\2022\Professional\VC But Bazel can't find the following tools: VCVARSALL.BAT, cl.exe, link.exe, lib.exe, ml64.exe for x64 target architecture
Please check your installation following https://bazel.build/docs/windows#using
INFO: Elapsed time: 0.450s, Critical Path: 0.16s INFO: 16 processes: 16 internal. FAILED: Build did NOT complete successfully
Sorry, I don't know you are the Professional version, if your cl.exe, link.exe, lib.exe, ml64.exe can not be found, you can use the simplest method, start menu search Developer PowerShell for VS 2022, Then cd to the project directory and add environment variables, build your project, these are small problems, usually with serious thought can solve the problem. Simple. [make great efforts]
@cctv130 Sorry, but despite every "great effort", this astoundingly stupid tool still cannot find my installed visual studio. And the debug information provided is utterly worthless. I had considered adopting bazel for some other kinds of builds, but that ship has definitely sailed. I suspect this would work on linux, but lots of things work on linux. What I need is something that works on windows too. With VS 2022 Professional.
PS D:\path\verible> get-command cl
CommandType Name Version Source
Application cl.exe 14.36.3... C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.3...
PS D:\path\verible> get-command link
CommandType Name Version Source
Application link.exe 14.36.3... C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.3...
PS D:\work\sandbox\verible> get-command lib
CommandType Name Version Source
Application lib.exe 14.36.3... C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.3...
PS D:\path\verible> get-command ml64
CommandType Name Version Source
Application ml64.exe 14.36.3... C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.3...
PS D:\path\verible> $env:BAZEL_VC="C:\Program Files\Microsoft Visual Studio\2022\Professional\VC"
PS D:\path\verible> bazel build -c opt //...
INFO: Analyzed 1898 targets (1 packages loaded, 2596 targets configured).
INFO: Found 1898 targets...
ERROR: C:/users/
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\Microsoft Visual Studio\2022\Professional\VC But Bazel can't find the following tools: VCVARSALL.BAT, cl.exe, link.exe, lib.exe, ml64.exe for x64 target architecture
Please check your installation following https://bazel.build/docs/windows#using
INFO: Elapsed time: 1.088s, Critical Path: 0.15s INFO: 16 processes: 16 internal. FAILED: Build did NOT complete successfully
请参考我的路径,这个下边有你想要的cl,link,lib C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.36.32532\bin\Hostx64\x64
Developer PowerShell for VS 2022 Developer PowerShell for VS 2022 This tool automatically searches for cl, link, lib, etc. If not found the Developer PowerShell for VS 2022, uninstall Community edition and install vs2022 Enterprise Edition
Looks like this issue is solved in Bazel 6.3.0
I am required to use bazel to compile a tool that I need. But I am having problems using VS 2022 professional. Am I doing something wrong here? There appear to be some other similar issues that users have reported, but those issues have been closed. Is it possible to debug this by having bazel report where it is looking for the Visual Studio executables? I imagine what is going wrong is that Microsoft changed the directory structure in version 2022. Do I need to just use VS 2019?
Thanks.