Skip to content

Instantly share code, notes, and snippets.

@jcsaaddupuy
Created March 29, 2015 13:26
Show Gist options
  • Save jcsaaddupuy/222675081127b26a92e3 to your computer and use it in GitHub Desktop.
Save jcsaaddupuy/222675081127b26a92e3 to your computer and use it in GitHub Desktop.
Install boost + libtorrent in a virtualenv
#!/bin/bash
get_boost(){
wget -c "http://downloads.sourceforge.net/project/boost/boost/1.57.0/boost_1_57_0.tar.gz"
[ $? -ne 0 ] && exit 1
tar xf boost_1_57_0.tar.gz
[ $? -ne 0 ] && exit 1
pushd ./boost_1_57_0
[ $? -ne 0 ] && exit 1
./bootstrap.sh --with-python=$(which python) --prefix=$VIRTUAL_ENV
[ $? -ne 0 ] && exit 1
./b2 --prefix=$VIRTUAL_ENV
[ $? -ne 0 ] && exit 1
./b2 --prefix=$VIRTUAL_ENV install
[ $? -ne 0 ] && exit 1
popd
}
get_libtorrent(){
wget -c "http://downloads.sourceforge.net/project/libtorrent/libtorrent/libtorrent-rasterbar-1.0.3.tar.gz"
[ $? -ne 0 ] && exit 1
tar xf libtorrent-rasterbar-1.0.3.tar.gz
[ $? -ne 0 ] && exit 1
pushd ./libtorrent-rasterbar-1.0.3
[ $? -ne 0 ] && exit 1
# see https://github.com/OpenBazaar/OpenBazaar/issues/1017#issuecomment-66898889
./configure --disable-debug --disable-dependency-tracking --disable-silent-rules --enable-encryption --prefix=$VIRTUAL_ENV --with-boost=$VIRTUAL_ENV --enable-python-binding --with-libiconv --with-boost-python=mt PYTHON=python PYTHON_LDFLAGS="$(python2-config --libs)" BOOST_ROOT=../boost_1_57_0
[ $? -ne 0 ] && exit 1
make && make install
[ $? -ne 0 ] && exit 1
python setup.py build
[ $? -ne 0 ] && exit 1
python setup.py install
[ $? -ne 0 ] && exit 1
popd
export LD_LIBRARY_PATH=$VIRTUAL_ENV/lib
python -c 'import libtorrent as lt' || echo 'Fail'; exit 1
echo 'export LD_LIBRARY_PATH=$VIRTUAL_ENV/lib' >> $VIRTUAL_ENV/bin/postactivate
}
get_boost
get_libtorrent
exit 0
@jcsaaddupuy
Copy link
Author

On low mempry system :

sudo dd if=/dev/zero of=/swapfile bs=1024 count=3145728
sudo mkswap /swapfile
sudo swapon /swapfile

ubuntu 14.04 pre-requisites

sudo apt-get install build-essential gcc g++ make automake autoconf libbz2-dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment