Adding mqtt libraries to Eclipse

Hello,

Some time ago I followed the Getting started guide to configure eclipse. I coded and compiled several c programs to read and process CAN data from my Apalis iMX6 and everything works fine, now, the next step is to configure an mqtt broker to manage the information.

In order to do that i would like to add the Eclipse Mosquitto library to eclipse but I have no idea how to do it, I’ve been trying some options I found online like adding the path to it on Settings → C/C++ Build → Cross GCC compiler → Includes and also Settings → C/C++ Build → Cross GCC Linker → Libraries but I haven’t managed to make it work.

What would be the way to do it? Do I need to create a custom SDK ?

Thanks in advance

Hi

Note that while Mosquitto is under the umbrella of the Eclipse Foundation it has no direct connection to the Eclipse IDE.

If you want the Mosquitto Broker/Server on your module then you would add the ‘mosquitto’ package to your image, e.g. by adding it to IMAGE_INSTALL, and then rebuild and install the image.

If you want to write your own client library you would need to:

  • add the library packages ‘libmosquitto1 libmosquittopp1’ to your image, e.g. by adding it to IMAGE_INSTALL, and then rebuild and install the image.
  • and then rebuild the SDK with ‘bitbake (your image) -c populate_sdk’ and reinstall it. Your Eclipse IDE settings should still be valid, i.e. when building the headers and libraries of mosquitto should be found.

Max