Wednesday, January 20, 2010

fatal error C1902: Program database manager mismatch; please check your installation

fatal error C1902: Program database manager mismatch; please check your installation

Build/Test automation of VC2005 project fails with the above error message in case automation scripts is having logic of *nix-win communication over ssh.

Scenario:
*nix ssh client connects to cygwin ssh server and executes make which uses CL(VC2005 compiler). Run fails with the error message in the subject line.
As evident from the link below.
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=123792

Workaround at the link above made our day and solved the issue.
Workaround: Run cygwin ssh server with the same user as that of *nix user through which one is connecting over ssh.

In our case user in question was "build". So we ran cygwin ssh server with "build" user and had *nix user as "build" to connect over ssh for script run.

By default cygwin ssh server run with user as LocalSystem Account. To make it run with "build" user we followed the steps below.

Create a user "build" with Administrative privilege on cygwin box.

Steps to run cygwin ssh server with "build" user.

1. Change the login ID of the Cygwin sshd service.


- From the Windows Start menu, click Settings > Control Panel > Administrative Tools > Services.

- From the Services window, right-click CYGWIN sshd, and select Properties.

- From the Properties window, select the General tab, and click Stop to stop the sshd service.


Next, select the Log on tab, Under the Log on as section or prompt, clear the Local System account radio button, and select This account. Type .\build as the ID and type the password for the account. Click Apply.

2. Grant additional rights to the build account so that "build" user has required privileges in addition to membership to the Administrators group.


- From the Windows Start menu, click Settings > Control Panel > Administrative Tools > Local Security Policy.

- From the Local Security Settings window, expand Local Policies, and select User Rights Assignment.

- From the resulting page that appears on the right, verify that the root account has the following four rights:
* Adjust memory quotas for a process
* Create a token object
* Log on as a service
* Replace a process level token
If not, add "build" as a user with the four rights.

For Win2000, the first item in the list above is displayed as Increase quotas instead of Adjust memory quotas for a process.
* Close Local Security Settings window.


3. From a Cygwin console panel, change ownership of the following directories and files to build:


* $ chown build /var/log/sshd.log
* $ chown -R build /var/empty
* $ chown build /etc/ssh*


4. Restart the Cygwin sshd server.


- From the Properties page of the Cygwin sshd server, select the General tab, and click Start. Verify that Cygwin is now running under the build user account.

- OR From cygwin prompt say $net start sshd.


Thanks to the IBM Knowledge Base for the above solution.