LDAP C SDK SASL Windows

Building Cyrus SASL on Windows for the LDAP C SDK version 6 and later requires some special instructions.

You cannot use the cygwin environment - you must use the cmd environment provided by the MS Platform SDK.

You can get the Cyrus SASL software from here - http://asg.web.cmu.edu/sasl/sasl-library.html - The rest of the instructions below are for version 2.1.22. Unpack the software (you can just use tar xfz from a cygwin command line) to create the cyrus-sasl-2.1.22 directory.

Step 2: Apply the patches

The default Windows build of Cyrus SASL wants to use the sasldb, which requires Berkeley DB to be installed. The Mozilla LDAP C SDK is a client, so does not need the sasldb stuff. There are two patches which can be applied to make sasldb optional in the build. Patch 1 - ftp://ftp.mozilla.org/pub/mozilla.org/directory/c-sdk/patches/plugins_NTMakefile.patch

cd cyrus-sasl-2.1.22
patch -p0 < plugins_NTMakefile.patch
cd cyrus-sasl-2.1.22
patch -p0 < utils_NTMakefile.patch

Step 3: Open a MS Platform SDK command window

I was not able to get it to build with cygwin. I was only able to get it to build in a command window invoked from the platform SDK, which can be found from the Start menu: Start->All Programs->Microsoft Platform SDK for Windows Server 2003 R2->Open Build Environment Window->Windows Server 2003 32-bit Build Environment->Set Win Svr 2003 32-bit Build Env (Retail) This will open a cmd window with the proper environment set up. NOTE that if you have a different system (XP, Vista) the menu may be slightly different (e.g. Platform SDK for Windows Vista instead of Server 2003). Other build environments may work but this one definitely works for me. You can also create a shortcut on your desktop.

You may need to add the following path to your INCLUDE environment variable:

set INCLUDE=%INCLUDE%;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc

if the build step below complains about missing afxres.h. If this file/path does not exist, use the Start menu Start->Search to find this file and change INCLUDE above to use the correct path.

Step 4: Invoke the build

In your cmd window from Step 3, cd to your cyrus-sasl source directory and invoke nmake e.g.

cd C:\cyrus-sasl-2.1.22
nmake /f NTMakefile

If this works, then install:

nmake /f NTMakefile install

This will install the redistributable package in C:\CMU