Search code examples
visual-c++windows-7cygwinopenssh

Running MSVC via CMake using ssh to Cygwin works if using a password to login but not with a public key


We have a Windows 7 desktop that we're hoping to use to run automated tests of a Windows port of our C++ code. It's successfully using a CMake build system, compiling with Visual Studio 10.0, if logged in locally. The automated test system we're using needs to ssh to the build machines using public-key authentication, so I've installed Cygwin and have sshd running as a service in a separate account (cyg_server). I can connect to it fine, logging in to the build account using its password, and run the build without issues. However, if I then add the public-key authentication, I can still log in fine, but the build fails, even if I'm logged in and running the build manually, so it's a login interactive bash shell just as for the working case! The error message is

3>LINK : fatal error LNK1101: incorrect MSPDB100.DLL version; recheck installation of this product

for every link step.

What could be different in the environment between password and public-key authentication that's causing this? Note that everything else is identical between a working and failing case - only the authentication method has changed, and this is repeatable so it's not running builds in a particular sequence that's at fault.


Solution

  • Probably what you need to do is run cyglsa-config in a Cygwin bash shell and then reboot the system. You might need to start the shell by right-clicking the Cygwin shell shortcut and selecting "Run as administrator", otherwise cyglsa-config may fail with a permission error. I had the same issue (with a different version of Visual C++), and cyglsa-config fixed it.

    The following page from the Cygwin documentation explains the issues related to Windows security:

    http://cygwin.com/cygwin-ug-net/ntsec.html

    The relevant stuff starts in the section called "Switching the user context". It specifically mentions that the default approach has problems with Visual C++.