Building MIT Kerberos in Windows using MSVS 8


The build process of MIT Kerberos under windows is not straight forward. Some tweaking with the makefiles is needed to compile the sources. This article explains is how I compiled krb5-1.6.3 using the Microsoft Visual Studio 2005 SDK.


1. Install the MSVS 2005, .NET 1.1, .NET 1.1 SDK


2. Install cygwin

Make sure to have the following binaries installed : gawk, zip, make, cat, sed and cp

Note : If you face issues with cygwin, use msys instead


2. Download my cooked kerbsrc.zip source and build it

Just following the instructions in the README file does not allow you to compile MIT Kerberos in Windows. The developers acknowledged that there are some issues. To actually build Kerberos under windows. Download this archive uncompress it then open Microsoft Visual Studio shell (Start → All Programs → Microsoft Visual Studio 2005 → Visual Studio Tools → Visual Studio 2005 Command Prompt ). In the command prompt that appears, type.

C:\Program Files\Microsoft Visual Studio 8\VC\bin\vcvars32.bat

To set environment variables. Then then build the source by typing.

nmake NODEBUG=1

If you face any problems at this stage, verify that your environment variables are set correctly. They should look like this :

Path=C:\cygwin\bin;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE;C:\Program Files\Microsoft Visual Studio 8\VC\BIN;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools;C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\bin;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\VCPackages;C:\MinGW\site\bin;C:\MinGW\bin;C:\Perl\site\bin;C:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\SFU\common\;C:\PROGRA~1\Tcl\bin;C:\Program Files\Tcl\bin;C:\MinGW\site\bin;C:\MinGW\bin;C:\Perl\site\bin;C:\Perl\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\SFU\common\;C:\PROGRA~1\Tcl\bin;C:\Qt\4.3.0\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
LIB=C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\LIB;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\lib;
LIBPATH=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\LIB
INCLUDE=C:\Program Files\Microsoft Visual Studio 8\VC\ATLMFC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE;C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\include;

To update your environment variables, use the following syntax.

Set Path=some/path;%Path%
Set LIB=some/lib/path;%LIB%
Set INCLUDE=some/inc/path;%INCLUDE%

This what I had to do to build a kerbsrc.zip that compiles correctly :

  • Change some \ by / in Makfile.in
420c420
< HOUT =	$(INC)krb5\krb5.h $(GG)gssapi.h $(PR)profile.h

---
> HOUT =	$(INC)krb5/krb5.h $(GG)gssapi.h $(PR)profile.h
517c517
< KRBHDEP = $(INC)krb5\krb5.hin $(INC)krb5_err.h $(INC)kdb5_err.h \
---
> KRBHDEP = $(INC)krb5/krb5.hin $(INC)krb5_err.h $(INC)kdb5_err.h \
520c520
< $(INC)krb5\krb5.h: $(KRBHDEP)
---
> $(INC)krb5/krb5.h: $(KRBHDEP)

This is the resulting new Makefile.in makefile-new.in

  • Create kerbsrc.zip

Now you should be able to create a zip file kerbsrc.zip as follows :

Open a cygwin or msys console, then go to krb5-1.6.3\src and run

make -f Makefile-new.in kerbsrc.zip
  • Unzip kerbsrc.zip and copy some missing stuff
xcopy /E /I C:\msys\1.0\home\zrelli\krb5-1.6.3\src\appl .\appl
xcopy /E /I C:\msys\1.0\home\zrelli\krb5-1.6.3\src\clients .\clients
xcopy /E /I C:\msys\1.0\home\zrelli\krb5-1.6.3\src\lib\crypto\aes .\lib\crypto\aes
xcopy /E /I C:\msys\1.0\home\zrelli\krb5-1.6.3\src\util\support .\util\support
xcopy /E /I C:\msys\1.0\home\zrelli\krb5-1.6.3\src\include\stock .\include\stock

Now the kerbsrc is ok to compile using Microsoft Visual Studio 2005. The kerbsrouce.zip that I put online, is the result of the changes described above.


Final notes

The nmake clean command does not work, to remove the obj dirs, do :

find . -name obj -exec rm -rf '{}' \;


Labels: , Wireless Internet Security Coding Network Monitoring

Comment

Jamie Kirkpatrick, 2010/07/15 02:16

I realise you probably did this god knows how long ago, but I just wanted to say thanks! I was having a nightmare this afternoon trying to get anything to compile up on Windows at all and this page has given me something to go on: your “cooked” sources see

Enter your comment (wiki syntax is allowed):
LZJIJ

Wireless Internet Security Performance RADIUS server Wireless Internet Security Performance RADIUS server