Win32-OpenSSH
Win32-OpenSSH copied to clipboard
How to compile ssh withU2F-Support
Hi, I am interested in an ssh-client with U2F-Support. I read the building page, but it fails to compile in CLI and GUI Mode.
first, I'm not sure if I should submit this issue to PowerShell/Win32-OpenSSH or PowerShell/openssh-portable. Could you please clarify which repo is good for what? I am from the Linux world and I am not exactly sure how to read the .sln file. Is it correct you have to manually update this file to make it work with Visual Studio 22?
How to attach log files to have them readable here? They seem to get scrambled.
Thanks, Michael!
CLI:
`
PS C:\Users\molli> git clone https://github.com/PowerShell/openssh-portable
PS C:\Users\molli> cd .\openssh-portable
PS C:\Users\molli\openssh-portable> ipmo .\contrib\win32\openssh\OpenSSHBuildHelper.psm1 -Force
PS C:\Users\molli\openssh-portable> Start-OpenSSHBuild -Configuration Release -NativeHostArch x64
installing visualcpp-build-tools
The variable '$packageName' cannot be retrieved because it has not been set.
At C:\Users\molli\openssh-portable\contrib\win32\openssh\OpenSSHBuildHelper.psm1:237 char:69
- ... te-BuildMsg -AsError -ErrorAction Stop -Message "$packageName install ...
-
~~~~~~~~~~~~
- CategoryInfo : InvalidOperation: (packageName:String) [], RuntimeException
- FullyQualifiedErrorId : VariableIsUndefined
vcbuildtools not present. Installing vcbuildtools ... Write-BuildMsg : vcbuildtools installation failed with error code 1. At C:\Users\molli\openssh-portable\contrib\win32\openssh\OpenSSHBuildHelper.psm1:293 char:13
-
Write-BuildMsg -AsError -ErrorAction Stop -Message "$pack ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
- FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-BuildMsg
PS C:\Users\molli\openssh-portable> `
GUI (no matter if I convert the Project file or not)
Build started... 1>------ Build started: Project: config, Configuration: Release x64 ------ 1>Generate crtheaders.h and config.h; fetch libressl sdk 1>Copy install-sshd.ps1, uninstall-sshd.ps1, OpenSSHUtils.psm1, OpenSSHUtils.psd1, FixHostFilePermissions.ps1, FixUserFilePermissions.ps1, ssh-add-hostkey.ps1, sshd_config (as sshd_config_default), openssh-events.man, moduli to build directory 1>C:\Users\molli\source\repos\openssh-portable\contrib\win32\openssh\install-sshd.ps1 1> 1 file(s) copied. 1>C:\Users\molli\source\repos\openssh-portable\contrib\win32\openssh\uninstall-sshd.ps1 1> 1 file(s) copied. 1>C:\Users\molli\source\repos\openssh-portable\contrib\win32\openssh\OpenSSHUtils.psd1 1>C:\Users\molli\source\repos\openssh-portable\contrib\win32\openssh\OpenSSHUtils.psm1 1> 2 file(s) copied. 1>C:\Users\molli\source\repos\openssh-portable\contrib\win32\openssh\FixHostFilePermissions.ps1 1>C:\Users\molli\source\repos\openssh-portable\contrib\win32\openssh\FixUserFilePermissions.ps1 1> 2 file(s) copied. 1> 1 file(s) copied. 1> 1 file(s) copied. 1> 1 file(s) copied. 1> 1 file(s) copied. 2>------ Build started: Project: posix_compat, Configuration: Release x64 ------ 2>w32fd.c 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\direct.h(117,10): warning C4030: first formal parameter list longer than the second list 2>signal.c 2>socketio.c 2>fileio.c 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(452,14): warning C4028: formal parameter 2 different from declaration 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\direct.h(117,10): warning C4030: first formal parameter list longer than the second list 2>termio.c 2>misc.c 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\direct.h(117,10): warning C4030: first formal parameter list longer than the second list 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(452,14): warning C4028: formal parameter 2 different from declaration 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(495,1): error C2143: syntax error: missing ')' before '(' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(495,1): error C2059: syntax error: ')' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(495,14): error C2143: syntax error: missing ')' before ';' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(495,14): error C2091: function returns function 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(493,1): error C2373: 'w32_isatty': redefinition; different type modifiers 2>C:\Users\molli\source\repos\openssh-portable\contrib\win32\win32compat\inc\unistd.h(33): message : see declaration of 'w32_isatty' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(509,14): warning C4028: formal parameter 2 different from declaration 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(521,1): error C2143: syntax error: missing ')' before '(' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(521,1): error C2059: syntax error: ')' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(521,1): error C2059: syntax error: '(' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(521,1): error C2143: syntax error: missing ')' before 'type' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(521,1): error C2091: function returns function 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(518,1): error C2373: 'w32_open': redefinition; different type modifiers 2>C:\Users\molli\source\repos\openssh-portable\contrib\win32\win32compat\inc\fcntl.h(20): message : see declaration of 'w32_open' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(521,1): error C2085: '_OpenFlag': not in formal parameter list 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(521,1): error C2059: syntax error: '...' 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(529,14): warning C4028: formal parameter 3 different from declaration 2>C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\ucrt\corecrt_io.h(564,14): warning C4028: formal parameter 3 different from declaration 2>C:\Users\molli\source\repos\openssh-portable\contrib\win32\win32compat\misc.c(563,40): warning C4028: formal parameter 2 different from declaration 2>C:\Users\molli\source\repos\openssh-portable\contrib\win32\win32compat\misc.c(761,6): warning C4996: 'w32_rmdir': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _rmdir. See online help for details. 2>C:\Users\molli\source\repos\openssh-portable\contrib\win32\win32compat\misc.c(873,1): warning C4029: declared formal parameter list different from definition 2>signal_sigalrm.c 2>signal_sigchld.c 2>w32api_proxies.c 2>win32_usertoken_utils.c 2>w32log.c 2>pwd.c 2>win32_dirent.c 2>no-ops.c 2>ansiprsr.c 2>console.c 2>tncon.c 2>tnnet.c 2>utf.c 2>spawn.c 2>Compiling... 2>signal_wait.c 2>win32_pty.c 2>gss-sspi.c 2>sshTelemetry.c 2>Done building project "win32iocompat.vcxproj" -- FAILED. 3>------ Build started: Project: ssh, Configuration: Release x64 ------ 3>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(1087,5): error MSB6006: "link.exe" exited with code 1181. 3>LINK : fatal error LNK1181: cannot open input file 'posix_compat.lib' 3>Done building project "ssh.vcxproj" -- FAILED. ========== Build: 1 succeeded, 2 failed, 2 up-to-date, 0 skipped ==========
@michaelfuckner, please refer to https://github.com/PowerShell/Win32-OpenSSH/issues/1804#issuecomment-1005338940.
We will get back to you on the build errors.
@michaelfuckner, yes - you opened the issue in the correct repo. PowerShell/Win32-OpenSSH is preferred.
For the CLI build, OpenSSHBuildHelper.psm1 is not compatible with Visual Studio 2022, yet. Sorry about that!
For the GUI build, you should not have to manually modify the project file. I think the issue is with the Windows SDK version. The build errors suggest the latest Windows SDK (10.0.22000.0) is being used. There are some compilation issues with newer versions of the Windows SDK. I suggest building with Windows SDK version 10.0.17763.0, as specified in paths.targets. If needed, the install can be found at: https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/. When opening the Win32-OpenSSH.sln in Visual Studio for the first time, you are prompted to select the Windows SDK version and platform toolset. Otherwise, you may have to select the properties of each individual project in the Solution Explorer and change the Windows SDK version, then build.
Please let me know if there continues to be issues.
Build instructions really need to be updated:
- "Building using Visual Studio 2015" shouldn't be the only option offered as now we have 2022 (I'm not sure older versions are even available in some "community edition" flavor anymore)
- Asking for If you are building for the first time then please follow "Building OpenSSH for Windows" mentioned above. doesn't seem to be needed, what's more it contains the "Start-OpenSSHBuild" which fails
- getting and selecting specifically Windows SDK version 10.0.17763.0 as mentioned above should be included
Especially that it works so nicely in Visual Studio, just open the sln, pick the right SDK version and build :-)
Thanks for highlighting these documentation gaps, @vb0.
Updates have been made - https://github.com/PowerShell/Win32-OpenSSH/wiki/Building-OpenSSH-for-Windows-(using-LibreSSL-crypto)