Home of simple tools for simple tasks and weblogs

Build rtorrent v0.9.6 for Linux on ARM (armv5tel) with SSL and TLSv1.2

rtorrent 0.9.6 running on Buffalo Linkstation Live (armv5tel)

The rtorrent v0.8.1 from the Optware on a Buffalo Linkstation Live (LS-CHLFFE) v2 NAS doesn’t support TLSv1.2. We need to upgrade rtorrent to a recent release in order to support HTTPS trackers requiring TLSv1.2. This post is about the process of building rtorrent v0.9.6 from the source code.

Introduction

This post is about building rtorrent 0.9.6 on a Buffalo Linkstation Live (LS-CHLFFE) v2 NAS. It’s assumed that Optware has been set up. This means that necessary compilation tools can be installed by using ipkg command.

We are going to build the following software components:

Optionally, rtorrent supports XML-RPC, which requires xmlrpc-c. To build xmlrpc-c, a recent version of Boost is required. Since I don’t use XML-RPC functionalities, in this post, rtorrent will be configured without XML-RPC.

Building steps

All the tools will be configured with prefix=/opt/local. This means that compiled built binaries and support files will be installed in subdirectories in /opt/local, for instance, executables will be installed in /opt/local/bin, and libraries in /opt/local/lib. We need to add /opt/local/bin and /opt/local/lib to the font of $PATH and $LD_LIBRARY_PATH respectively.

automake

Change to the directory where automake-1.16.tar.gz is saved.

libz

Change to the directory where zlib-1.2.11.tar.gz is saved.

OpenSSL

Change to the directory where openssl-1.1.0g.tar.gz is saved.

NB: The prefix is set to “/opt/local/ssl”, therefore, the path should be add to $LD_LIBRARY_PATH as well. The configuration needs to include “enable-egd”, otherwise, curl would fail to compile.

 

curl

Change to the directory where curl-7.59.0.tar.gz is saved.

libtorrent

Change to the directory where libtorrent-0.13.6.tar.gz is saved.

Here is where it gets tricky. The previous steps work normally. But the installation of libtorrent v0.13.6 would fail with errors like the following

It has turned out to that the version of gcc used for the compilation doesn’t have atomic builtin functions for ARM. Basically, the default gcc, gcc 4.2.3, doesn’t have atomic builtins on ARM. More information can be found here and here.

In fact, libtorrent 0.13.6 can be configured not to use those atomic builtins by passing “-disable-instrumentation” to the configure script. That would allow libtorrent to be installed without any patches or tricks with gcc 4.2.3. However, rtorrent  also uses atomic builtins and it can be turned off in rtorrent. Rtorrent would fail to link even with the tricks mentioned in above two links.

So the solution would be to apply the tricks, that is, get the source code of those atomic builtins from gcc source tree, compile the code accordingly and link the compiled object code in both libtorrent and rtorrent. Change to a new working directory, for instance, ~/downloads/linux-atomic

Now change to the directory where the source code of libtorrent is. But before we start building libtorrent, as I have tested, we need to apply one more change to the source code of libtorrent, which is also related to the use of atomic builtins in libtorrent. Edit src/utils/instrumentation.h and src/utils/instrumentation.cc, change the all the instances of int64_t to int32_t, and PRIi64 to PRIi32. Then, let’s change to mybuild directory and build libtorrent again. Note, if you have already run configure before in mybuild directory, please run “make distclean” before running the following commands.

rtorrent

Compilation of rtorrent requires ncurses header files. In Optware, we need to install “ncurses-dev” and “ncursesw-dev”.

Change to the directory where rtorrent-0.9.6.tar.gz is saved.

Done! For configuration of rtorrent, command list, and more information about rtorrent, please refer to rtorrent wiki page.

Download

The compilation takes a long time on the NAS. I’ve made an archive of /opt/local. The executables (rtorrent and curl) should be able to run on compatible systems. The archive can be downloaded here. See README file included for more information about the archive.

Leave a comment

Your email address will not be published. Required fields are marked *