CMAKE构建任务无法找到cmake命令

时间:2017-08-09 00:58:51

标签: azure-pipelines

我通过windows上的vsagent配置了基于CMAKE的构建,直到最近才运行良好。它开始失败,出现以下错误:

已更新调试输出

  

=============================================== ===============================   任务:CMake   描述:使用CMake跨平台构建系统构建   版本:1.0.25   作者:微软公司

     

帮助:More Information

     

agent.workFolder = C:\ vsagent_work   加载输入和端点   加载ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN   加载ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION   加载ENDPOINT_AUTH_SYSTEMVSSCONNECTION   加载INPUT_CMAKEARGS   加载INPUT_CWD   装5   检查路径:C:\ vsagent_work_tasks \ CMake_7d831c3c-3c68-459a-a5c9-bde6e659596c \ 1.0.25 \ task.json   将资源文件设置为:C:\ vsagent_work_tasks \ CMake_7d831c3c-3c68-459a-a5c9-bde6e659596c \ 1.0.25 \ task.json   system.culture = EN-US   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   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的   pathSegments的绝对路径:C:\ Program Files(x86)\ Microsoft SDKs \ TypeScript \ 2.1 / cmake = C:\ Program Files(x86)\ Microsoft SDKs \ TypeScript \ 2.1 \ cmake   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 \微软\ TestWindow \ cmake的   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   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 \罗斯林\ cmake的   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   pathSegments的绝对路径:C:\ Program Files(x86)\ Microsoft Visual Studio \ Shared \ Common \ VSPerfCollectionTools / cmake = C:\ Program Files(x86)\ Microsoft Visual Studio \ Shared \ Common \ VSPerfCollectionTools \ cmake   pathSegments的绝对路径:C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v10.0A \ bin \ NETFX 4.6.1工具/ cmake = C:\ Program Files(x86)\ Microsoft SDKs \ Windows \ v10.0A \ bin \ NETFX 4.6.1工具\ cmake   pathSegments的绝对路径:C:\ Program Files(x86)\ Windows Kits \ 10 \ bin \ x86 / cmake = C:\ Program Files(x86)\ Windows Kits \ 10 \ bin \ x86 \ cmake   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的   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的   pathSegments的绝对路径:C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 / cmake = C:\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ cmake   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   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   pathSegments的绝对路径:C:\ vsagent \ externals \ git \ cmd / cmake = C:\ vsagent \ externals \ git \ cmd \ cmake   pathSegments的绝对路径:C:\ WINDOWS \ system32 / cmake = C:\ WINDOWS \ system32 \ cmake   pathSegments的绝对路径:C:\ WINDOWS / cmake = C:\ WINDOWS \ cmake   pathSegments的绝对路径:C:\ WINDOWS \ System32 \ Wbem / cmake = C:\ WINDOWS \ System32 \ Wbem \ cmake   pathSegments的绝对路径:C:\ WINDOWS \ System32 \ WindowsPowerShell \ v1.0 / cmake = C:\ WINDOWS \ System32 \ WindowsPowerShell \ v1.0 \ cmake   pathSegments的绝对路径:C:\ ProgramData \ chocolatey \ bin / cmake = C:\ ProgramData \ chocolatey \ bin \ cmake   pathSegments的绝对路径:C:\ Program Files \ Git \ cmd / cmake = C:\ Program Files \ Git \ cmd \ cmake   pathSegments的绝对路径:C:\ Program Files(x86)\ Windows Kits \ 10 \ Windows Performance Toolkit / cmake = C:\ Program Files(x86)\ Windows Kits \ 10 \ Windows Performance Toolkit \ cmake   pathSegments的绝对路径:C:\ Program Files \ Microsoft SQL Server \ 130 \ Tools \ Binn / cmake = C:\ Program Files \ Microsoft SQL Server \ 130 \ Tools \ Binn \ cmake   pathSegments的绝对路径:C:\ Program Files \ dotnet / cmake = C:\ Program Files \ dotnet \ cmake   pathSegments的绝对路径:C:\ tools \ go \ bin / cmake = C:\ tools \ go \ bin \ cmake   pathSegments的绝对路径:c:\ vsagent \ scripts / cmake = c:\ vsagent \ scripts \ cmake   pathSegments的绝对路径:" C:\ Program Files \ CMake \ bin" / cmake = C:\ vsagent_work \ 1 \ s \" C:\ Program Files \ CMake \ bin" \ cmake的   pathSegments的绝对路径:C:\ WINDOWS \ ServiceProfiles \ NetworkService \ AppData \ Local \ Microsoft \ WindowsApps / cmake = C:\ WINDOWS \ ServiceProfiles \ NetworkService \ AppData \ Local \ Microsoft \ WindowsApps \ cmake   pathSegments的绝对路径:C:\ vsagent \ bin / cmake = C:\ vsagent \ bin \ cmake   pathSegments的绝对路径:C:\ vsagent \ bin / cmake = C:\ vsagent \ bin \ cmake   pathSegments的绝对路径:cmake = C:\ vsagent_work \ 1 \ s \ cmake   检查路径:C:\ vsagent_work \ 1 \ s \ cmake   cmake的= C:\ vsagent_work \ 1 \ S \ cmake的   CWD = C:\ vsagent_work \ 1 \ S \建立   测试目录' C:\ vsagent_work \ 1 \ s \ build'   测试目录' 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&#34 ;   exec工具:C:\ vsagent_work \ 1 \ s \ cmake   参数:   ..   -DCMAKE_TOOLCHAIN_FILE = C:\ SRC \杂项\ vcpkg \脚本\ buildsystems \ vcpkg.cmake   -DCMAKE_BUILD_TYPE =调试   -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失败。产生C:\ vsagent_work \ 1 \ s \ cmake ENOENT   已处理:## vso [task.issue type = error;] C:\ vsagent_work \ 1 \ s \ cmake失败。产生C:\ vsagent_work \ 1 \ s \ cmake ENOENT   任务结果:失败   CMake因错误而失败:C:\ vsagent_work \ 1 \ s \ cmake失败。产生C:\ vsagent_work \ 1 \ s \ cmake ENOENT   已处理:## vso [task.issue type = error;] CMake因错误而失败:C:\ vsagent_work \ 1 \ s \ cmake失败。产生C:\ vsagent_work \ 1 \ s \ cmake ENOENT   已处理:## vso [task.complete result = Failed;] CMake因错误而失败:C:\ vsagent_work \ 1 \ s \ cmake失败。产生C:\ vsagent_work \ 1 \ s \ cmake ENOENT   RC:-4058   成功:假

问题在于它正在尝试运行:

  

[命令] C:\ vsagent_work \ 6 \ S \ cmake的

最后一个有效的构建是运行不同的命令:

  

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

两个版本都运行vsagent版本2.114.0。两个版本都运行CMAKE Task版本1.0.25。这两个版本之间没有构建配置更改。可能已安装操作系统更新,但我无法在更新历史记录中找到任何内容。

事实证明,在构建失败之前,cmake不在系统PATH中。它是在安装vsagent的用户的用户PATH中。我在故障开始后将cmake目录添加到系统PATH,但这没有任何区别。构建代理的功能中列出的当前PATH是:

  

C:\ Windows \ System32下; C:\视窗; C:\ Windows \ System32下\ WBEM; C:\ Windows \ System32下\ WindowsPowerShell \ V1.0 \; C:\ ProgramData \的巧克力\ 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&#34 ;; C:\ Windows \ ServiceProfiles \ NetworkService \ AppData \ Local \ Microsoft \ WindowsApps; C:\ vsagent \ BIN

作为最后一个数据点,我们在repo的根目录下有一个cmake目录,所以c:\ vsagent_work \ 6 \ s \ cmake是磁盘上的一个目录。

有没有人知道可能有什么变化或有关如何诊断问题的任何想法?为什么不使用来自系统PATH的cmake?#/ p>

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

1 个答案:

答案 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还有一个错误。致电

  

统计数据(工具).isFile

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