ambuild icon indicating copy to clipboard operation
ambuild copied to clipboard

Can't compile with MSVC in normal command prompt

Open SlidyBat opened this issue 4 years ago • 2 comments

With latest AMBuild I've heard it should be able to detect MSVC in the normal command prompt, rather than needing to use the VS command prompt.

However, this doesn't seem to work for me: image

On VS command prompt seems to work as expected: image

Here's the output of vswhere -format json -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -utf8 if it helps:

vswhere output

[
  {
    "instanceId": "0559c9e4",
    "installDate": "2019-05-31T23:31:40Z",
    "installationName": "VisualStudio/16.7.5+30523.141",
    "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community",
    "installationVersion": "16.7.30523.141",
    "productId": "Microsoft.VisualStudio.Product.Community",
    "productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\Common7\\IDE\\devenv.exe",
    "state": 4294967295,
    "isComplete": true,
    "isLaunchable": true,
    "isPrerelease": false,
    "isRebootRequired": false,
    "displayName": "Visual Studio Community 2019",
    "description": "Powerful IDE, free for students, open-source contributors, and individuals",
    "channelId": "VisualStudio.16.Release",
    "channelUri": "https://aka.ms/vs/16/release/channel",
    "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
    "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660893#16.7.5",
    "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660909",
    "updateDate": "2020-10-05T10:23:08.0919066Z",
    "catalog": {
      "buildBranch": "d16.7",
      "buildVersion": "16.7.30523.141",
      "id": "VisualStudio/16.7.5+30523.141",
      "localBuild": "build-lab",
      "manifestName": "VisualStudio",
      "manifestType": "installer",
      "productDisplayVersion": "16.7.5",
      "productLine": "Dev16",
      "productLineVersion": "2019",
      "productMilestone": "RTW",
      "productMilestoneIsPreRelease": "False",
      "productName": "Visual Studio",
      "productPatchVersion": "5",
      "productPreReleaseMilestoneSuffix": "1.0",
      "productSemanticVersion": "16.7.5+30523.141",
      "requiredEngineVersion": "2.7.3132.26759"
    },
    "properties": {
      "campaignId": "",
      "channelManifestId": "VisualStudio.16.Release/16.7.5+30523.141",
      "nickname": "",
      "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe"
    }
  },
  {
    "instanceId": "647b8f09",
    "installDate": "2019-10-12T03:46:44Z",
    "installationName": "VisualStudio/15.9.16+28307.858",
    "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community",
    "installationVersion": "15.9.28307.858",
    "productId": "Microsoft.VisualStudio.Product.Community",
    "productPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\Common7\\IDE\\devenv.exe",
    "state": 4294967295,
    "isComplete": true,
    "isLaunchable": true,
    "isPrerelease": false,
    "isRebootRequired": false,
    "displayName": "Visual Studio Community 2017",
    "description": "Free, fully-featured IDE for students, open-source and individual developers",
    "channelId": "VisualStudio.15.Release",
    "channelUri": "https://aka.ms/vs/15/release/channel",
    "enginePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\resources\\app\\ServiceHub\\Services\\Microsoft.VisualStudio.Setup.Service",
    "releaseNotes": "https://go.microsoft.com/fwlink/?LinkId=660692#15.9.16",
    "thirdPartyNotices": "https://go.microsoft.com/fwlink/?LinkId=660708",
    "updateDate": "2019-10-12T03:46:44.8291531Z",
    "catalog": {
      "buildBranch": "d15.9",
      "buildVersion": "15.9.28307.858",
      "id": "VisualStudio/15.9.16+28307.858",
      "localBuild": "build-lab",
      "manifestName": "VisualStudio",
      "manifestType": "installer",
      "productDisplayVersion": "15.9.16",
      "productLine": "Dev15",
      "productLineVersion": "2017",
      "productMilestone": "RTW",
      "productMilestoneIsPreRelease": "False",
      "productName": "Visual Studio",
      "productPatchVersion": "16",
      "productPreReleaseMilestoneSuffix": "1.0",
      "productRelease": "RTW",
      "productSemanticVersion": "15.9.16+28307.858",
      "requiredEngineVersion": "1.18.1049.33485"
    },
    "properties": {
      "campaignId": "",
      "channelManifestId": "VisualStudio.15.Release/15.9.16+28307.858",
      "nickname": "",
      "setupEngineFilePath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vs_installershell.exe"
    }
  }
]

SlidyBat avatar Oct 13 '20 14:10 SlidyBat

It sounds like it's failing to compile for some reason. You can debug why with this:

cd .ambuild2
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat
cl test.c /o test-c.exe /nologo /showIncludes

dvander avatar Oct 23 '20 06:10 dvander

Compiles (and configures/builds) fine after running vcvars32.bat. image

SlidyBat avatar Oct 23 '20 08:10 SlidyBat