rtorrent是一个Bittorrent软件,基于终端的BT客户端,高性能、低资源,另外有不少人给rtorrent开发了Web GUI来更好的让用户控制管理rtorrent,总而言之在Linux平台下,rtorrent是一个不错的BT下载解决方案。
rtorrent是一个Bittorrent软件,基于终端的BT客户端,高性能、低资源,另外有不少人给rtorrent开发了Web GUI来更好的让用户控制管理rtorrent,总而言之在Linux平台下,rtorrent是一个不错的BT下载解决方案。
rtorrent已被添加进Ubuntu源中,在Ubuntu下安装rtorrent非常容易,一句话即可安装:
$sudo apt-get install rtorrent
但是这里要写的是编译安装rtorrent的笔记记录,在这个编译安装过程中可以学习到一些关于编译安装源码的简单经验。在这里所用到的是全新安装的Ubuntu 8.10,以此为例来进行编译安装的学习。
首先在rtorrent官方Wiki中的Install条目中给出了安装步骤:
cd /home/rtorrent
svn co svn://rakshasa.no/libtorrent/trunk
cd /home/rtorrent/trunk
svn up
cd libtorrent
./autogen.sh
./configure
make
make install
cd ../rtorrent
./autogen.sh
./configure
make
make install
在一个全新安装的Ubuntu下还未安装subversion,无法使用svn获取最新源码,所以我们需要安装subversion:
$sudo apt-get install subversion
在/home下创建一个文件夹需要提权:
$cd /home
$sudo mkdir rtorrent
然后根据rtorrent wiki的Install条目进行下一步:
$cd /home/rtorrent
由于svn获取源码写入/home/rtorrent也需要提权:
$sudo svn co svn://rakshasa.no/libtorrent/trunk
接下来就会下载一堆源码,下载完成后接着进行下一步:
$cd /home/rtorrent/trunk
想要查看通过svn获得的源码版本使用命令:
$sudo svn up
这条命令会返回版本号,由于编译软件需要编译器,所以我们在这一步就需要安装编译器先:
$sudo apt-get install build-essential
安装完编译器之后进行接下来的步骤:
$sudo ./autogen.sh
应该会返回信息:aclocal not found,这是因为需要安装automake:
$sudo apt-get install automake
安装完automake之后再重复上一步:
$sudo ./autogen.sh
应该会返回信息:
aclocal...
configure.ac:22: warning: macro `AM_DISABLE_STATIC' not found in library
configure.ac:23: warning: macro `AM_PROG_LIBTOOL' not found in library
autoheader...
libtoolize... libtoolize nor glibtoolize not found
这是因为未安装libtool软件包,一句话安装:
$sudo apt-get install libtool
安装完libtool之后再重复上一步:
$sudo ./autogen.sh
应该会返回信息:
aclocal...
autoheader...
libtoolize... using libtoolize
automake...
configure.ac:23: installing `./config.guess'
configure.ac:23: installing `./config.sub'
configure.ac:18: installing `./install-sh'
configure.ac:18: installing `./missing'
src/Makefile.am: installing `./depcomp'
autoconf...
ready to configure
接下来进行下一步:
$sudo ./configure
将会开始检查环境、配置,应该会返回信息:
checking for OPENSSL... configure: error: Package requirements (openssl) were not met:
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
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.
通过Google搜索结果中,都说的是在这里需要告诉pkg-config这个openssl的相关配置文件(.pc)的位置,通常已安装的软件和包的.pc文件都会出现在/usr/lib/pkg-config下,但我在这里没有找到openssl的.pc文件,并且通过使用命令$sudo apt-get install openssl发现openssl是已安装了的,到这一步就停滞不前了。最后在Ubuntu的package网站里搜索到一个相关的包是libssl- dev,安装这个包:
$sudo apt-get install libssl-dev
安装完libssl-dev之后再接着重复上一步$sudo ./configure又会收到和之前类似的信息,只是这回返回的是:
checking for STUFF... configure: error: Package requirements (sigc++-2.0) were not met:
No package 'sigc++-2.0' found
再次通过Ubuntu的Package网站里搜索到相关软件包是libsigc++-2.0,所以需要安装这个包:
$sudo apt-get install libsigc++-2.0-dev
如果还是不行的话安装这个包libcurl4-openssl-dev
$sudo apt-get install libsigc++-2.0-dev
安装完这个包之后再重复执行$sudo /.configure,可以顺利完成了,接下来的步骤:
$sudo make
$sudo make install
sudo ldconfig
$cd ../rtorrent
$sudo ./autogen.sh
$sudo ./configure
返回*** The ncurses library is required!,安装ncurses开发包:
$sudo apt-get install ncurses-dev libncursesw5-dev
重复$sudo ./configure,再返回信息checking for libcurl... configure: error: Package requirements (libcurl >= 7.15.4),安装libcurl开发包(libcurl-dev是由libcurl4-openssl-dev提供的虚拟软件包):
$sudo apt-get install libcurl4-openssl-dev
重复$sudo ./configure,可以顺利完成并且进行下一步了:
$sudo make
$sudo make install
至此rtorrent编译安装就完成了,在这次编译安装rtorrent可以学习到以下基础经验:
编译所需的东西是首先要安装好的:
$sudo apt-get install build-essential automake libcurl4-openssl-dev
在进行./configure步骤出现找不到的包的情况下先将Package requirement后括号中的关键字词记下来,在Ubuntu Package(http://packages.ubuntu.com/) 搜索一下,就可以知道如何通过apt-get来安装哪个包了。通常情况下所需要安装的是相关包的开发包,所以通常安装的是***-dev这样子的包,比如之前的openssl就是一个典型,编译需要用到openssl的开发包libssl-dev。另外编译安装软件之前应该有个好习惯,是这次编译安装所获得的经验,那就是至少应该先读一读svn下载下来的源码中的README文本文件,在libtorrent目录下的README(用nano README命令打开文本文件)中已说明了库依赖(LIBRARY DEPENDENCIES)libsigc++ 2.0(deb:libsigc++-2.0-dev),g++ >=3.3,而rtorrent目录下的README文本文件里说明了所需库依赖文件是libcurl >=7.12.0,ncurses。所以如果编译之前先阅读了这些说明文件,至少可以事先安装好所需库文件包。
安装rtorrent过程中使用 ./configure --with-ncursesw 选项好像也无法改变 生成Makefile文件中仍然为LIBS = -lncurses -lsigc-2.0 -lcurl -L/usr/local/lib -ltorrent,这时需要将所有的Makefile文件都手工改为LIBS = -lncursesw -lsigc-2.0 -lcurl -L/usr/local/lib -ltorrent,尤其是src目录及其子目录下面的Makefile修改完毕后make一下,如果出现can't find lncursesw ,sudo apt-get install libncursesw5-dev,需要检查一下/usr/lib/libncursesw.so文件,如果没有需要
ln -sfv /lib/libncursesw.so.5 /usr/lib/libncursesw.so 前提是已经存在libncursesw.so.5 或 libncursesw.so.5.7
make
makinstall
OK 这样rtorrent就不会有乱码
InstallingBuilding./configure; make; make install
Building from latest development version (trunk)(note: you need to have SVN installed)
Before the first use, you have to get the latest trunk version. This needs to be done only once. In this example, the directory in which you store the sources is /home/rtorrent/trunk
cd /home/rtorrentsvn co svn://rakshasa.no/libtorrent/trunkThen, everytime you want to update your copy and recompile libTorrent and rTorrent:
cd /home/rtorrent/trunksvn upcd libtorrent./autogen.sh./configuremakemake installcd ../rtorrent./autogen.sh./configuremakemake install(hint: you can put that in a file and run it everytime you want to recompile from trunk)
If it doesn't work, make sure you have a recent version of autotools. See also CompilationHelp.
libtorrent.so.5: cannot open shared object file: No such file or directoryMake sure you have $prefix/lib in either your /etc/ld.so.conf or LD_LIBRARY_PATH, where $prefix is where you installed libtorrent. To update the ld cache, run "ldconfig".
Non-blocking hostname lookup in curlRTorrent will block on hostname lookup during tracker requests and http downloads. You can avoid this by compiling libcurl with 'cares' support, though this will be fixed later by using seperate threads within rTorrent.
后来又安装rTorrentWeb时配置~/.rtorrent.rc文件,添加scgi_port = localhost:5000参数后,重启rtorrent报错,rtorrent:XMLRPC not supported ,究其原因原来编译安装rtorrent时没有把xmlrpl的功能编译进来后来根据这篇文件的提示 安装xmlrpc后 编译rtorrent时加上了./configure --with-xmlrpc-c编译选项终于成功
2010-12-23 今天安装rtorrent-0.8.7.tar.gz , libtorrent-0.12.7.tar.gz的时候
/rtorrent/trunk/libtorrent# ./autogen.sh
aclocal...configure.ac:20: warning: macro `AM_PATH_CPPUNIT' not found in library
./autogen.sh 提示 warning: macro `AM_PATH_CPPUNIT' not found in library,查阅资料发现缺少cppunit
apt-get install libcppunit-dev 安装完毕再次执行autogen.sh搞定
make rtorrent 时最后编译main.o出现错误 /usr/bin/ld: note: 'pthread_create@@GLIBC_2.1' is defined in DSO /lib/libpthread.so.0 so try adding it to the linker command line
手工添加/lib/libpthread.so.0执行成功
libtool --tag=CXX --mode=link g++ -g -O2 -g -DDEBUG -I/usr/include/sigc++-2.0 -I/usr/lib/sigc++-2.0/include -I/usr/local/include -I/usr/local/include -o rtorrent main.o libsub_root.a ui/libsub_ui.a core/libsub_core.a display/libsub_display.a input/libsub_input.a rpc/libsub_rpc.a utils/libsub_utils.a -lncursesw -lsigc-2.0 -lcurl -L/usr/local/lib -ltorrent -L/usr/local/lib -lxmlrpc_server -lxmlrpc -lxmlrpc_util -lxmlrpc_xmlparse -lxmlrpc_xmltok -L/lib lib/libpthread.so.0