3 Compilation Raspbian for LeMaker Banana Pro
Chocobo1 edited this page 2024-05-01 17:19:26 +08:00
This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This how-to will guide you through the compilation of qBittorrent and libtorrent-rasterbar on LeMaker Banana Pro with Raspbian as Operative System.

This guide is written for Raspbian (which is based upon Debian) and BananaPRO, but the process should be similar for BananaPi and other Debian distributions.

Please continue following this guide only if you have a minimum knowledge of what are you going to do, and only if this is what you really want.

If you are looking only for the latest version of qBittorrent, just head to the download page and use our PPAs.

Required dependencies

  • General required dependencies

    sudo apt-get install libboost-dev libboost-system-dev

  • Qt4 libraries

    sudo apt-get install libqt4-dev

[ at the time of this writing, Qt5 libraries were not available for Raspbian on B-Pro. You can safely compile QBitTorrent against Qt4 Libraries. ]

  • Python (Run time only dependency, needed by the search engine)

    sudo apt-get install python

Optional dependencies

  • Geoip Database (For peer country resolution, strongly advised)

    sudo apt-get install geoip-database

Libtorrent

Libtorrent is a library written by Arvid Norberg that qBittorrent depends on. It is necessary to compile and install libtorrent before compiling qBittorrent.

Default Raspbian distro packages a very old (and very unstable) version of libtorrent, hence you will need to compile it yourself.

Notes:

The procedure for compiling and installing Libtorrent on B-Pro is derived from the Deluge Wiki: some minor adjustments have been made to the procedure in order to work correctly on B-Pro.

Install dependencies for libtorrent build automatically, using build-dep:

sudo apt-get build-dep libtorrent-rasterbar
sudo apt-get install checkinstall

Your system could be configured with some option that might interfere with checkinstall. If previous installation fails then proceed manually:

sudo apt-get install build-essential checkinstall libboost-system-dev libboost-python-dev libssl-dev libgeoip-dev

Download libtorrent and extract:

wget https://github.com/arvidn/libtorrent/releases/download/libtorrent_1_1_11/libtorrent-rasterbar-1.1.11.tar.gz

tar xf libtorrent-rasterbar-1.0.10.tar.gz

cd libtorrent-rasterbar-1.0.10

Configure:

./configure --enable-python-binding --with-libgeoip --with-libiconv --with-qt4

WARNING: Users with Debian 8 "Jessie" or "Stretch"

If you have updated your Raspbian to the latest version "Jessie" then you will most certainly face an error with libboost library while using the ./configure

To overcome this error and configure correctly you must issue the following commands:

sudo apt-get install libboost-chrono-dev libboost-random-dev

./configure --enable-python-binding --with-libgeoip --with-libiconv --with-boost-libdir=/usr/lib/arm-linux-gnueabihf

Build:

make -j$(nproc)

[The make option -j$(nproc) will utilize all available cpu cores.]

Install library and python bindings:

sudo checkinstall

[ The checkinstall command replaces the make install. It created a DEB Package for easier removal/re-install through dpkg. ]

sudo ldconfig

[Running ldconfig avoids an ImportError for libtorrent-rasterbar.so, a result of Python being unable to find the main library.]

Compiling qBittorrent (with the GUI)

Now that each prerequisite has been completed you mut obtain the qBittorrent source code.

Either download and extract a .tar archive from Sourceforge or use the following commands to speed-up the process.

git clone https://github.com/qbittorrent/qBittorrent

Configure qBittorrent

WARNING: Users with Debian 8 "Jessie"

If you have updated your Raspbian to the latest version "Jessie" then you will most certainly face an error with libboost library while using the ./configure

To overcome this error and configure correctly you must issue the following commands:

sudo apt-get install libboost-dev-all

./configure --enable-python-binding --with-libgeoip --with-libiconv --with-boost-libdir=/usr/lib/arm-linux-gnueabihf --with-qt4

cd qBittorrent/

./configure --prefix=/usr --with-qt4

make

Install qBittorrent:

sudo checkinstall

[alternatively you can use the standard command make install, as discussed before]

That's it! qBittorrent should now be installed. You can now run qBittorrent using the following command:

qbittorrent

Compiling qBittorrent-NOX (aka Without the GUI, also called headless)

Now that each prerequisite has been completed you mut obtain the qBittorrent source code.

Either download and extract a .tar archive from Sourceforge or use the following commands to speed-up the process.

git clone https://github.com/qbittorrent/qBittorrent

Configure qBittorrent

cd qBittorrent/

./configure --prefix=/usr --disable-gui --with-qt4

WARNING: Users with Debian 8 "Jessie"

If you have updated your Raspbian to the latest version "Jessie" then you will most certainly face an error with libboost library while using the ./configure

To overcome this error and configure correctly you must issue the following commands:

sudo apt-get install libboost-all-dev

./configure --prefix=/usr --disable-gui --enable-python-binding --with-libgeoip --with-libiconv --with-boost-libdir=/usr/lib/arm-linux-gnueabihf --with-qt4

make

Install qBittorrent:

sudo checkinstall

[alternatively you can use the standard command make install, as discussed before]

That's it! qBittorrent should now be installed. You could simply launch Qbittorrent-nox using the following command:

'qbittorrent-nox'

But since you have chosen the "headless" version you can access qBittorrent only through its WEB Interface.

Standard Access to WEB Interface

As a default, you can access it from the following address:

http://localhost:8080

Using the following credentials:

Username: admin

Password: adminadmin

Customize WEB Interface Listening Port

If you have another service listening on port 8080, or you simply want to use a different port, you can instruct qBittorrent to listen on a different by using the following launch command:

qbittorrent-nox --webui-port=xxxx

Where the 'xxxx' stands for the port number you desire to use. For example, if you want to use the Port 8181 than the command will be:

qbittorrent-nox --webui-port=8181

Note: There is no need to repeat this instruction in future. Once started for the first time, qBittorrent will remember the designated listening port. So from next sessions onwards you can simply execute it with the command:

qbittorrent-nox

Running qBittorrent-nox as a daemon at system startup

Since you are using the "headless" version of qBittorrent, you might also want to autostart it at system boot as a daemon.

By doing so you will not need to keep open a terminal window in order to execute qBittorrent.

Using CronJob at Reboot

Please Note: the following solution is based upon personal research and days of testing. I am aware that it might not be the nicest solution available, but if your are running qBittorrent-nox on B-Pro with Raspbian chances are that you too noticed how **impredictible **and **unstable **is its behaviour when using update-rc.d method.

The following commands are based upon the assumption that you are running qBittorrent under a dedicated user. If you are running it under the 'bananapi' root user you need to execute the following with 'root privileges'.

Execute the following command:

crontab -e

Scroll to the bottom of the file and insert the following line:

@reboot qbittorrent-nox

Use " CTRL + O " to save the file, than " CTRL + X " to exit.

That's it! Now qBittorrent-nox should be correctly configured for autostart!

If you want to try it just reboot you B-Pro with the command:

sudo reboot

Final Notes

This work has been realized putting together personal knowledge and information provided by other authors.

Credits are as follows:

Thanks to SledgeHammer for providing a solid template for compiling and running qBittorrent under Debian.

Thanks to Cas from Deluge Wiki for explaining how to compile libtorrent_rastebar under Debian with the use of checkinstall.