vendredi 25 mars 2011

Building Transmission 2.04 on SheevaPlug


Transmission is a lightweight Bittorrent Client that I installed on my plug computer to manage my downloads remotely, by using the web interface provided.

As I said in my previous entry, only the Jaunty release of Ubuntu can run on the SheevaPlug, and transmission is only available in version 1.51 Jaunty repositories. As this version is quite young (Chrome not properly supported, incomplete download directory not used...), I decided to follow this great guide to build version 2.04 of Transmission, which is the one available in Maverick, the current stable release of Ubuntu.

Though my method was a little bit different and I would like to explain it.

Setting up a "minimal" build environment

If we look at the Transmission wiki, we see that a lot of packages are required to build it. As the SheevaPlug itself is really limited in terms of system storage (512MB), I wanted to get the minimal dependancies required to build Transmission without the GUI, which is totally useless as we install it on a headless box.

First, I downloaded the sources from here and extracted the Tarball.

Then I used the following command, that checks the build environment for a headless install:
./configure –disable-gtk

As soon as a missing lib or package is detected, an error is raised. So I proceeded in an iterative manner, installing the needed packages one at a time. Here is the list of what I had to install:

  • build-essential
  • libcurl4-openssl-dev
  • intltool
  • libevent-dev 
However I found out that the libevent-dev available on the Jaunty repo was deprecated, as the ./configure required a version > 1.4.9. So before building Transmission, I had to build libevent-dev before. I installed the others packages like this:
apt-get install build-essentials libcurl4-openssl-dev intltool

Building and installing libevent-dev

I downloaded the sources from Maverick repository. They are available here. The version is 1.4.13 so it matches the ./configure requirements. Extract, and rename the directory to libevent-dev-1.4.13 (I'll explain why).

To check that build requirements are met on your system run:

Then build and install (apt-get install checkinstall if you don't have it):

If checkinstall asks you for some additional information, juste leave everything by default and spam the enter key.

Why checkinstall instead of make install? Because checkinstall includes the make install, and will also create a package for this lib, that will be recognized by the ./configure of Transmission. The reason why we renamed the libevent-dev folder is that the package will be named correctly and recognized by the configure.

Building and installing Transmission

Go back to your Transmission folder and run again:
./configure -disable-gtk

Now everything should be OK, and we are ready to build! Just make sure to make a copy of your settings.json if you already used Transmission before.

Remove the old Transmission if any:
aptitude purge transmission-daemon

Then build and install:
make install

Now we have to make an init.d script by following these instructions. Also create a transmission user without password as explained. The settings.json should be located here:

If you made a backup of this file, I recommend to merge your settings manually as the format of the file may have changed.

Run !
/etc/init.d/transmission-daemon start


I wanted to see how much disk space I gained with this "iterative method". After having completed the build of Transmission, I simply ran the following command:
apt-get install build-essential automake autoconf libtool pkg-config libcurl4-openssl-dev intltool libxml2-dev libgtk2.0-dev libnotify-dev libglib2.0-dev

The result speaks for itself:
0 upgraded, 145 newly installed, 0 to remove and 0 not upgraded.
Need to get 33.0MB of archives.
After this operation, 130MB of additional disk space will be used.

Introducing the SheevaPlug

I have been thinking for a while about setting up an all-in-one Linux box in my local network. The goal was to have a NAS, web bittorrent client, FTP client in a cheap, low power consuming box.

I finally got a SheevaPlug at New IT, the European reseller for around 120€ shipping included. This thing is amazing. It runs a lightweight Ubuntu 9.04, on a 1.2GHz ARM, with 512MB RAM and 512MB ROM. For a mean consumption of around 5W. I just plugged a 500GB external HD to get some storage space.

The only drawback I have found so far is that Ubuntu 9.10 and later are not compatible with the plug. They are built for ARM v6, whereas the SheevaPlug runs an ARM v5. So only security updates are provided, but the other packages are frozen in their Jaunty version.

To get up-to-date packages, there is 2 solutions :
  • Compiling by hand
  • Switching to Debian, which still supports ARM v5

jeudi 24 mars 2011

Forcer une application android a se manifester !

Ce problème tout bête m'a laissé penaud quelques heures... Après avoir créé mon appli dans Eclipse, définit mon Activity dans le AndroidManifest.xml, puis lancé le projet... Rien. Et ça dans la sortie standard :

[2011-03-24 16:45:37 - Appli] Uploading Appli.apk onto device 'emulator-5554'
[2011-03-24 16:45:37 - Appli] Installing Appli.apk...
[2011-03-24 16:45:40 - Appli] Success!
[2011-03-24 16:45:40 - Appli] \Appli\bin\Appli.apk installed on device
[2011-03-24 16:45:40 - Appli] Done!

Après quelques ragequit, j'ai identifié la cause du problème. J'avais ceci dans mon AndroidManifest.xml :

<application [...] android:debuggable="true">
  <activity android:name="ContactList"></activity>

Pour dire à Android d'exécuter cette Activity, il faut ajouter un intent-filter :

<application [...] android:debuggable="true">
  <activity android:name="ContactList">
      <action android:name="android.intent.action.MAIN" />
      <category android:name="android.intent.category.LAUNCHER" />


On relance, et c'est réglé !

D'après ce que je comprend, un intent-filter permet à une Activity de "publier" quels sont les Intents qui vont pouvoir la réveiller. En l'occurence, un Intent d'exécution.

mercredi 23 mars 2011

Débugger sur son HTC

Pendant que mes pâtes cuisent, j'inaugure ce dev-log par une petite astuce pour débugger ses applications Android directement sur son téléphone.

Un des prérequis est d'installer le driver USB correspondant au téléphone. Dans le cas des HTC, celui-ci est inclus dans HTC Sync, logiciel permettant de synchroniser ses données sous Windows, donc parfaitement inutile.

Lançons donc l'installeur. Les dépendances, dont le driver vont tout d'abord être installées. Ensuite lorsque vient le tour de HTC Sync, il suffit d'annuler l'installation pour ne pas polluer inutilement sa machine.