Building 64-bit postgres with GSS support on windows - Mailing list pgsql-hackers

From Victor Wagner
Subject Building 64-bit postgres with GSS support on windows
Date
Msg-id 20181017104701.6e00f13d@fafnir.local.vm
Whole thread Raw
List pgsql-hackers
Colleagues,

I've encountered some problems trying to enable gss support in MSVC
build of Postgres (I've experemented with REL_10_STABLE branch, but
code in question seems to be same in all supported releases, including
master).

As it is recommended in the documentation, I've downloaded MIT Kerberos
from  http://web.mit.edu/Kerberos/dist/index.html

They distribute latest version (4.1) of Kerberos as .msi installer which
installs into C:\Program Files. (32-bit version probably would install
into C:\Program Files(x86), but I've not tried it yet).

Here comes first problem.

Project->AddLibrary unconditionally quotes paths with spaces.
But some contrib modules which depends on PL language, use
Mkvcbuild::AddTransformModule for generating dependences.
It gets list of (already quoted) librariy name from dependency project
and adds them to the current project. 

I haven't investigate whether adding kerberos, xml, icu etc libraries
three times to linker command line does any good, but it works. And
double quoting filename with quotes definitely breaks things.

Fix is quite simple:

diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm
index 9817b94..3749c17 100644
--- a/src/tools/msvc/Project.pm
+++ b/src/tools/msvc/Project.pm
@@ -126,7 +126,7 @@ sub AddLibrary
 {
        my ($self, $lib, $dbgsuffix) = @_;

-       if ($lib =~ m/\s/)
+       if ($lib =~ m/\s/ && !$lib =~m/^\".*\"$/)
        {
                $lib = '"' . $lib . """;
        }

I suppose this would help with any 3-rd party library installed into
directory with spaces in the names, not just Kerberos.


Second problem is that names of 32-bit libraries and library directories
are hard-coded into Solution.pm

$self->{options}->{gss} . '\lib\i386\krb5_32.lib'

And for 64-bit build
'\lib\amd64\krb5_64.lib' is needed (at least for this MIT Kerberos 4.1)

There is similar platform differences with other libraries, such as
ICU, and check if ($self->{platform} eq 'Win32') is used for them.
But there is no such thing for gss libraries.

And third problem is that Solution.pm expect includes in 
$self->{options}->{gss}.'\inc\krb5' but
for Kerberos 4.1 
$self->{options}->{gss}.'\include" is needed.

I haven't dig into computer archeology and havent checked when this
change occured, just check if directore '\include' exist and use it
if so.

Attached patch fixes these problems.

                        Regrards, Victor.
--

Attachment

pgsql-hackers by date:

Previous
From: Haribabu Kommi
Date:
Subject: Re: View to get all the extension control file details
Next
From: Richard Guo
Date:
Subject: Pull up sublink of type 'NOT NOT (expr)'