2017-08-09 66 views
0

我在窗口上通过vsagent配置了一个基于CMAKE的构建,该构建运行良好,直到最近。它开始与下面的错误而失败:CMAKE构建任务未能找到cmake命令

更新与调试输出

============================================================================== Task : CMake Description : Build with the CMake cross-platform build system Version : 1.0.25 Author : Microsoft Corporation

Help : More Information

agent.workFolder=C:\vsagent_work loading inputs and endpoints loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION loading INPUT_CMAKEARGS loading INPUT_CWD loaded 5 check path : C:\vsagent_work_tasks\CMake_7d831c3c-3c68-459a-a5c9-bde6e659596c\1.0.25\task.json set resource file to: C:\vsagent_work_tasks\CMake_7d831c3c-3c68-459a-a5c9-bde6e659596c\1.0.25\task.json system.culture=en-US Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.10.25017\bin\HostX86\x86\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCPackages/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCPackages\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.1/cmake = C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.1\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Roslyn/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\Roslyn\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Performance Tools/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Performance Tools\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools/cmake = C:\Program Files (x86)\Microsoft Visual Studio\Shared\Common\VSPerfCollectionTools\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools/cmake = C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\cmake Absolute path for pathSegments: C:\Program Files (x86)\Windows Kits\10\bin\x86/cmake = C:\Program Files (x86)\Windows Kits\10\bin\x86\cmake Absolute path for pathSegments: C:\Program Files (x86)\Windows Kits\10\bin\10.0.14393.0\x86/cmake = C:\Program Files (x86)\Windows Kits\10\bin\10.0.14393.0\x86\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\bin\cmake Absolute path for pathSegments: C:\Windows\Microsoft.NET\Framework\v4.0.30319/cmake = C:\Windows\Microsoft.NET\Framework\v4.0.30319\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\cmake Absolute path for pathSegments: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools/cmake = C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\cmake Absolute path for pathSegments: C:\vsagent\externals\git\cmd/cmake = C:\vsagent\externals\git\cmd\cmake Absolute path for pathSegments: C:\WINDOWS\system32/cmake = C:\WINDOWS\system32\cmake Absolute path for pathSegments: C:\WINDOWS/cmake = C:\WINDOWS\cmake Absolute path for pathSegments: C:\WINDOWS\System32\Wbem/cmake = C:\WINDOWS\System32\Wbem\cmake Absolute path for pathSegments: C:\WINDOWS\System32\WindowsPowerShell\v1.0/cmake = C:\WINDOWS\System32\WindowsPowerShell\v1.0\cmake Absolute path for pathSegments: C:\ProgramData\chocolatey\bin/cmake = C:\ProgramData\chocolatey\bin\cmake Absolute path for pathSegments: C:\Program Files\Git\cmd/cmake = C:\Program Files\Git\cmd\cmake Absolute path for pathSegments: C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit/cmake = C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\cmake Absolute path for pathSegments: C:\Program Files\Microsoft SQL Server\130\Tools\Binn/cmake = C:\Program Files\Microsoft SQL Server\130\Tools\Binn\cmake Absolute path for pathSegments: C:\Program Files\dotnet/cmake = C:\Program Files\dotnet\cmake Absolute path for pathSegments: C:\tools\go\bin/cmake = C:\tools\go\bin\cmake Absolute path for pathSegments: c:\vsagent\scripts/cmake = c:\vsagent\scripts\cmake Absolute path for pathSegments: "C:\Program Files\CMake\bin"/cmake = C:\vsagent_work\1\s\"C:\Program Files\CMake\bin"\cmake Absolute path for pathSegments: C:\WINDOWS\ServiceProfiles\NetworkService\AppData\Local\Microsoft\WindowsApps/cmake = C:\WINDOWS\ServiceProfiles\NetworkService\AppData\Local\Microsoft\WindowsApps\cmake Absolute path for pathSegments: C:\vsagent\bin/cmake = C:\vsagent\bin\cmake Absolute path for pathSegments: C:\vsagent\bin/cmake = C:\vsagent\bin\cmake Absolute path for pathSegments: cmake = C:\vsagent_work\1\s\cmake check path : C:\vsagent_work\1\s\cmake cmake=C:\vsagent_work\1\s\cmake cwd=C:\vsagent_work\1\s\build testing directory 'C:\vsagent_work\1\s\build' testing directory 'C:\vsagent_work\1\s' mkdir 'C:\vsagent_work\1\s\build' cmakeArgs=.. -DCMAKE_TOOLCHAIN_FILE=C:\src\misc\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 15 2017 Win64" C:\vsagent_work\1\s\cmake arg: .. -DCMAKE_TOOLCHAIN_FILE=C:\src\misc\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 15 2017 Win64" exec tool: C:\vsagent_work\1\s\cmake Arguments: .. -DCMAKE_TOOLCHAIN_FILE=C:\src\misc\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -G Visual Studio 15 2017 Win64 C:\vsagent_work\1\s\cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\src\misc\vcpkg\scripts\buildsystems\vcpkg.cmake -DCMAKE_BUILD_TYPE=Debug -G Visual Studio 15 2017 Win64 C:\vsagent_work\1\s\cmake failed. spawn C:\vsagent_work\1\s\cmake ENOENT Processed: ##vso[task.issue type=error;]C:\vsagent_work\1\s\cmake failed. spawn C:\vsagent_work\1\s\cmake ENOENT task result: Failed CMake failed with error: C:\vsagent_work\1\s\cmake failed. spawn C:\vsagent_work\1\s\cmake ENOENT Processed: ##vso[task.issue type=error;]CMake failed with error: C:\vsagent_work\1\s\cmake failed. spawn C:\vsagent_work\1\s\cmake ENOENT Processed: ##vso[task.complete result=Failed;]CMake failed with error: C:\vsagent_work\1\s\cmake failed. spawn C:\vsagent_work\1\s\cmake ENOENT rc:-4058 success:false

的问题是,它试图运行:

[command]C:\vsagent_work\6\s\cmake

上次编译工作是运行不同的命令:

[command]c:\program files\cmake\bin\cmake.exe

这两个版本都在运行vsagent版本2.114.0。这两个版本都运行CMAKE任务版本1.0.25。这两个版本之间没有构建配置更改。也许安装了操作系统更新,但在更新历史记录中找不到任何内容。

事实证明,构建失败之前cmake不在系统PATH中。它位于安装vsagent的用户的用户PATH中。在故障开始后,我将cmake目录添加到系统PATH中,但这没有什么区别。在服务能力为构建代理列表中列出当前路径是:

C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\tools\go\bin;c:\vsagent\scripts;"C:\Program Files\CMake\bin";C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Microsoft\WindowsApps;C:\vsagent\bin

作为最后的数据点,我们也有我们的回购的根cmake的目录,所以C:\ vsagent_work \ 6 \ S \ cmake的是磁盘上的一个目录。

有没有人有任何想法可能已经改变或任何想法如何诊断问题?为什么vsagent不使用系统PATH中的cmake?

更新:我已经重新安装了代理,现在的版本为2.120.1

+0

尝试在此机器上设置新的生成代理,然后使用此代理排队生成并检查结果。 –

+0

排队将“system.debug”变量设置为“true”,然后在此处共享cmake步骤的构建日志。你还可以检查构建代理的功能设置吗? –

+0

我用调试输出更新了这个问题。我还升级了代理并仍然重现问题。你想让我检查这些功能? –

回答

0

这是引号

"c:\program files\cmake\bin"

中引起该问题的PATH变量。 path.resolve()打开这个中

C:\vsagent\_work\1\s\"C:\Program Files\CMake\bin"

C:\vsagent\_work\1\s

是当前工作目录。删除引号解决了问题。

还有一个错误https://github.com/Microsoft/vsts-task-lib/blob/d487d3a0eb602c207bb4c0cf77064ed7df51fbac/node/lib/task.ts#L656

stats(tool).isFile

应以'()'结尾,因为isFile是函数。由于当前工作目录中存在'cmake'目录,缺少parens会导致if语句解析为true。