Building Gnutls by yourself
by Catonano — ven 01 febbraio 2019
What happened
on the fediverse
On the fediverse I have been asked to wrote a few notes about how I managed to build Gnutls by myself on Ubuntu 18.04.1
Ubuntu comes with Gnutls BUT the Ubuntu build has no Guile bindings.
So all the Guile based pacages fail to build or to run.
Among them, notably, Guix.
Yes, with this, I managed ti build Guix on Ubuntu. Build, not run (yet).
So let's go to begin
Custom location
I chose to install my custom built system pieces in my home folder.
I could have used /opt
. That would have been completely separated from system managed packages.
But for some psyhological phenomenon, I preferred my home folder. So I won´t nee to use su for every little step.
So keep in mind that I will use $HOME/opt
form now on but you could easily change that to /opt or whatever other position you might like.
step 0: Nettle
Nettle is a dependency of Gnutls. A recent Gnutls requires Nettle 3.4.1 and Ubuntu comes with Nettle 3.4. That won't do.
Because of a glitch, I posted on the Gnutls help mailing list asking how to build Nettle, and this is what I ended up with
export PKG_CONFIG_PATH="$HOME/opt/lib/pkgconfig"
./configure --prefix=$HOME/opt
make
make check
make install
the glitch: make Nettle available
On Ubuntu, messing around with your environment variables in order to make a library in a custom position available will not work.
You need to put a file in /etc/ld.so.conf.d/
and then run a command that updates some libraries database and give tthe whole system a better karma.
In the case of Nettle my file is
/etc/ld.so.conf.d/nettle.conf
and it contains this line:
/home/catonano/opt/lib
Then run:
$ sudo ldconfig -v | grep nettle
This should give you this:
/sbin/ldconfig.real: Impossibile fare stat di /usr/local/lib/x86_64-linux-gnu: File o directory non esistente
/sbin/ldconfig.real: Percorso "/lib/x86_64-linux-gnu" fornito più di una volta
/sbin/ldconfig.real: Percorso "/usr/lib/x86_64-linux-gnu" fornito più di una volta
libnettle.so.6 -> libnettle.so.6.5
/sbin/ldconfig.real: /lib/x86_64-linux-gnu/ld-2.27.so is the dynamic linker, ignoring
libnettle.so.6 -> libnettle.so.6.4
So a file is missing, and a 2 paths have been supplied more than one time. I don'tknow about that and I don't want to now.
This wil allow the new Nettle to be found by whomever might need it.
So, for Nettle, that's that.
actually building Gnutls
Having built Nettle, I posted again on the Gnutls help mailing list about how to build Gnutls.
And here we go
./configure \
--prefix=/home/catonano/opt \
GUILE="/usr/bin/guile" \
PKG_CONFIG_PATH="/home/catonano/opt/lib/pkgconfig/" \
LT_SYS_LIBRARY_PATH="/home/catonano/opt/lib" \
NETTLE_LIBS="-L/home/catonano/opt/lib -lnettle" \
with this you can not only build Gnutls but also running its unit tests with
make check
Some tests won't be run because they need some optional dependencies.
But I'm ok with this build as it is. At least for now.
the last effort
In order for the Gnutls libraries to be available on our system, we need to do the same thing we did for making Nettle available:
create a file like this: /etc/ld.so.conf.d/gnunet.conf
It should contain:
/home/catonano/opt/lib/gnunet
"catonano" is my user home. Of course, you should adjust this path opportunely, on your system.
$ sudo ldconfig -v | grep gnutls
This should give you:
/sbin/ldconfig.real: Impossibile fare stat di /usr/local/lib/x86_64-linux-gnu: File o directory non esistente
/sbin/ldconfig.real: Percorso "/lib/x86_64-linux-gnu" fornito più di una volta
/sbin/ldconfig.real: Percorso "/usr/lib/x86_64-linux-gnu" fornito più di una volta
libgnutls-dane.so.0 -> libgnutls-dane.so.0.4.1
/sbin/ldconfig.real: /lib/x86_64-linux-gnu/ld-2.27.so is the dynamic linker, ignoring
libgnutlsxx.so.28 -> libgnutlsxx.so.28.1.0
libgnutls.so.30 -> libgnutls.so.30.23.0
libgnutls-dane.so.0 -> libgnutls-dane.so.0.4.1
libgnutls-openssl.so.27 -> libgnutls-openssl.so.27.0.2
libgnutlsxx.so.28 -> libgnutlsxx.so.28.1.0
libcurl-gnutls.so.4 -> libcurl.so
libneon-gnutls.so.27 -> libneon-gnutls.so.27.3.2
libgnutls.so.30 -> libgnutls.so.30.14.10
Ok, so that's that.
Now you have a Gnutls with Guile bindings
You can build Guile based packages and you can even build Guix !