Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compile GnuTLS

I'm trying to compile GnuTLS library several times on Centos 6.2 but with no luck. These are the steps:

I downloaded Nettle 2.4

[root@localhost opt]# wget http://www.lysator.liu.se/~nisse/archive/nettle-2.4.tar.gz
[root@localhost nettle-2.4]# tar zxvf nettle-2.4.tar.gz
[root@localhost nettle-2.4]# cd nettle-2.4
[root@localhost nettle-2.4]# ./configure --enable-shared --prefix=/usr



  Version:           nettle 2.4
  Host type:         x86_64-unknown-linux-gnu
  ABI:               64
  Assembly files:    x86_64
  Install prefix:    /usr
  Library directory: ${exec_prefix}/lib64
  Compiler:          gcc
  Shared libraries:  yes
  Public key crypto: no

I run the command make and make install

I downloaded the latest GnuTLS

 ./configure --with-libnettle-prefix=/usr

hecking for shared library run path origin... done
checking whether to use nettle... yes
checking for libnettle... no
configure: error:
  ***
  *** Libnettle 2.4 was not found.

What am I missing?

Best wishes

like image 958
Peter Penzov Avatar asked Mar 01 '12 00:03

Peter Penzov


3 Answers

The issue is that nettle won't build libhogweed unless, as you've observed, the dev headers for libgmp are present. Unfortunately, the docs and .configure --help and output from configure don't say anything about this.

Meanwhile, the gnuTLS docs don't explain this either (and as you notice, its configure output here is not very helpful). Although libgmp is listed as a pre-req, for some reason libhogweed is not (perhaps because it is assumed to be part of nettle). The reason for your configure error "cannot find -lgmp" is that libgmp isn't present, but libhogweed.so won't be there either, since it is a hidden optional part of nettle. If you then install libgmp-dev and just run configure for gnutls, you'll get the same "checking for libnettle... no". What this should say is "checking for libhogweed... no", but whoever is in charge of the conf script is too lazy to break that up (I guess a patch could be submitted).

In other words, you need to install libgmp-dev and then rebuild nettle before you build gnutls.

like image 164
CodeClown42 Avatar answered Nov 17 '22 16:11

CodeClown42


I installed nettle-dev & nettle-bin and it works :)

like image 21
MarkWong Avatar answered Nov 17 '22 17:11

MarkWong


Gnu TLS configure script does not say out loud that pkg-config is needed and other package may not even be tried if pkg-config is not installed. Installing pkg-config fixed the issue for me.

like image 3
Mohammad Azim Avatar answered Nov 17 '22 17:11

Mohammad Azim