[PATCH/cygwin]: Explicitely undefine _WIN32

Corinna Vinschen vinschen at redhat.com
Sat Mar 17 08:51:50 EST 2012


Hi,


I've just trieed to build OpenSSH on Cygwin with Kerberos support enabled,
and while doing that I stumbled over a problem:

The openbsd-compat/bsd-cygwin_util.h header include a Windows header,
and depending on which Win32 header files are included (Mingw32/Mingw64)
that can result in a `#define _WIN32'.  This in turn can break linking
against some packages.  In my case it's GSSAPI from the heimdal package.
The header file /usr/include/gssapi/gssapi.h contains code like this:

  #if defined(_WIN32)
  #define GSSAPI_LIB_FUNCTION __declspec(dllimport)
  #define GSSAPI_LIB_CALL     __stdcall
  #define GSSAPI_LIB_VARIABLE __declspec(dllimport)
  #else
  #define GSSAPI_LIB_FUNCTION
  #define GSSAPI_LIB_CALL
  #define GSSAPI_LIB_VARIABLE
  #endif

The declspecs are right for the native Win32 Heimdal build, but they
are wrong for the Cygwin library, so linking against libgssapi fails.

Therefore, the below patch explicitely undefined _WIN32 so as not to
break other libraries.

Can somebody with checkin rights please apply this patch?


Index: openbsd-compat/bsd-cygwin_util.h
===================================================================
RCS file: /cvs/openssh/openbsd-compat/bsd-cygwin_util.h,v
retrieving revision 1.13
diff -u -p -r1.13 bsd-cygwin_util.h
--- openbsd-compat/bsd-cygwin_util.h	17 Aug 2011 01:31:09 -0000	1.13
+++ openbsd-compat/bsd-cygwin_util.h	16 Mar 2012 21:51:21 -0000
@@ -37,6 +37,7 @@
 #undef ERROR
 
 #include <windows.h>
+#undef _WIN32
 #include <sys/cygwin.h>
 #include <io.h>
 


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


More information about the openssh-unix-dev mailing list