Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1712

qbs-setup-toolchains fails to auto-detect the MSVC istances due to `vswhere` utility

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • Not Evaluated
    • None
    • 1.24
    • General
    • None
    • Windows

    Description

      Qbs utility (comes with the official QtCreator 9.0) returns the following output:

      c:\Qt\Tools\QtCreator\bin>qbs-setup-toolchains.exe --detect
      Detecting MSVC toolchains...
      WARNING: The vswhere tool produced invalid JSON output: invalid UTF8 string
      Could not detect an installation of the Windows SDK or Visual Studio.
      

      When I run the wswhere utility from the PowerShell _or _CMD, I got the following output:

      C:\Users\scapi>"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -all -legacy -prerelease -format json -utf8
      [
        {
          "instanceId": "bbfabaaf",
          "installDate": "2022-02-01T19:10:41Z",
          "installationName": "VisualStudio/17.2.6+32630.192",
          "installationPath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community",
          "installationVersion": "17.2.32630.192",
          "productId": "Microsoft.VisualStudio.Product.Community",
          "productPath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\IDE\\devenv.exe",
          "state": 4294967295,
          "isComplete": true,
          "isLaunchable": true,
          "isPrerelease": false,
          "isRebootRequired": false,
          "displayName": "Visual Studio Community 2022",
          "description": "Мощная интегрированная среда разработки, бесплатная для студентов, участников проектов с открытым кодом и отдельных пользователей.",
          "channelId": "VisualStudio.17.Release",
          "channelUri": "https://aka.ms/vs/17/release/channel",
          "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
          "installedChannelUri": "https://aka.ms/vs/17/release/channel",
          "releaseNotes": "https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.2#17.2.6",
          "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=661288",
          "updateDate": "2022-07-13T07:32:31.2981003Z",
          "catalog": {
            "buildBranch": "d17.2",
            "buildVersion": "17.2.32630.192",
            "id": "VisualStudio/17.2.6+32630.192",
            "localBuild": "build-lab",
            "manifestName": "VisualStudio",
            "manifestType": "installer",
            "productDisplayVersion": "17.2.6",
            "productLine": "Dev17",
            "productLineVersion": "2022",
            "productMilestone": "RTW",
            "productMilestoneIsPreRelease": "False",
            "productName": "Visual Studio",
            "productPatchVersion": "6",
            "productPreReleaseMilestoneSuffix": "1.0",
            "productSemanticVersion": "17.2.6+32630.192",
            "requiredEngineVersion": "3.2.2159.37022"
          },
          "properties": {
            "campaignId": "59",
            "channelManifestId": "VisualStudio.17.Release/17.2.6+32630.192",
            "nickname": "",
            "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\setup.exe"
          }
        }
      ]
      

      A quick investigation shows that the call QJsonDocument::fromJson returns an error (error: IllegalUTF8String (9), offset: 656) in msvcinfo.cpp file.

      The content of `vswhere` output, using the qDebug() is:

      "[\r\n  {\r\n    \"instanceId\": \"bbfabaaf\",\r\n    \"installDate\": \"2022-02-01T19:10:41Z\",\r\n    \"installationName\": \"VisualStudio/17.2.6+32630.192\",\r\n    \"installationPath\": \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community\",\r\n    \"installationVersion\": \"17.2.32630.192\",\r\n    \"productId\": \"Microsoft.VisualStudio.Product.Community\",\r\n    \"productPath\": \"C:\\\\Program Files\\\\Microsoft Visual Studio\\\\2022\\\\Community\\\\Common7\\\\IDE\\\\devenv.exe\",\r\n    \"state\": 4294967295,\r\n    \"isComplete\": true,\r\n    \"isLaunchable\": true,\r\n    \"isPrerelease\": false,\r\n    \"isRebootRequired\": false,\r\n    \"displayName\": \"Visual Studio Community 2022\",\r\n    \"description\": \"\x8C\xAE\xE9\xAD\xA0\xEF \xA8\xAD\xE2\xA5\xA3\xE0\xA8\xE0\xAE\xA2\xA0\xAD\xAD\xA0\xEF \xE1\xE0\xA5\xA4\xA0 \xE0\xA0\xA7\xE0\xA0\xA1\xAE\xE2\xAA\xA8, \xA1\xA5\xE1\xAF\xAB\xA0\xE2\xAD\xA0\xEF \xA4\xAB\xEF \xE1\xE2\xE3\xA4\xA5\xAD\xE2\xAE\xA2, \xE3\xE7\xA0\xE1\xE2\xAD\xA8\xAA\xAE\xA2 \xAF\xE0\xAE\xA5\xAA\xE2\xAE\xA2 \xE1 \xAE\xE2\xAA\xE0\xEB\xE2\xEB\xAC \xAA\xAE\xA4\xAE\xAC \xA8 \xAE\xE2\xA4\xA5\xAB\xEC\xAD\xEB\xE5 \xAF\xAE\xAB\xEC\xA7\xAE\xA2\xA0\xE2\xA5\xAB\xA5\xA9.\",\r\n    \"channelId\": \"VisualStudio.17.Release\",\r\n    \"channelUri\": \"https://aka.ms/vs/17/release/channel\",\r\n    \"enginePath\": \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\resources\\\\app\\\\ServiceHub\\\\Services\\\\Microsoft.VisualStudio.Setup.Service\",\r\n    \"installedChannelUri\": \"https://aka.ms/vs/17/release/channel\",\r\n    \"releaseNotes\": \"https://docs.microsoft.com/en-us/visualstudio/releases/2022/release-notes-v17.2#17.2.6\",\r\n    \"thirdPartyNotices\": \"https://go.microsoft.com/fwlink/?LinkId=661288\",\r\n    \"updateDate\": \"2022-07-13T07:32:31.2981003Z\",\r\n    \"catalog\": {\r\n      \"buildBranch\": \"d17.2\",\r\n      \"buildVersion\": \"17.2.32630.192\",\r\n      \"id\": \"VisualStudio/17.2.6+32630.192\",\r\n      \"localBuild\": \"build-lab\",\r\n      \"manifestName\": \"VisualStudio\",\r\n      \"manifestType\": \"installer\",\r\n      \"productDisplayVersion\": \"17.2.6\",\r\n      \"productLine\": \"Dev17\",\r\n      \"productLineVersion\": \"2022\",\r\n      \"productMilestone\": \"RTW\",\r\n      \"productMilestoneIsPreRelease\": \"False\",\r\n      \"productName\": \"Visual Studio\",\r\n      \"productPatchVersion\": \"6\",\r\n      \"productPreReleaseMilestoneSuffix\": \"1.0\",\r\n      \"productSemanticVersion\": \"17.2.6+32630.192\",\r\n      \"requiredEngineVersion\": \"3.2.2159.37022\"\r\n    },\r\n    \"properties\": {\r\n      \"campaignId\": \"59\",\r\n      \"channelManifestId\": \"VisualStudio.17.Release/17.2.6+32630.192\",\r\n      \"nickname\": \"\",\r\n      \"setupEngineFilePath\": \"C:\\\\Program Files (x86)\\\\Microsoft Visual Studio\\\\Installer\\\\setup.exe\"\r\n    }\r\n  }\r\n]\r\n"
      

      === My ENV ===

      • Qt is: v5.15.2 64 bit.
      • Windows version is:
      PS C:\Users\scapi> Get-ComputerInfo | select WindowsProductName, WindowsVersion, OsHardwareAbstractionLayer             
      WindowsProductName WindowsVersion OsHardwareAbstractionLayer
      ------------------ -------------- --------------------------
      Windows 10 Pro     2009           10.0.22000.1219
      
      • Windows locale is:
      PS C:\Users\scapi> GET-WinSystemLocale
      
      LCID             Name             DisplayName
      ----             ----             -----------
      1049             ru-RU            Русский (Россия)
      
      • vswhere version is:
      PS C:\Program Files (x86)\Microsoft Visual Studio\Installer> .\vswhere
      Visual Studio Locator version 3.0.1+e2e4e03c65 [query version 3.2.2137.26324]
      

      Attachments

        1. fix-vswhere-output-parse.patch
          4 kB
          Denis Shienkov
        2. fix-vswhere-unicode.patch
          4 kB
          Denis Shienkov
        3. image-2022-11-26-16-25-06-137.png
          16 kB
          Denis Shienkov
        4. out.bin
          2 kB
          Denis Shienkov

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kandeler Christian Kandeler
              kuzulis Denis Shienkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes