gnutls全称 GNU Transport Layer Security Library即基于GNU版权协议的传输层安全协议是wget支持https中的ssl协议的基础库。
开始 libgnutls 源码编译
在做一个开源项目时 需要 libgnutls > 3.2.15 当前系统gnutls-2.12 所以选择源码编译升级
wget https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5/gnutls-3.5.19.tar.xztar -xvJf gnutls-3.5.19.tar.xzcd gnutls-3.5.19./configure
提示找不到nettle-3.1
源码编译 nettle 3.1
wget http://ftp.gnu.org/gnu/nettle/nettle-3.1.tar.gztar -zxvf nettle-3.1.tar.gzcd nettle-3.1./configure makemake install
在gnutls中./configure会报错 找不到nettle-3.1 其实是PKG_CONFIG_PATH路径没有找到这两个文件的原因
[rootlocalhost nettle-3.1]# find ./ -name "*.pc"./hogweed.pc./nettle.pc[rootlocalhost nettle-3.1]#cp *.pc /usr/lib64/pkgconfig/
再次在gnutls中./configure 报错gmp找不到 其实存在只是头文件不存在 yum install -y gmp-devel
再次./configure 报错 Libtasn1 4.9 was not found. To use the included one, use --with-included-libtasn1
源码编译 Libtasn1 4.9
查看系统当前版本
[testlocalhost lib]$ rpm -qa | grep libtasn1libtasn1-devel-2.3-6.el6_5.x86_64libtasn1-2.3-6.el6_5.x86_64
版本太低 下载 Libtasn1 4.9版本
wget http://ftp.gnu.org/gnu/libtasn1/libtasn1-4.9.tar.gztar -zxvf libtasn1-4.9.tar.gzcd libtasn1-4.9./configure make
解压编译出现错误 [-Wlogical-op] 是警告代码 可以在 https://blog.csdn.net/whatday/article/details/83780754 查询警告含义
ASN1.c:1192: error: logical with non-zero constant will always evaluate as true [-Wlogical-op]注释掉 libtasn1-4.9/lib/ASN1.c 中的1192行 // yyn]))
继续make出现 一下错误
../gl/timespec.h:41: error: no previous prototype for make_timespec [-Wmissing-prototypes]../gl/timespec.h:78: error: no previous prototype for timespec_cmp [-Wmissing-prototypes]../gl/timespec.h:88: error: no previous prototype for timespec_sign [-Wmissing-prototypes]../gl/timespec.h:102: error: no previous prototype for timespectod [-Wmissing-prototypes]
在libtasn1-4.9/gl/timespec.h 增加函数声明
// 增加函数声明 去除编译警告_GL_TIMESPEC_INLINE struct timespec make_timespec (time_t s, long int ns);_GL_TIMESPEC_INLINE int timespec_cmp (struct timespec a, struct timespec b);_GL_TIMESPEC_INLINE int timespec_sign (struct timespec a);_GL_TIMESPEC_INLINE double timespectod (struct timespec a);
然后编译成功 继续在gnutls中./configure 报错找不到libtasn1-4.9
[testlocalhost libtasn1-4.9]$ find ./ -name "*.pc"./lib/libtasn1.pc[testlocalhost libtasn1-4.9]$ sudo cp lib/libtasn1.pc /usr/lib64/pkgconfig/
继续 libgnutls 源码编译
继续在gnutls中./configure 报错如下
configure: error: ****** Libunistring was not found. To use the included one, use --with-included-unistring
sudo yum install -y libunistring libunistring-devel 解决
继续在gnutls中./configure 报错如下
configure: WARNING: *** LIBIDN2 was not found. You will not be able to use IDN2008 supportchecking for LIBIDN... noconfigure: WARNING:****** libidn was not found. IDNA support will be disabled.*** checking for nettle_secp_192r1 in -lhogweed... nochecking whether to build libdane... yeschecking for unbound library... noconfigure: WARNING:****** libunbound was not found. Libdane will not be built.*** checking for P11_KIT... noconfigure: error: ****** p11-kit > 0.23.1 was not found. To disable PKCS #11 support*** use --without-p11-kit, otherwise you may get p11-kit from*** http://p11-glue.freedesktop.org/p11-kit.html***
根据错误提示 缺少 LIBIDN2 libunbound p11-kit > 0.23.1
源码编译LIBIDN2
wget https://ftp.gnu.org/gnu/libidn/libidn2-2.0.5.tar.gztar -zxvf libidn2-2.0.5.tar.gzcd libidn2-2.0.5./configuremake make install
yum安装libunbound
[testlocalhost libidn2-2.0.5]$ yum list | grep unboundunbound.x86_64 1.4.20-23.el6_9.4 base unbound-devel.x86_64 1.4.20-23.el6_9.4 base unbound-libs.x86_64 1.4.20-23.el6_9.4 base pcp-pmda-unbound.x86_64 3.10.9-9.el6 base unbound-devel.i686 1.4.20-23.el6_9.4 base unbound-libs.i686 1.4.20-23.el6_9.4 base unbound-python.i686 1.4.20-23.el6_9.4 base unbound-python.x86_64 1.4.20-23.el6_9.4 base [testlocalhost libidn2-2.0.5]$ sudo yum install -y unbound unbound-devel
源码编译p11-kit-0.23.14
wget https://github.com/p11-glue/p11-kit/releases/download/0.23.14/p11-kit-0.23.14.tar.gztar -zxvf p11-kit-0.23.14.tar.gzcd p11-kit-0.23.14./configuremakemake installcp p11-kit/p11-kit-1.pc /usr/lib64/pkgconfig/
再次在gnutls中./configure通过 make make install 编译安装成功
覆盖原有的pc文件
cp ./lib/gnutls.pc /usr/lib64/pkgconfig/gnutls.pc