linux编译安装aria2及编译时出现checking whether the C compiler works... no错误提示的解决

aria2 项目地址

编译安装aria2-1.36.0

安装支持库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
 # sudo apt install gcc autoconf automake libcppunit-dev libgnutls-dev nettle-dev libgmp-dev libssh2-1-dev libc-ares-dev libxml2-dev zlib1g-dev libsqlite3-dev pkg-config  
sudo apt install gcc autoconf automake libcppunit-dev libssl-dev libgcrypt-dev libssh2-1-dev libc-ares-dev libexpat1-dev zlib1g-dev libsqlite3-dev pkg-config
# 说明:
# libgnutls-dev (HTTPS, BitTorrent, Checksum 支持需要)
# nettle-dev (BitTorrent 需要,校验和支持)
# libgmp-dev (Required for BitTorrent)
# libssh2-1-dev (SFTP 支持需要)
# libc-ares-dev (异步 DNS 支持所必需的)
# libxml2-dev (Metalink 支持所必需的)
# zlib1g-dev (gzip 需要,在 HTTP 中压缩解码支持)
# libsqlite3-dev (Firefox3/Chromium cookie 支持所必需的)
# pkg-config (检测已安装的库时需要)
# 你可以使用libgcrypt-dev代替nettle-dev和libgmp-dev:
# libgpg-error-dev (BitTorrent 需要,校验和支持)
# libgcrypt-dev (BitTorrent 需要,校验和支持)
# 你可以使用libssl-dev代替libgnutls-dev,nettle-dev,libgmp-dev,libgpg-error-dev和libgcrypt-dev:
# libssl-dev (HTTPS、 BitTorrent, Checksum 支持是必需的)
# 您可以使用 libexpat1-dev 而不是 libxml2-dev:
# libexpat1-dev (Metalink 支持所必需的)

# 若提示却少支持项则apt安装或者参照下面方法安装
# 安装tcmalloc支持库
# 1、安装libunwind
# [项目地址](https://github.com/libunwind/libunwind)
# wget https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz
# tar -zxvf libunwind-1.6.2.tar.gz
# ./configure --prefix=/usr/local
# make && sudo make install
# 2、安装 tcmalloc
# wget https://github.com/gperftools/gperftools/releases/download/gperftools-2.9.1/gperftools-2.9.1.tar.gz
# tar -zxvf gperftools-2.9.1.tar.gz
# cd gperftools-2.9.1
# ./configure
# make && sudo make install

## 安装libssh2
# wget https://www.libssh2.org/download/libssh2-1.10.0.tar.gz
# tar -zxvf libssh2-1.10.0.tar.gz
# cd libssh2-1.10.0
# ./configure
# make && sudo make install

## 安装c-ares
# wget https://github.com/c-ares/c-ares/releases/download/cares-1_18_1/c-ares-1.18.1.tar.gz
# tar -zxvf c-ares-1.18.1.tar.gz
# cd c-ares-1.18.1
# ./configure
# make && sudo make install

下载并编译安装aria2-1.36.0

依次运行一下命令:

1
2
3
4
5
6
7
8
9
10
11
12
13
wget https://github.com/aria2/aria2/releases/download/release-1.36.0/aria2-1.36.0.tar.bz2
tar -xjvf aria2-1.36.0.tar.bz2
cd aria2-1.36.0
./configure \
--prefix=/usr/local/aria2-1.36.0 \
--enable-libaria2 \
--enable-FEATURE \
--enable-threads=posix \
--enable-static \
--with-gnu-ld \
--with-tcmalloc
make && sudo make install
sudo ln -s /usr/local/aria2-1.36.0/bin/aria2c /usr/local/bin/aria2c

编译时出现错误

编译安装aria2-1.36.0是出现错误提示如下:

1
2
3
4
5
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `~/下载/软件/deb包/ApplicationSoftware/aria2-1.36.0':
configure: error: C compiler cannot create executables
See `config.log' for more details

解决办法:
1
sudo apt install gobjc++

安装后启动出现错误

1
2
3
aria2c -v
# 输出:
aria2c: error while loading shared libraries: libtcmalloc_minimal.so.4: cannot open shared object file: No such file or directory

支持库文件安装路径是/usr/local/lib,而/usr/local/lib 不在系统默认的LD_LIBRARY_PATH里,所以就找不到该lib
解决办法:

1
sudo vim /etc/ld.so.conf

添加如下内容:

1
/usr/local/lib

使配置生效:

1
sudo ldconfig -v

重新启动aria2即可。

关于其他配置请参考
Aria2在Debian11下的配置

最后安装后启用的功能如图:
nologoImage5.jpg

参考资料:
CentOS 下搭建 aria2 远程下载环境