从wget的源代码入手,来完成wget在Ubuntu上的安装,如果你的机器上已经默认安装了wget,请采用apt-get remove命令先卸载掉。
解决configure: error: –with-ssl was given, but GNUTLS/SSL is not available.;解决error: ./stdio.h:1012: error: ‘gets’ undeclared here (not in a function)
- 源码下载命令
curl -o wget-1.13.4tar.xz ftp://ftp.gnu.org/gnu/wget/wget-1.13.4tar.xz
- 解压缩
tar -zxvf wget-1.13.4.tar.xz
- 执行./configure配置
进入wget目录后,执行./configure命令,我运行configure命令后出现了这样的错误:
configure: error: –with-ssl was given, but GNUTLS is not available.
百度了一下解决方法,执行命令./configure –with-ssl=openssl,
结果又出现如下的错误提示:
configure: error: –with-ssl=openssl was given,but ssl is not avaliable.
百度出来说原因可能是虽然openssl安装,但对应的库没有安装,然后按照博主说的:
sudo apt-get install libssl-dev
再次运行
./configure –with-ssl=openssl,正常啦。
- make编译,这里最好用sudo make,不然容易遇到 permission denied
我在顺利完成configure步骤后,wget的根目录就出现了Makefile文件,这时运行命令make编译,结果又出现如下的问题:./stdio.h:1012: error: ‘gets’ undeclared here (not in a function)
网上搜了一下,解决方法是到wget目录中,找到stdio.h文件,给它修改权限sudo chmod 777 stdio.h,执行命令“vim stdio.h”,用“1012G”跳到1012行,注意是wget目录(不是Ubuntu系统目录)下的stdio.h文件,然后注释掉stdio.h中的1012行,就是下面我注释掉并且圈出来的这行,保存退出后,再次运行make命令,正常编译。
- 执行命令sudo make install,没有报错
- wge -help查看是否安装成功,如图,安装好了
用wget试着下载一张图,如下,成功下载,手动编译wget源代码安装到此结束