Subject: bug#8825: 24.0.50; Problem with builtin gnutls on Windows

From: [email-masked]
Date: Tue, 14 Jun 2011 19:28:37 -0400

Sean Sieger <[email-masked]> writes:

> [email-masked] writes:
>
>     I have the DLL libgnutls-26.dll in my PATH as well as in `exec-path`.
>
> Does the `26' refer to the version?  The binary is built against
> gnutls.h of version 2.10.

This DLL is from gnutls-2.10.1.zip which was obtained from
http://josefsson.org/gnutls4win.  This is the location you are
sent to when you click on the "windows" link on the page
http://www.gnu.org/software/gnutls.

Inside the ZIP file, among other files, is libgnutls-26.dll.

I also tried the previous version, gnutls-2.10.0.zip, which is the
one I think you said you had, with the same result.

Both gnutls.h files from 2.10.1 and 2.10.0 were identical except
for:

#define GNUTLS_VERSION
#define GNUTLS_VERSION_PATCH
#define GNUTLS_VERSION_NUMBER

I'm begining to think that the problem is in the way that gnutls
is called and/or its error handling.

When I try the test from the *scratch* buffer:

(require 'gnutls)
gnutls
(open-gnutls-stream "tls" "tls-buffer" "imap.aim.com" "imaps")

I get the *Backtrace* error:

Debugger entered--Lisp error: (void-function gnutls-boot)
  gnutls-boot(#<process tls> gnutls-x509pki (:priority "NORMAL" :hostname "imap.aim.com" :loglevel 0 :trustfiles nil :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :verify-hostname-error nil :callbacks nil))
  gnutls-negotiate(:process #<process tls> :type gnutls-x509pki :hostname "imap.aim.com")
  open-gnutls-stream("tls" "tls-buffer" "imap.aim.com" "imaps")
  eval((open-gnutls-stream "tls-" "tls-buffer" "imap.aim.com" "imaps") nil)
  eval-last-sexp-1(t)
  eval-last-sexp(t)
  eval-print-last-sexp()
  call-interactively(eval-print-last-sexp nil nil)
  recursive-edit()
  debug(error (void-function gnutls-boot))

But I do get the 'tls-buffer' and a TCP ESTABLISHED connection:

I did get in `process-list':

tls		open	tls-buffer	--	     (network connection to imap.aim.com)

I also got an ESTALISHED TCP connection:

  TCP    XXX.XXX.XXX.XXX:4151       205.188.58.10:993      ESTABLISHED

The `tls-buffer' is empty for a while and then when it timesout it
contains:

Process tls connection broken by remote peer

Gnus gets the same "void: gnutls-boot" error:

Opening nnimap server on aol...
Opening connection to imap.aim.com via tls...
Unable to open server nnimap+aol due to: Symbol's function definition is void: gnutls-boot
Opening nnimap server on aol...failed: 

Is it the handshaking that is failing?

I turned on debugging '(setq gnutls-log-level 1)' but got no debugging
information in the *Messages* buffer.

Juanma said he successfully built Emacs 24 on Windows and was able
to test builtin gnutls.

Juanma:

Are you using the libgnutls-26.dll in gnutls-2.10.1.zip (or
gnutls-2.10.0.zip) from http://josefsson.org/gnutls4win?

Are you linking, explicitly, to a gnutls library when building?

Does libgnutls-26.dll show up when you do the equivalent of ldd
on the emacs.exe binary?

Sean's build is implicitly/dynamically using libgnutls-26.dll.
I believe he only has the gnutls.h file and not any other file
from the gnutls-2.10.0.zip archive.

The variable `dynamic-library-alist' shows:

Value: ((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll")
 (png "libpng14-14.dll" "libpng14.dll")
 (jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll")
 (tiff "libtiff3.dll" "libtiff.dll")
 (gif "giflib4.dll" "libungif4.dll" "libungif.dll")
 (svg "librsvg-2-2.dll")
 (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
 (glib "libglib-2.0-0.dll")
 (gobject "libgobject-2.0-0.dll")
 (gnutls "libgnutls-26.dll"))

I'm on Windows XP, if it matters.

Thanks.