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 小結
- 第三方軟件linux系統推薦安裝到
/usr/local
路徑下 - 先make uninstall卸載掉安裝錯的nettle,但是報錯了