The GnuTLS Guile bindings are available for Guile’s 2.0 stable series, as well as the forthcoming 2.2 series and the legacy 1.8 series.
By default they are installed under the GnuTLS installation directory, typically /usr/local/share/guile/site/). Normally Guile will not find the module there without help. You may experience something like this:
$ guile … scheme@(guile-user)> (use-modules (gnutls)) ERROR: no code for module (gnutls)
There are two ways to solve this. The first is to make sure that when
building GnuTLS, the Guile bindings will be installed in the same
place where Guile looks. You may do this by using the
--with-guile-site-dir parameter as follows:
$ ./configure --with-guile-site-dir=no
This will instruct GnuTLS to attempt to install the Guile bindings
where Guile will look for them. It will use
pkgdatadir to learn the path to use.
If Guile was installed into
/usr, you may also install GnuTLS
using the same prefix:
$ ./configure --prefix=/usr
If you want to specify the path to install the Guile bindings you can also specify the path directly:
$ ./configure --with-guile-site-dir=/opt/guile/share/guile/site
The second solution requires some more work but may be easier to use
if you do not have system administrator rights to your machine. You
need to instruct Guile so that it finds the GnuTLS Guile bindings.
Either use the
GUILE_LOAD_PATH environment variable as follows:
$ GUILE_LOAD_PATH="/usr/local/share/guile/site:$GUILE_LOAD_PATH" guile scheme@(guile-user)> (use-modules (gnutls)) scheme@(guile-user)>
Alternatively, you can modify Guile’s
(see Guile’s run-time options in The GNU Guile
At this point, you might get an error regarding guile-gnutls-v-2 similar to:
gnutls.scm:361:1: In procedure dynamic-link in expression (load-extension "guile-gnutls-v-2" "scm_init_gnutls"): gnutls.scm:361:1: file: "guile-gnutls-v-2", message: "guile-gnutls-v-2.so: cannot open shared object file: No such file or directory"
In this case, you will need to modify the run-time linker path, for example as follows:
$ LD_LIBRARY_PATH=/usr/local/lib GUILE_LOAD_PATH=/usr/local/share/guile/site guile scheme@(guile-user)> (use-modules (gnutls)) scheme@(guile-user)>
To check that you got the intended GnuTLS library version, you may print the version number of the loaded library as follows:
$ guile scheme@(guile-user)> (use-modules (gnutls)) scheme@(guile-user)> (gnutls-version) "3.6.1" scheme@(guile-user)>