编译libtorrent小记
因为想用前天买的小板跑个BT下载电影,就想到装个BT软件,网上看好象libtorrent比较简单,就先来他吧
先下了libtorrent下来, 因为libtorrent依赖于libsigc++2.0.x,所以开始下了一个libsigc++2.0.1
得先编译sigc++2.0.1,碰到一个类型重定义的错误,
usr/include/sigc++-2.0/sigc++/signal.h:1675: error: declaration of 'typedef struct sigc::slot_list<sigc::slot<T_return, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil> > sigc::signal0<T_return, T_accumulator>::slot_list'
/usr/include/sigc++-2.0/sigc++/signal.h:168: error: changes meaning of 'slot_list' from 'struct sigc::slot_list<sigc::slot<T_return, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil> >'
这个错误,网络上也很多人提,我先是用sigc++2.0.1版本,signal.h中没有人家说的这个SIGC_TYPEDEF_REDEFINE_ALLOWED设置,
所以搞了好久,到处加#undef SIGC_TYPEDEF_REDEFINE_ALLOWED 都不行,后来看到人家说在后续版本才修整这个错误,就下了2.0的最后一个版本,
sigc++2.0.18,./autogen.sh后,在signal.h里
加上#undef SIGC_TYPEDEF_REDEFINE_ALLOWED,
再make,果然通过编译了。
然后再到libtorrent目录下运行: ./autogen ./configure,结果提示sigc++还是找不到,
后来想起刚才sigc++最后make install的时候,提示没权限写/usr/lib 什么目录的
又查资料,说可以通过./configure --prefix=/home 等来改变安装目录,赶紧到libsigc++目录那边用这个命令重新设置了安装目录,
然后直接make install,因为刚才make过了,很快,这时他就把lib拷贝到/home/lib下了,就是你刚才设置的安装目录。
接着再到libtorrent目录下再configure,结果还是提示找不到,怪了,他的文字提示要设置一下PKG_CONFIG_PATH这个路径
就用export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/home/lib/pkgconfig 把你安装目录的pkgconfig路径加到他的搜索路径里
设完还可以用 echo $PKG_CONFIG_PATH看一下对不对,linux还经常用这个来设置路径的,比如LD_LIBRARY_PATH什么的
这下在./configure,哇,成功了,接下来要编译libtorrent了
编译提示错误
file_list_iterator.h:64: error: 'abs' is not a member of 'std'
用该错误信息google得到该patch
http://libtorrent.rakshasa.no/attachment/ticket/1266/libtorrent-gcc43-v2.patch
依照该patch一一修改提到的各个文件再编译就OK了
用linux果然要靠google啊
接下来的simpleclient例子,也是编译不过,不过代码较少,照着错误一一改掉,后编译通过可以跑了
下面是跑时输出的一些信息,
./simple_client http://imgs.kaicn.com/bt/torrent/20081229/12305450611.torrent
Starting download.
Finished http download.
torrent::Object::create_string();
b = curlGet->url();http://imgs.kaicn.com/bt/torrent/20081229/12305450611.torrent
download_add:b.type=4
Hash check completed.
killman.net@720P??倁???? 0/1323
看来中文支持还不行,接下来又要改了,不过今天还是先把文件下载调通再说
posted on 2009-01-14 15:11 GaryGaryGary 阅读(380) 评论(0) 收藏 举报
浙公网安备 33010602011771号