zl程序教程

您现在的位置是:首页 >  工具

当前栏目

Libnettle 3.1 was not found.报错的解决方案

解决方案 报错 not found was 3.1
2023-09-11 14:22:07 时间

0x00 背景

名称版本
操作系统CentOS 6.10 x64
GnuTLS库gnutls-3.5.19
gnutls依赖库nettle-3.4
gnutls依赖库gmp-6.1.2

安装gnutls前需要先安装两个依赖库,一个是gmp,另一个是nettle。安装完这两个依赖库后,准备安装gnutls,结果报错:
在这里插入图片描述

0x01 问题原因

nettle这货安装的时候,自己安装到了/usr/local/lib目录下了。gnutls安装时默认会到系统目录下/usr/lib下寻找依赖关系。

软件路径瞎按,系统依赖瞎找是问题的形成原因。

安装nettle结束后,没有跟我们说安装到哪里了,我们看下nettle的路径

find /usr -name '*nettle*'

在这里插入图片描述

0x02 问题修复

安装nettle时,通过--prefix参数指定安装路径为/usr

cd /tmp/nettle-3.4 && ./configure --prefix=/usr/ &&  make && make install

再继续安装gnutls

cd /tmp/gnutls-3.5.19 &&
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig &&
./configure --enable-shared --with-included-libtasn1 \
--with-included-unistring --without-p11-kit  &&
make &&
make install

安装成功
在这里插入图片描述

0x03 扩展思考

可能当前用户是普通用户,莫非sudo安装的路径就变成了/usr/local,su的安装路径是/usr

[test@bogon tmp]$ sudo echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/test/bin
[test@bogon tmp]$ su
Password: 
[root@bogon tmp]# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/test/bin

系统PATH的路径是完全相同的。所以不是用户属性控制的。

查下./configure的用法

[root@bogon nettle-3.4]# ./configure --help
`configure' configures nettle 3.4 to adapt to many kinds of systems.

Usage: ./configure [OPTION]... [VAR=VALUE]...

To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE.  See below for descriptions of some of the useful variables.

Defaults for the options are specified in brackets.

Configuration:
  -h, --help              display this help and exit
      --help=short        display options specific to this package
      --help=recursive    display the short help of all the included packages
  -V, --version           display version information and exit
  -q, --quiet, --silent   do not print `checking ...' messages
      --cache-file=FILE   cache test results in FILE [disabled]
  -C, --config-cache      alias for `--cache-file=config.cache'
  -n, --no-create         do not create output files
      --srcdir=DIR        find the sources in DIR [configure dir or `..']

Installation directories:
  --prefix=PREFIX         install architecture-independent files in PREFIX
                          [/usr/local]
  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                          [PREFIX]

安装路径抓虾的真正原因是./configure默认是安装到/usr/local下的。

0x04 小结

  1. 第三方软件linux系统推荐安装到/usr/local路径下
  2. 先make uninstall卸载掉安装错的nettle,但是报错了