Win32-OpenSSH icon indicating copy to clipboard operation
Win32-OpenSSH copied to clipboard

Unable to build on Windows Server 2016

Open twangboy opened this issue 3 years ago • 8 comments
trafficstars

On Windows Server 2016:

I clone the repo:

git clone https://github.com/PowerShell/openssh-portable.git

I run the build script:

.\openssh-portable\contrib\win32\openssh\OpenSSH-build.ps1

I get the following error (First Bug):

VERBOSE: Start-OpenSSHBuild -NativeHostArch x64 -Configuration Release -NoOpenSSL:False -Onecore:False -Verbose
Checking tools and dependencies
Chocolatey not present. Installing chocolatey.
Start-OpenSSHBuild : Exception calling "DownloadString" with "1" argument(s): "The request was aborted: Could not create SSL/TLS secure channel."
At C:\src\openssh-portable\contrib\win32\openssh\OpenSSH-build.ps1:29 char:5
+     Start-OpenSSHBuild -NativeHostArch $NativeHostArch -Configuration ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Start-OpenSSHBuild], MethodInvocationException
    + FullyQualifiedErrorId : WebException,Start-OpenSSHBuild

So I tell PowerShell to use TLS 1.2:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12

I run the build script again:

.\openssh-portable\contrib\win32\openssh\OpenSSH-build.ps1

It takes a while to start the actual build because it is installing:

  • chocolatey
  • Windows 10 SDK

Then I get the following errors (Second Bug):

 24>c:\src\openssh-portable\config.h(1704): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\src\openssh-portable\contrib\win32\openssh\libssh.vcxproj]
      addrmatch.c
    ClCompile:
      arc4random.c
 24>c:\src\openssh-portable\config.h(1704): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\src\openssh-portable\contrib\win32\openssh\libssh.vcxproj]
 25>c:\src\openssh-portable\config.h(1704): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\src\openssh-portable\contrib\win32\openssh\openbsd_compat.vcxproj]
      base64.c
 24>ClCompile:
      atomicio.c
 24>c:\src\openssh-portable\config.h(1704): fatal error C1083: Cannot open include file: 'io.h': No such file or directory [C:\src\openssh-portable\contrib\win32\openssh\libssh.vcxproj]

Full log here: Log.txt

Are there some environment variables I'm supposed to set up or another dependency that I'm missing?

twangboy avatar Jan 28 '22 22:01 twangboy

@twangboy - We track issues in this repo.

bagajjal avatar Jan 28 '22 23:01 bagajjal

@tgauth - please follow up

bagajjal avatar Jan 28 '22 23:01 bagajjal

@twangboy, can you verify that io.h was installed with the SDK? It should be located here: ${env:ProgramFiles(x86)}\Windows Kits\10\Include\10.0.17763.0\ucrt\io.h

If it was not installed, can you uninstall the SDK, retry the install manually with an increased timeout, then retry the build script: choco uninstall windows-sdk-10.1 choco install "windows-sdk-10.1" --version=10.1.17763.1 -y --force --limitoutput --execution-timeout 240 2>&1

tgauth avatar Jan 31 '22 16:01 tgauth

image

twangboy avatar Jan 31 '22 20:01 twangboy

Thanks. Can you provide the MSBuild diagnostic log? It's located here: .\openssh-portable\contrib\win32\openssh\OpenSSHReleasex64.log

Another thought - have you tried to rerun the build script in a new PowerShell session after installing the Windows 10 SDK? The script checks if a computer restart is necessary after some package installs via chocolatey, but currently there is no check in place after the SDK install.

tgauth avatar Feb 03 '22 16:02 tgauth

I have tried a new shell and I have tried rebooting the machine.

OpenSSHReleasex64.log

twangboy avatar Feb 08 '22 21:02 twangboy

Thanks for the log file.

Can you replace .\openssh-portable\contrib\win32\openssh\OpenSSHBuildHelper.psm1 with the contents of this file and retry the build? We were explicitly setting env:vctargetspath for Visual Studio 2015, but newer versions might not need that.

tgauth avatar Feb 14 '22 23:02 tgauth

It might be easier to build in Visual Studio directly until we can work on the build script fixes - updates have been made to the build instructions

tgauth avatar Feb 23 '22 22:02 tgauth