linux編譯安裝aria2


一、安裝aria2

 [root@192-168-7-77 ~]# wget https://github.com/aria2/aria2/releases/download/release-1.33.1/aria2-1.33.1.tar.bz2
 [root@192-168-7-77 ~]# yum -y install bzip2
 [root@192-168-7-77 ~]# bzip2 -d aria2-1.33.1.tar.bz2 
 [root@192-168-7-77 ~]# tar xf aria2-1.33.1.tar 
 [root@192-168-7-77 ~]# cd aria2-1.33.1/
 [root@192-168-7-77 ~/aria2-1.33.1]# ./configure --prefix=/usr/local/aria2
 [root@192-168-7-77 ~/aria2-1.33.1]# make && make install
 [root@192-168-7-77 ~]# tail -1 /etc/profile
 export PATH=$PATH:/usr/local/aria2/bin
 [root@192-168-7-77 ~]# source /etc/profile

二、解決報錯問題

[root@192-168-7-77 ~/2]# tar -jxv -f aria2-1.33.1.tar.bz2 
tar (child): bzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
# gcc-c++版本過底,需要gcc >= 4.8.3

[root@192-168-7-77 ~/2/aria2-1.33.1]# ./configure --prefix=/usr/local/aria2
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.20... yes
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=c++11 ... no
checking whether g++ supports C++11 features with -std=c++11 -stdlib=libc++... no
checking whether g++ supports C++11 features with -std=c++0x ... yes
checking whether the c++ compiler supports nullptr... configure: error: in `/usr/local/src/aria2-1.33.1':
configure: error: C++ compiler does not understand nullptr, perhaps C++ compiler is too old.  Try again with new one (gcc >= 4.8.3 or clang >= 3.4)
See `config.log' for more details
[root@192-168-7-77 aria2-1.33.1]# rpm -qa | grep gcc-c++
gcc-c++-4.4.7-17.el6.x86_64

# 需要將gcc升級到4.8.2
[root@192-168-7-77 ~]# cd /usr/local/src/
[root@192-168-7-77 src]# wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8
[root@192-168-7-77 src]# tar xf gcc-4.8.2.tar.bz2 
[root@192-168-7-77 src]# cd gcc-4.8.2/

# 運行自帶腳本,完成下載、配置、安裝依賴庫,可以節約我們大量的時間和精力
[root@192-168-7-77 gcc-4.8.2]# ./contrib/download_prerequisites 

# 建立一個目錄供編譯出的文件存放
[root@192-168-7-77 gcc-4.8.2]# mkdir gcc-build-4.8.2
[root@192-168-7-77 gcc-4.8.2]# cd gcc-build-4.8.2

# 生成makefile文件
[root@192-168-7-77 gcc-build-4.8.2]# ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
# 編譯(很耗時,-j4對多核處理器的優化)
[root@192-168-7-77 gcc-build-4.8.2]# make -j4
[root@192-168-7-77 gcc-build-4.8.2]# make install

# 驗證是否成功,如果還是顯示原來的版本,則需要重啟系統
[root@192-168-7-77 ~]# gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
Thread model: posix
gcc version 4.8.2 (GCC) 

三、配置aria2


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM