@@ -82,7 +82,7 @@ echo Calling vcvarsall.bat...
82
82
call " %VS_PATH% \VC\Auxiliary\Build\vcvarsall.bat" %HOST_ARCH% _x64
83
83
84
84
:: Add a small delay to ensure environment variables are set
85
- timeout /t 2 /nobreak > nul
85
+ ping 127.0.0.1 -n 3 > nul
86
86
87
87
:: Check if we have the required tools in common locations
88
88
set " FOUND_CL = 0"
@@ -97,15 +97,23 @@ if %errorLevel% equ 0 (
97
97
echo cl.exe not found in PATH, checking common locations...
98
98
99
99
:: Check common MSVC installation paths
100
- for %%p in (
101
- " %VS_PATH% \VC\Tools\MSVC\*\bin\Hostx64\x64\cl.exe"
102
- " %VS_PATH% \VC\Tools\MSVC\*\bin\HostARM64\x64\cl.exe"
103
- " %VS_PATH% \VC\Tools\MSVC\*\bin\Hostx86\x64\cl.exe"
104
- ) do (
105
- if exist " %%p " (
100
+ for /d %%v in (" %VS_PATH% \VC\Tools\MSVC\*" ) do (
101
+ if exist " %%v \bin\Hostx64\x64\cl.exe" (
106
102
set " FOUND_CL = 1"
107
- for %%f in (" %%p " ) do set " CL_PATH = %%~dpf "
108
- echo Found cl.exe at: !CL_PATH!
103
+ set " CL_PATH = %%v \bin\Hostx64\x64"
104
+ echo Found cl.exe at: %%v \bin\Hostx64\x64\cl.exe
105
+ goto :found_cl
106
+ )
107
+ if exist " %%v \bin\HostARM64\x64\cl.exe" (
108
+ set " FOUND_CL = 1"
109
+ set " CL_PATH = %%v \bin\HostARM64\x64"
110
+ echo Found cl.exe at: %%v \bin\HostARM64\x64\cl.exe
111
+ goto :found_cl
112
+ )
113
+ if exist " %%v \bin\Hostx86\x64\cl.exe" (
114
+ set " FOUND_CL = 1"
115
+ set " CL_PATH = %%v \bin\Hostx86\x64"
116
+ echo Found cl.exe at: %%v \bin\Hostx86\x64\cl.exe
109
117
goto :found_cl
110
118
)
111
119
)
@@ -121,15 +129,23 @@ if %errorLevel% equ 0 (
121
129
echo link.exe not found in PATH, checking common locations...
122
130
123
131
:: Check common MSVC installation paths for link.exe
124
- for %%p in (
125
- " %VS_PATH% \VC\Tools\MSVC\*\bin\Hostx64\x64\link.exe"
126
- " %VS_PATH% \VC\Tools\MSVC\*\bin\HostARM64\x64\link.exe"
127
- " %VS_PATH% \VC\Tools\MSVC\*\bin\Hostx86\x64\link.exe"
128
- ) do (
129
- if exist " %%p " (
132
+ for /d %%v in (" %VS_PATH% \VC\Tools\MSVC\*" ) do (
133
+ if exist " %%v \bin\Hostx64\x64\link.exe" (
130
134
set " FOUND_LINK = 1"
131
- for %%f in (" %%p " ) do set " LINK_PATH = %%~dpf "
132
- echo Found link.exe at: !LINK_PATH!
135
+ set " LINK_PATH = %%v \bin\Hostx64\x64"
136
+ echo Found link.exe at: %%v \bin\Hostx64\x64\link.exe
137
+ goto :found_link
138
+ )
139
+ if exist " %%v \bin\HostARM64\x64\link.exe" (
140
+ set " FOUND_LINK = 1"
141
+ set " LINK_PATH = %%v \bin\HostARM64\x64"
142
+ echo Found link.exe at: %%v \bin\HostARM64\x64\link.exe
143
+ goto :found_link
144
+ )
145
+ if exist " %%v \bin\Hostx86\x64\link.exe" (
146
+ set " FOUND_LINK = 1"
147
+ set " LINK_PATH = %%v \bin\Hostx86\x64"
148
+ echo Found link.exe at: %%v \bin\Hostx86\x64\link.exe
133
149
goto :found_link
134
150
)
135
151
)
@@ -141,6 +157,29 @@ if %errorLevel% equ 0 (
141
157
if %FOUND_CL% equ 0 (
142
158
echo Error: cl.exe not found in PATH or common MSVC locations
143
159
echo This usually means the MSVC compiler tools are not properly installed.
160
+ echo .
161
+ echo Debugging information:
162
+ echo VS_PATH: %VS_PATH%
163
+ echo HOST_ARCH: %HOST_ARCH%
164
+ echo .
165
+ echo Checking if MSVC directories exist:
166
+ if exist " %VS_PATH% \VC\Tools\MSVC\" (
167
+ echo MSVC Tools directory exists, listing versions:
168
+ dir " %VS_PATH% \VC\Tools\MSVC\" /b
169
+ echo .
170
+ echo Checking for cl.exe in latest version:
171
+ for /f %%i in ('dir " %VS_PATH% \VC\Tools\MSVC\" /b /o-n') do (
172
+ echo Checking: %VS_PATH% \VC\Tools\MSVC\%%i \bin\HostARM64\x64\cl.exe
173
+ if exist " %VS_PATH% \VC\Tools\MSVC\%%i \bin\HostARM64\x64\cl.exe" (
174
+ echo Found cl.exe in %%i version!
175
+ )
176
+ goto :break_loop
177
+ )
178
+ :break_loop
179
+ ) else (
180
+ echo MSVC Tools directory does not exist at: %VS_PATH% \VC\Tools\MSVC\
181
+ )
182
+ echo .
144
183
echo Please install Visual Studio Build Tools with C++ development tools.
145
184
echo Exiting with error code 1.
146
185
exit /b 1
0 commit comments