Compile with 64-bit kerberos on Windows
Hi, hackers.
I'm trying to build 64-bit windows binaries with kerberos support.
I downloaded latest kerberos source package from here:
https://kerberos.org/dist/index.html
I followed the the instructions in src\windows\README, and executed the
following script in 64-bit Visual Studio Command Prompt to build and
install it.
set NO_LEASH=1
set PATH=%PATH%;"%WindowsSdkVerBinPath%"\x86
set KRB_INSTALL_DIR=C:\krb5
cd src
nmake -f Makefile.in prep-windows
nmake NODEBUG=1
nmake install NODEBUG=1
To compile postgres with kerberos support, we need to configure the install
location in src/tools/msvc/config.pl
our $config = {gss => 'C:/krb5'};
If I run build.pl the compiler will complain about gssapi.h not found.
At src/tools/msvc/Solution.pm line 633, we can see the include directory is
set to '\inc\krb5'. This is no longer the case for 64-bit kerberos package.
The correct include directory is '\include'. The library paths also need to
be fixed with 64-bit version.
Here's a patch to fixed these paths, with this patch we can build 64-bit
binaries with kerberos support successfully.
Best regards,
Peifeng Qiu
Attachments:
compile-with-64-bit-kerberos-on-windows-v1.patchapplication/octet-stream; name=compile-with-64-bit-kerberos-on-windows-v1.patchDownload
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 2ea224d770..b1a73faa8b 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -630,10 +630,20 @@ sub AddProject
}
if ($self->{options}->{gss})
{
- $proj->AddIncludeDir($self->{options}->{gss} . '\inc\krb5');
- $proj->AddLibrary($self->{options}->{gss} . '\lib\i386\krb5_32.lib');
- $proj->AddLibrary($self->{options}->{gss} . '\lib\i386\comerr32.lib');
- $proj->AddLibrary($self->{options}->{gss} . '\lib\i386\gssapi32.lib');
+ if ($self->{platform} eq 'Win32')
+ {
+ $proj->AddIncludeDir($self->{options}->{gss} . '\inc\krb5');
+ $proj->AddLibrary($self->{options}->{gss} . '\lib\i386\krb5_32.lib');
+ $proj->AddLibrary($self->{options}->{gss} . '\lib\i386\comerr32.lib');
+ $proj->AddLibrary($self->{options}->{gss} . '\lib\i386\gssapi32.lib');
+ }
+ else
+ {
+ $proj->AddIncludeDir($self->{options}->{gss} . '\include');
+ $proj->AddLibrary($self->{options}->{gss} . '\lib\krb5_64.lib');
+ $proj->AddLibrary($self->{options}->{gss} . '\lib\comerr64.lib');
+ $proj->AddLibrary($self->{options}->{gss} . '\lib\gssapi64.lib');
+ }
}
if ($self->{options}->{iconv})
{