Synology DS: Cross compiling Eclipse/IBM RSMB MQTT broker

RSMB: Really Small Message Broker is an MQTT broker/server, simpler than the alternatives like Mosquitto, RabiitMQ, and so on. While it has its origins in IBM labs (as the MQTT protocol), it is now a project/sub project on Eclipse Paho MQTT related software. While downloading the RSBM does provide some binaries for some common platforms, it doesn’t offer any binaries for, in my case, the DS212+ Marvell 88F628x ARM processor.

So let’s see how to cross compile the RSMB for Synology DS and in this process also learn how to cross compile in your desktop computer native software for the Diskstation.


Setting up the cross compiling environment:

First, a read of the following document The 3rd party developer guide from Synology located here  is recommended. Based on this document (page 6 and 7)and on this page, we can know what version of the Synology tool chain we need to download from here:

Download the required tool chain for your Synology version. In my case I have the Synology DS212+ that has the Marvel 88F628x ARM processor, so download this file:

Uncompress the file into the /usr/local directory. DO USE this directory. The tool chain is configured to get all files, libraries and so on from the /usr/local/… directory:

sudo tar xvzf gcc464_glibc215_88f6281-GPL.tgz -C /usr/local/

(Note: It’s a CAPITAL C. Check Synology documentation).

We can now get the RSMB sources.

Cross compiling RSMB:

Open an shell terminal (preferably bash but other shells might work) and create and change to a working directory. Clone the RSMB repository located in with git tools:

mkdir work_dir
cd workdir
git clone
cd org.eclipse.mosquitto.rsmb/rsmb/src/

While, for this case, not all the below settings are needed, for documentation purposes I document them here:

export INSTALLDIR=/usr/local/arm-marvell-linux-gnueabi
export TARGETMACH=arm-marvell-linux-gnueabi
export BUILDMACH=i686-pc-linux-gnu
export CROSS=arm-marvell-linux-gnueabi
export CC=${CROSS}-gcc
export LD=${CROSS}-ld
export AS=${CROSS}-as
export AR=${CROSS}-ar

Just make sure that the INSTALLDIR variable and TARGETMACH and CROSS variables point to the correct settings.

Also, in this case, for compiling RSMB, we need also to add the following variable:

export GCC=${CROSS}-gcc

Otherwise we need to change the Makefile and change the line GCC=gcc to point to the correct compiler. We can compile now:


And we should have the broker executable among others.

Let’s make sure that it is ok:

pcortex@dune:~/01.Develop/org.eclipse.mosquitto.rsmb/rsmb/src$ file broker
broker: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped

If the output is this:

broker: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=815abb3a1aad7f430c6e825670601c4991b45bd5, stripped

The wrong compiler was called.

Synology installation:

Copy the following files to your synology station: broker and Messages. From your workstation:

scp broker root@diskstation:/usr/local/bin
scp Messages. root@diskstation:/usr/local/bin

Access through ssh the Synology terminal, and make sure that broker is executable and do a test run:

cd /usr/local/bin
chmod +x broker
20150104 190523.162 CWNAN9999I Really Small Message Broker
20150104 190523.162 CWNAN9998I Part of Project Mosquitto in Eclipse
20150104 190523.163 CWNAN0053I Version, Jan  2 2015 20:13:39
20150104 190523.163 CWNAN0054I Features included: bridge
20150104 190523.163 CWNAN9993I Authors: Ian Craggs (, Nicholas O'Leary
20150104 190523.163 CWNAN0014I MQTT protocol starting, listening on port 1883

And success! We can now test with MQTT-Spy (, Android Client, or Eclipse Paho tools.

Configuration and start and stopping:

For configuring the RSMB, we really should really read the documentation… 🙂 that is provided…

A simple configuration file should be located at /usr/local/etc and named rsmb.conf with the following basic contents:

# sample configuration on port 1883 with retained persistence in /tmp
port 1883
max_inflight_messages 50
max_queued_messages 200
persistence_location /tmp/
retained_persistence true

And at the /usr/local/etc/rc.d create a file named with the following content:


case $1 in
    nohup /usr/local/bin/broker /usr/local/etc/rsmb.conf >> /var/log/rsmb.log&
    /usr/bin/logger -p1 -t "rsmb: INFO  " " Service started."
    /usr/bin/killall broker
    /usr/bin/logger -p1 -t "rsmb: INFO  " " Service stopped."

Save and chmod +x

Now the broker should start and stop automatically.

Final notes:

To use the broker from the Internet the port 1883/TCP should be open/forward at your router/firewall, and you should add authentication to the MQTT broker.


8 thoughts on “Synology DS: Cross compiling Eclipse/IBM RSMB MQTT broker

  1. Pingback: md5deep and hashdeep on Synology DS212+ | Primal Cortex's Weblog

  2. Hi!

    I’m trying to build RSMB to my Synology DS207+ and I´ve followed all your tutorial steps and I got the toolchain for my 88f5281 CPU (

    When I trying to make my executable, I only get this response: “arm-marvell-linux-gnu-gcc -Wall -s -Os *.c -o broker
    /usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-gcc: line 12: syntax error: unexpected word (expecting “)”)
    make: *** [broker] Error 2″

    I´ve set up my variables like this before trying to make.

    export INSTALLDIR=/usr/local/arm-marvell-linux-gnu
    export PATH=$INSTALLDIR/bin:$PATH
    export TARGETMACH=arm-marvell-linux-gnu
    export BUILDMACH=i686-pc-linux-gnu
    export CROSS=arm-marvell-linux-gnu
    export CC=${CROSS}-gcc
    export LD=${CROSS}-ld
    export AS=${CROSS}-as
    export AR=${CROSS}-ar
    export GCC=${CROSS}-gcc

    I’m a quite experienced programmer on windows, but this linux stuff is above me and now the fun have stopped. Can you recommend me anything?

    • Hi:

      It seems that the file /usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-gcc has some error in line 12, which is a bit strange because I suppose it should be a binary….

      Are you sure that the toolchain is properly decompressed and installed?

      If you execute the command /usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-gcc do you also get the same error?

      • Hi!

        Thank you for your response! Yes I get the same error when just executing the gnu-gcc binary.

        I decompressed following your example but with the toolchain for dsm 3.1 (I have the DS207+) and my cpu architechture 88f5281 (gcc343_glibc232_88f5281.tgz) into /usr/local/.

        Worth mentioning is that I first followed your tutorial with the wrong DSM toolchain and had to do the whole thing all over again with the correct one. I haven´t deleted the first incorrect decompressed files in /usr/local/, although they are decompressed into “arm-marvell-linux-gnu-gcceabi” which I thought shouldn’t matter.

        Response when executing the gnu-gcc binary:

        DiskStation> sudo /usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-gcc
        /usr/local/arm-marvell-linux-gnu/bin/arm-marvell-linux-gnu-gcc: line 12: syntax error: unexpected word (expecting “)”)

        I really appreciate that your trying to help me, I really would like to have a MQTT boker setup at my NAS so that I can continue experimenting with my micro controllers. Too bad that you can’t use the Synology community Mosquito edition on DSM 3.1.

    • Ahhhh, got it.
      You are executing the tool chain on the Diskstation, right?

      If I’m right, this is your problem. This is a CROSS toolchain.

      You must use the toolchain on a X86 based Linux station, and then move the binaries to the diskstation.

      That explains the error on line 12, because the compiler might uses the shell interpreter bash, and the Synology doesn’t use bash.

      • Hi!

        Yes! It works!

        I was executing it directly on my NAS. Now I’ve built it on a x86 based linux station and successfully started the broker on my NAS! It works!

        Thanks a lot for all your help! Now onto the micro controllers and what to build. 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s