编译升级Wget

Compile to Upgrade Wget

  linkthis    2018-04-20    2344 words

非洲人的Wget升级记录。

Wget编译安装

首先查看当前的Wget版本:

1
wget -V

Wget版本低于1.19.2均建议升级。
从Wget官方提供的地址进行下载。 然后编译安装:

1
2
3
4
5
6
wget https://ftp.gnu.org/gnu/wget/wget-1.19.5.tar.gz
tar -zxvf wget-1.19.5.tar.gz
cd wget-1.19.5
./configure --prefix=/usr --sysconfdir=/etc --with-ssl=openssl
make
make install

完成之后再次查看Wget的版本:

1
2
[email protected]:~# wget -V
GNU Wget 1.19.4 built on linux-gnu.

编译中可能遇到的错误

错误1

checking for openssl... no
configure: error: in `/root/wget-1.19.4':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables OPENSSL_CFLAGS
and OPENSSL_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details

不要编辑PKG_CONFIG,否则会带来更多的麻烦然后系统就boom了
应该首先执行如下命令:

1
2
whereis ssl
ssl: /usr/lib/ssl /etc/ssl /usr/share/man/man3/ssl.3ssl.gz

如果没有返回的值则需要执行:

1
2
apt update
apt install libssl-dev

然后执行:

1
./configure --prefix=/usr --sysconfdir=/etc --with-ssl=openssl --with-libssl-prefix=/usr/lib/ssl

如果缺少libssl-dev则会出现报错:configure: error: --with-ssl=openssl was given, but SSL is not available
当然有的人不看报错信息直接执行make命令则会导致如下的错误:

There seems to be no Makefile in this directory.
You must run ./configure before running 'make'.
GNUmakefile:106: recipe for target 'abort-due-to-no-makefile' failed
make: *** [abort-due-to-no-makefile] Error 1

错误2

cd . && /bin/bash /root/wget-1.19.4/build-aux/missing automake-1.15 --gnu
configure.ac:51: error: version mismatch.  This is Automake 1.15,
configure.ac:51: but the definition used by this AM_INIT_AUTOMAKE
configure.ac:51: comes from Automake 1.15.1.  You should recreate
configure.ac:51: aclocal.m4 with aclocal and run automake again.
WARNING: 'automake-1.15' is probably too old.
         You should only need it if you modified 'Makefile.am' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'automake' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
Makefile:1458: recipe for target 'Makefile.in' failed
make: *** [Makefile.in] Error 1

此可能是由于时间戳的问题造成的,需要执行如下命令:

1
2
autoreconf -ivf
touch configure.ac aclocal.m4 configure Makefile.am Makefile.in

之后即可正常地执行make命令。

其它的错误根据报错用APT命令就能轻松解决。
只有本非洲人编译一个Wget也能出这么多错误。
本文采用CC BY-NC-ND 4.0许可协议进行许可,转载请注明出处。

本文最后更新时间为:2019-02-03-Sunday-03:22:20 PM




Image of Wechat