I meant to follow up on this. I have made it build on Windows 😊

I needed to extend the FindGSSAPI.cmake file as I said, the final addition 
looks like this:

if (WIN32)
    if (EXISTS "C:\Program Files\\MIT\\Kerberos")
        set(GSSAPI_FLAVOR_MIT TRUE)
        set(GSSAPI_ROOT_DIR "C:\\Program Files\\MIT\\Kerberos")
        set(GSSAPI_INCLUDE_DIR ${GSSAPI_ROOT_DIR}\\include)
        set(GSSAPI_LIBRARIES ${GSSAPI_ROOT_DIR}\\lib\\amd64\\gssapi64.lib 
${GSSAPI_ROOT_DIR}\\lib\\amd64\\krb5_64.lib 
${GSSAPI_ROOT_DIR}\\lib\\amd64\\comerr64.lib)
    endif()
endif (WIN32)

All the compilation errors related to the joy that is Winsock – windows.h 
includes winsock.h (winsock 1.x) so if you include winsock2.h (like Kerberos) 
then it blows up. You can avoid it by defining WIN32_LEAN_AND_MEAN which I 
simply added to gssapi.c to make it work. My cmake knowledge is pretty limited 
so I wasn’t sure how to pass WIN32_LEAN_AND_MEAN another way. Ideally it would 
be nice to be able to define the GSSAPI_ROOT_DIR like we can for zlib/openssl 
but the hardcoded path works for now. Also its hardcoded for a 64 bit build …

I’d produce some patches but my current changes feel a bit hacky. If something 
can help me do this properly with cmake I’ll see what I can do

Adam

From: Aris Adamantiadis <[email protected]>
Sent: 03 August 2021 11:12
To: [email protected]
Subject: [EXTERNAL] Re: Building libssh with GSSAPI support on Windows?


Hi Adam,

I'm afraid I don't have a good answer. Afaik no one tried to compile GSSAPI 
support on windows before. The problems you have seem to come from the windows 
headers themselves. Maybe try to remove a few network-related headers in 
gssapi.c until it doesn't complain about redefinitions.

For the other warnings, you can ignore them even if it would be better in the 
long run to fix them.



Aris


Le 29/07/21 à 10:15, Kerrison, Adam a écrit :
Hello

As the subject says, I am attempting to build libssh 0.9.5 with GSSAPI support 
on Windows. From what I’ve figure out, this hasn’t been done before, as the 
FindGSSAPI.cmake module doesn’t even attempt to find the libs on anything but 
UNIX.

I’ve got the Kerberos for Windows package installed so I’ve added a section to 
the FindGSSAPI.cmake module which allows the cmake generator to run:

if (WIN32)
    if (EXISTS "C:\Program Files\\MIT\\Kerberos")
        set(GSSAPI_FLAVOR_MIT TRUE)
        set(GSSAPI_ROOT_DIR "C:\\Program Files\\MIT\\Kerberos")
        set(GSSAPI_LIBRARIES "gssapi64.lib krb5_64.lib comerr64.lib")
    endif()
endif (WIN32)

It reports GSSAPI: ON 😊

However, when the actual build runs its all fine until it reaches the gssapi.c 
then it just fails with a myriad of warnings and errors. Some examples:

C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ws2def.h(100): warning 
C4005: 'AF_IPX': macro redefinition [C:\src\buildroot\src\ssh.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock.h(452): note: see 
previous definition of 'AF_IPX'
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\ws2def.h(421): error 
C2059: syntax error: 'constant' [C:\src\buildroot\src\ssh.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\um\winsock2.h(2499): error 
C2375: 'WSACancelBlockingCall': redefinition; different linkage 
[C:\src\buildroot\src\ssh.vcxproj]

Also, quite a few other files complain about a possible loss of data (it’s a 64 
bit build), for example:

C:\src \libssh-0.9.5\src\base64.c(191): warning C4244: '=': conversion from 
'__int64' to 'unsigned int', possible loss of data 
[C:\src\buildroot\src\ssh.vcxproj]

Has anyone tried to build libssh with GSSAPI support on Windows? Does anyone 
have a clue what is wrong here? I’ve built plenty of packages on Linux and 
Windows but I’m not very experienced with MS Visual Studio and the vxproj files 
seem like voodoo to me ☹

Thanks

Adam

BMC Software Limited Registered Office: Building E2, Eskdale Road, Winnersh, 
Wokingham, Berkshire, United Kingdom, RG41 5TS Registered in England No. 
1927903 The content of this email is confidential. If you are not the 
addressee, you may not distribute, copy or disclose any part of it. If you 
receive this message in error, please delete this from your system and notify 
the sender immediately.
BMC Software Limited Registered Office: Building E2, Eskdale Road, Winnersh, 
Wokingham, Berkshire, United Kingdom, RG41 5TS Registered in England No. 
1927903 The content of this email is confidential. If you are not the 
addressee, you may not distribute, copy or disclose any part of it. If you 
receive this message in error, please delete this from your system and notify 
the sender immediately.

Reply via email to