Skip to content

Conversation

@PetSerAl
Copy link
Contributor

@PetSerAl PetSerAl commented Jul 1, 2018

PR Summary

PowerShell native windows binaries can be compiled using recent Window 10 SDK versions (for example 10.0.17134.0), but build script build.psm1 does not detect them installed. This PR allow build script to detect them.

PR Checklist

# It is only present if the SDK is installed.
return (Test-Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64\mc.exe")
return (Test-Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\x64\mc.exe") -or
(Test-Path "${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.*.0\x64\mc.exe")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 5 folder on my computer and I don't know path default...
Why we test full path here and use env path search in line 236?
Maybe test Get-Command -Application mc.exe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we test full path here and use env path search in line 236?

Line 236? You mean this?:

Remove-Item $HOME\source\cmakecache.txt -ErrorAction SilentlyContinue

Maybe test Get-Command -Application mc.exe?

mc.exe is not in PATH by default. It is vcvarsall.bat responsibility to locate installed SDK and add it to path:

cmd.exe /C cd /d "$currentLocation" "&" "$vcvarsallbatPath" "$Arch" "&" mc.exe -o -d -c -U "$($_.FullName)" -h "$currentLocation\$nativeResourcesFolder" -r "$currentLocation\$nativeResourcesFolder"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry the line I meant
https://github.com/PetSerAl/PowerShell/blob/8bee005699178008ca78efa306b4d196c53c0a54/build.psm1#L266

On my computer the exe is in PATH

where.exe mc.exe
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\MC.Exe

Perhaps new installer doesn't add this in PATH.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it is not in PATH, unless you call vcvarsall.bat in initialize developer environment:

C:\>where.exe mc.exe
INFO: Could not find files for the given pattern(s).

C:\>"\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'

C:\>where.exe mc.exe
C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64\mc.exe

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Therefore, we can not test the existence of mc.exe before launching vcvarsall.bat, is it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, yes. But I am not the one who implement original check, so I can not state exact reasons, why it was implemented this way.

@TravisEz13
Copy link
Member

This is only needed for native code? @adityapatwardhan should this be moved to the PowerShell-Native repo?

@adityapatwardhan
Copy link
Member

Yes the changes should be made in the https://github.com/PowerShell/PowerShell-native. Please open a PR over there. Thanks!

@daxian-dbw
Copy link
Member

@adityapatwardhan I already merged #7218. Just want you to know in case any changes to native build script should happen in the other repo.

@daxian-dbw
Copy link
Member

@adityapatwardhan I think it's probably better to keep the native-build script up-to-date in the powershell repo until we completely remove it.

@iSazonov
Copy link
Collaborator

iSazonov commented Jul 3, 2018

What is the cut-off date?

@daxian-dbw
Copy link
Member

@iSazonov I don't know a hard cut-off day, but I guess we want to get it done before GA.

@daxian-dbw
Copy link
Member

I will submit a PR in the powershell-native repo for this change and merge and then merge this PR, so that both side are in sync regarding this change.

@adityapatwardhan
Copy link
Member

@PetSerAl Thank you for submitting this PR. The current code is PowerShell/PowerShell-Native repo already has this fix. Closing this PR.

@PetSerAl PetSerAl deleted the win10-sdk-detect branch August 22, 2018 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants