0

I am trying to get up and running with MQTT paho, as I am developing an application that is going to be required to transmit via MQTT.

Right now I am just trying to get off the ground by getting the sample code provided by the Paho project running.

I am cloning the repository using the command: git clone https://github.com/eclipse/paho.mqtt.c.git

This the part that I am most unsure about, what flags are need for the code located in /src to be compiled and what do I have to do with Cmake/make files for my code to be able to compile and run correcty?

For reference I was originally trying to get the asynchronous publish client code running that was provided at http://www.eclipse.org/paho/files/mqttdoc/Cclient/pubasync.html

Any help on this would be appreciated as I am decently lost on the matter.

1 Answers1

0

The example you shared is quite simple, not require any other configs. Follow the steps if you haven't installed paho C client yet :

1. git clone https://github.com/eclipse/paho.mqtt.c.git
2. cd paho.mqtt.c.git
3. make
4. sudo make install

Please notice that you may need to have libssl-dev. For more info check this page.

You can compile this example by the command below:

gcc example.c -lpaho-mqtt3c

Still, if you need to do some build config, your choices are :

cmake -GNinja -DPAHO_WITH_SSL=TRUE -DPAHO_BUILD_DOCUMENTATION=TRUE -DPAHO_BUILD_SAMPLES=TRUE ~/git/org.eclipse.paho.mqtt.c
cagdas
  • 1,634
  • 2
  • 14
  • 27