~~NOTOC~~
====== 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 =====
* [[http://www.microsoft.com/express/2005/download/default.aspx|Microsoft Visual C++ 2005 Express ]]. I go a Pro copy, but the express edition should do fine,
* [[http://www.microsoft.com/downloads/details.aspx?familyid=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en|Microsoft .NET Framework Version 1.1 Redistributable Package]]
* [[http://www.microsoft.com/downloads/details.aspx?familyid=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en|.NET Framework SDK Version 1.1]]
* [[http://www.microsoft.com/msdownload/platformsdk/sdkupdate/XPSP2FULLInstall.htm|Microsoft Platform SDK for Windows XP SP2]]
===== 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 [[http://www.codealias.info/pkgs/kerbsrc.zip|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 {{technotes: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 '{}' \;
{{tag>kerberos windows}}
~~DISCUSSION~~