怎样编译安装gnutls

2017年11月29日 | 分类: 【技术】

【介绍】

官网:https://gitlab.com/gnutls/gnutls

参考:http://linuxfromscratch.org/blfs/view/svn/postlfs/gnutls.html
参考:http://gnutls.org/manual/gnutls.html

【编译】

依赖:Nettle-3.3
参考:https://amon.org/nettle

依赖:Certificate Authority Certificates
参考:https://amon.org/ca-bundle

依赖:libunistring-0.9.7
参考:https://amon.org/libunistring

依赖:libtasn1-4.12
参考:https://amon.org/libtasn1

依赖:p11-kit-0.23.9
参考:https://amon.org/p11-kit

wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.1.tar.xz && xz -d gnutls-3.6.1.tar.xz && tar -xvf gnutls-3.6.1.tar && cd gnutls-3.6.1
export NETTLE_CFLAGS="-I/usr/include/nettle" NETTLE_LIBS="-L/usr/lib64 -lnettle" HOGWEED_CFLAGS="-I/usr/include/nettle" HOGWEED_LIBS="-L/usr/lib64 -lhogweed" P11_KIT_CFLAGS="-I/usr/include/p11-kit-1/p11-kit" P11_KIT_LIBS="-L/usr/lib -lp11-kit" LIBTASN1_CFLAGS="-I/usr/include" LIBTASN1_LIBS="-L/usr/lib -ltasn1" GMP_CFLAGS="-I/usr/local/include" GMP_LIBS="-L/usr/local/lib -lgmp"
./configure --prefix=/usr --with-default-trust-store-file=/etc/ssl/ca-bundle.crt --enable-gtk-doc --enable-openssl-compatibility --enable-local-libopts --with-included-unistring
make
make check
make install

make时报错:

./../pkcs11_int.h:27:28: fatal error: p11-kit/pkcs11.h: No such file or directory
 #include <p11-kit/pkcs11.h>

缺少还是没找到,那就复制过来:

cp -R /usr/include/p11-kit-1/p11-kit /root/gnutls-3.6.1/lib/p11-kit

输出:

----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib

...
/usr/bin/mkdir -p '/usr/lib/pkgconfig'
 /usr/bin/install -c -m 644 gnutls-dane.pc '/usr/lib/pkgconfig'
...
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/guile/2.0
...
 /usr/bin/mkdir -p '/usr/share/guile/site/2.0/gnutls'

更新系统动态连接库配置:

echo /usr/lib >> /etc/ld.so.conf && ldconfig

查看版本:

gnutls-cli -v

输出:

gnutls-cli 3.6.1
Copyright (C) 2000-2017 Free Software Foundation, and others, all rights reserved.
This is free software. It is licensed for use, modification and
redistribution under the terms of the GNU General Public License,
version 3 or later <http://gnu.org/licenses/gpl.html>


Please send bug reports to:  <[email protected]>

相关路径:

/usr/include/gnutls/gnutls.h
/usr/lib/libgnutls.so.30.8.1

环境参数:

LIBGNUTLS_CFLAGS="-I/usr/include/gnutls" LIBGNUTLS_LIBS="-L/usr/lib -lgnutls" 

编译安装完成。