Tuesday, February 9, 2016

Compile deluged in Centos 7 x86_64

In a proper build environment:

yum install boost-devel libgeoip (not supported anymore)


Get the latest libtorrent (1.1.2 at the time). To build it use b2.

cd /usr/local/src/
mkdir deluge
cd deluge
wget https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_1_2/libtorrent-rasterbar-1.1.2.tar.gz
tar -xvf  libtorrent-rasterbar-1.1.2.tar.gz
cd  libtorrent-rasterbar-1.1.2

Edit Jamfile and set all TORRENT_USE_ICONV from 0 to 1.

#build libtorrent
b2 toolset=gcc link=shared variant=release target-os=linux address-model=64 crypto=openssl
 # produces  bin/gcc-4.8.5/release/address-model-64/crypto-openssl/threading-multi/libtorrent.so.1.1.2

cp bin/gcc-4.8.5/release/address-model-64/crypto-openssl/threading-multi/libtorrent.so.1.1.2 /usr/local/lib
ldconfig

cd bindings/python/

#build python bindings
b2 toolset=gcc link=shared variant=release target-os=linux address-model=64 libtorrent-link=shared

# produces: bin/gcc-4.8.5/release/address-model-64/libtorrent-python-pic-on/visibility-hidden/libtorrent.so

# we need to set the this otherwise deluge setup will try to build libtorrent in a way that does not work
PYTHONPATH=/usr/local/src/deluge/libtorrent-rasterbar-1.0.8/bindings/python/bin/gcc-4.8.5/release/address-model-64/libtorrent-python-pic-on/visibility-hidden

export PYTHONPATH


cd /usr/local/src/deluge/
wget http://download.deluge-torrent.org/source/deluge-1.3.12.tar.bz2 # or get from git or whatever
 tar -xvf deluge-1.3.12.tar.bz2

cd deluge-1.3.12
ln -s  /usr/local/src/delug/libtorrent-rasterbar-1.0.8 libtorrent

python setup.py build
python setup.py install # or bdist if you wise and did that in a virtual environment etc

You need to copy libtorrent python binding somewhere (like under deluge in /usr/lib/python/site-packages/deluge-1.3.12/deluge) or set the PYTHONPATH in order for the module to be found in runtime.