- smart communication -

NDL on Raspberry Pi

NexusDataLink can run on Raspberry Pi (Raspbian).

It requires some steps to be done, which shall be described in this chapter: it shows how to run the NDL example agent (including the agentLib) on the Raspberry Pi.

raspberry-pi-572481_1280

Please note that there are numerous ways how to build and automate an NDL AgentLib distribution for Raspberry Pi in a more elegant and sophisticated way– this article just demonstrates the technical steps that have to be performed to get a proof-of-concept.

Step 1:

Follow this tutorial to cross-compile Qt 5.x for your Raspberry Pi:
http://qt-project.org/wiki/RaspberryPi_Beginners_guide

For NDL it is sufficient to compile only the Qt core modules omitting GUI-related modules.

Step 2:

Apply the Qt Creator configuration described in the mentioned tutorial to project qt_agentlib and the NDL example agent in qt_agent.

Step 3:

Compile Google Protobuf on your Raspberry Pi and copy the file libprotobuf-lite.a to a directory of your choice on your development runtime platform (e.g. your PC). You will find more detailed information about compiling Google Protobuf in the NDL developer manual.

Step 4:

When compiling the NDL AgentLib (qt_agentLib) the .pro file must point to the directory where the Protobuf library is located. As we will cross-compile NDL agent, the default Protobuf library of your system (which you will get if you setup your NDL development platform as documented in the NDL manual) would be incompatible.

So the file agentLib.pro has to be changed so that the corresponding -L option points to the directory where you copied your remote-compilted Protobuf library

Step 5:

You should now be able to perform a successful cross-compilation using Qt Creator – first on project qt_agentlib, then on qt_agent.

Step 6:

Copy the resulting artifacts agent, libagentlib.so* and the directory agentLibFiles to your Raspberry Pi, so that the following directory structure exists:

home/pi/ndl_agent
|---bin
|    |
|    |---agent
|    |---libagentlib.so*
|
|---agentLibFiles

Step 7:

Execute the NDL example agent on the Raspberry Pi:

cd /home/pi/ndl_agent/bin
export LD_LIBRARY=. # to find shared library libagentlib.so
./agent 

You should now see the output log of the NDL example agent – it runs on your Raspberry Pi!

Have fun!