Recently, I needed a software that sends and recevies Short Message Services (SMS) from a Linux ARM-based embedded device. Obviously, I needed something with a small foot-print and not resource-hungry. I found three FOSS options that could fit my needs:
This project is quite old and unmaintained. If you compile it with a recent gcc (I was using 4.3.x), you’ll need to apply this patch provided by Debian. The building procedure is straight-forward, but the results, at least for me, were quite disapointing because the SMS daemon crashed very often.
Gammu is a fork of gnokii (the third option), it’s well documented, it’s robust and more complex, and it has a lot of features making it a bit heavier than gnokii. If your hardware is a PC or a high-end ARM processor I would recommend gammu. It also depends on libdbi that implements a database-independent abstraction layer in C, similar to the DBI/DBD layer in Perl.
Since I can only use SQLite3, I don’t need the portability to other databases making the use of libdbi redundant.
Gnokii is a set of tools, similar to gammu that allows to send/receive SMS, read/write to a phonebook and other services. I was only interested in the SMS functionality that seemed to cover quite well.
gnokii’s SMS daemon, smsd, is quite light, making it suitable for small ARM processors like the one I have.
Latest versions support SQLite3 so I could even put the two tables that smsd uses for sending and receiving SMS inside my database.
The documentation is not great, but good enough to get started. The code is quite clear and easy to understand. In fact, I found a memory leak in smsd that I fixed and sent to the mailing list. The patch was applied quite fast showing the active development around this project.
I decided to use gnokii and document its building procedure since the cross-compilation is not straight forward.
This is the procedure I followed:
Set the following environment variables that will make our life easier:
$ export BUILD=i386-linux $ export HOST=arm-linux $ export PROJECT_PATH=/home/projects/rootfs
GLIB_CFLAGS="-I$PROJECT_PATH/usr/include/glib-2.0 -I$PROJECT_PATH/usr/lib/glib-2.0/include" GLIB_LIBS="-L$PROJECT_PATH/usr/lib" SQLITE3_CFLAGS="-I$PROJECT_PATH/usr/include" SQLITE3_LIBS="-L$PROJECT_PATH/usr/lib" ./configure --build=$BUILD --host=$HOST --without-x --without-bluetooth --without-libical --disable-libusb --disable-phonet --enable-sqlite --disable-xdebug
Before building, edit the following Makefiles:
Unset the variable LIBS:
Edit the files gnokii/Makefile and gnokiid/Makefile:
Set the variable LIBS to the following value:
LIBS = -L/home/projects/rootfs/usr/lib -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lglib-2.0
Edit the file smsd/Makefile:
Set the variable GLIB_LIBS to the following value:
GLIB_LIBS = -L/home/projects/rootfs/usr/lib -lsqlite3
Set the variable CFLAGS to the following value:
CFLAGS = -g -O2 -Wall -Wno-pointer-sign -fvisibility=hidden -fno-strict-aliasing -I/home/projects/rootfs/usr/include
Now you can build and install in /home/projects/rootfs/usr/local:
make make DESTDIR=$PROJECT_PATH/usr/local install
Gnokii still has some rough edges that can be fixed/improved, but after a couple of months of intensive use its behaviour has been quite stable.