[Help-gnutls] Re: Build gnutls on windows

Martin Lambers marlam at marlam.de
Fri Sep 23 21:35:17 CEST 2005


On Fri, 23. Sep 2005, 00:46:27 +0200, Simon Josefsson wrote:
> > Reasonable POSIX support on Win32 is not just a collection of fixes for
> > minor misbehaviour; it is a major task. Perhaps it would be better to
> > leave that to an external project and only support "MinGW + plibc" (or
> > something similar) as a target platform.
> 
> Yes, I think you are right.  However, it isn't impossible to integrate
> something like plibc in gnulib, or in GnuTLS itself.  Then the GnuTLS
> core code will be good and the resulting binaries should run properly
> too.  I'm not sure GnuTLS need a lot from POSIX, perhaps we can even
> integrate the plibc functions we need in GnuTLS.

Judging from some quick greps, I think at least the following is
necessary to get rid of #ifdef _WIN32:

- Integration of existing gnulib modules:
  - inet_ntop

- New gnulib modules for missing headers:
  - <sys/socket.h>
  - <netinet/in.h>
  - <arpa/inet.h>
  - <netdb.h>

- New gnulib modules to make socket functions set errno, provide
  the missing errnos such as ECONNREFUSED, and provide a strerror() that
  understands these additional errnos.
  - select()
  - connect()
  - accept()
  - recv()
  - send()
  - ...

- New gnulib modules to make some functions work with sockets:
  - close()
  - fcntl() which handles O_NONBLOCK for sockets

- Call WSAStartup() / WSACleanup() somewhere without having them in the
  main code.

- Non-networking issues:
  - getpwuid(), getuid()
  - signal handling:
    Using SIGALARM for network timeouts could be replaced by using
    setsockopt with SO_RCVTIMEO and SO_SNDTIMEO. But this does not work on
    Windows <= 2000 and on several UNIX versions including Solaris. It does
    work on GNU/Linux and *BSD.

I'm sorry to say that I currently don't have enough spare time to be
able to work on these things.

> Btw, have you tested to run a mingw32 built gnutls-cli on a Windows
> platform?  It shouldn't be too hard to test it to see whether it works
> or almost works.

It does not. I tested
$ gnutls-cli.exe --print-cert --port 25 --starttls some.smtp.server
It hangs after printing "Simple Client Mode:".  That's because select()
is called and the test after the call assumes that errno is set. This
results in an endless loop.

Martin





More information about the Gnutls-help mailing list